OpenOffice.org Forum at OOoForum.orgThe OpenOffice.org Forum
 
 [Home]   [FAQ]   [Search]   [Memberlist]   [Usergroups]   [Register
 [Profile]   [Log in to check your private messages]   [Log in

instantiate SimpleFileAccess in java

 
Post new topic   Reply to topic    OOoForum.org Forum Index -> OpenOffice.org Macros and API
View previous topic :: View next topic  
Author Message
kuzhie
General User
General User


Joined: 08 Feb 2004
Posts: 26

PostPosted: Tue Mar 23, 2004 3:08 pm    Post subject: instantiate SimpleFileAccess in java Reply with quote

Helloo!

Being a newbie, OO API seems to look very complex. This is what I dont understand. How can I know the right way to instantiate an object in java.

I have a sample code in Basic such as

Code:

oSimpleFileAccess = createUnoService( "com.sun.star.ucb.SimpleFileAccess" )


In my java, I've try

Code:

String storeFileUrl = "file:////home/kusumas/Java/Receipt/MyFile.pdf"

      xSimpleFileAccess = (com.sun.star.ucb.XSimpleFileAccess)UnoRuntime.queryInterface(
         com.sun.star.ucb.XSimpleFileAccess.class, desktop);

xSimpleFileAccess.openFileRead(storeFileUrl);


But on the line 'openFileRead' I got null (java.lang.NullPointerException) error.

I have other object such as XInputStream and XOutputStream that I'd like to try on my applicaiton. But I'm not sure how can I use such object.

TIA for any input,
Kusuma
Back to top
View user's profile Send private message
DannyB
Moderator
Moderator


Joined: 02 Apr 2003
Posts: 3991
Location: Lawrence, Kansas, USA

PostPosted: Tue Mar 23, 2004 3:55 pm    Post subject: Reply with quote

You need to call createInstance() on the ServiceManager. (On the XMultiServiceFactory interface of the ServiceManager that is.) Create an instance of com.sun.star.ucb.SimpleFileAccess.

The Desktop does not include the SimpleFileAccess service.
_________________
Want to make OOo Drawings like the colored flower design to the left?
Back to top
View user's profile Send private message
Display posts from previous:   
Post new topic   Reply to topic    OOoForum.org Forum Index -> OpenOffice.org Macros and API All times are GMT - 8 Hours
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum


Powered by phpBB © 2001, 2005 phpBB Group