 |
BorlandTalk.com Borland discussion newsgroups
|
| View previous topic :: View next topic |
| Author |
Message |
Kevin Dean [TeamB] Guest
|
Posted: Tue Jun 21, 2005 12:24 pm Post subject: Re: Passing data into a jar file???? |
|
|
Anton wrote:
| Quote: | Hi.
Anybody can help me??
I have an applet which needs some files to works. What I do is pack
it into a jar file. The problem is I don't know how to retrieve the
data contained in this file.
And in the file "myextrafiles" I have several files like
"i18n_en_EN". How can I open this file to extract its data????? and
pass it to a variable Properties. How can I know where is located???
|
If you have a class:
com.mydomain.MyClass
and you put the properties file in the source directory:
com/mydomain/properties/MyApplication.properties
you can access it using:
MyClass.class.getResource("properties/MyApplication.properties");
or, better yet:
MyClass.class.getResourceAsStream("properties/MyApplication.properties")
;
This method uses the classloader to find the resource relative to the
location of the class that's trying to locate the resource.
--
Kevin Dean [TeamB]
Dolphin Data Development Ltd.
http://www.datadevelopment.com/
NEW WHITEPAPERS
Team Development with JBuilder and Borland Enterprise Server
Securing Borland Enterprise Server
http://www.datadevelopment.com/papers/index.html
Please see Borland's newsgroup guidelines at
http://info.borland.com/newsgroups/guide.html
|
|
| Back to top |
|
 |
Anton Guest
|
Posted: Wed Jun 22, 2005 10:06 am Post subject: Re: Passing data into a jar file???? |
|
|
Hi.
Sorry to say I dont understand how to do it.
In my case I dont use package, just the class itself..
Thanks
"Kevin Dean [TeamB]" <NkOdSePaAnM (AT) datadevelopment (DOT) com> escribió en el
mensaje news:xn0e3r9c73dmx7001-kdean (AT) www (DOT) teamb.com...
| Quote: | Anton wrote:
Hi.
Anybody can help me??
I have an applet which needs some files to works. What I do is pack
it into a jar file. The problem is I don't know how to retrieve the
data contained in this file.
And in the file "myextrafiles" I have several files like
"i18n_en_EN". How can I open this file to extract its data????? and
pass it to a variable Properties. How can I know where is located???
If you have a class:
com.mydomain.MyClass
and you put the properties file in the source directory:
com/mydomain/properties/MyApplication.properties
you can access it using:
MyClass.class.getResource("properties/MyApplication.properties");
or, better yet:
MyClass.class.getResourceAsStream("properties/MyApplication.properties")
;
This method uses the classloader to find the resource relative to the
location of the class that's trying to locate the resource.
--
Kevin Dean [TeamB]
Dolphin Data Development Ltd.
http://www.datadevelopment.com/
NEW WHITEPAPERS
Team Development with JBuilder and Borland Enterprise Server
Securing Borland Enterprise Server
http://www.datadevelopment.com/papers/index.html
Please see Borland's newsgroup guidelines at
http://info.borland.com/newsgroups/guide.html
|
|
|
| Back to top |
|
 |
Kevin Dean [TeamB] Guest
|
Posted: Wed Jun 22, 2005 12:23 pm Post subject: Re: Passing data into a jar file???? |
|
|
Anton wrote:
| Quote: | Sorry to say I dont understand how to do it.
In my case I dont use package, just the class itself..
|
If you're not using packages at all, then it becomes:
MyClass.class.getResource("MyApplication.properties");
However, you should really look into putting your classes in packages
to separate the logic in your application.
--
Kevin Dean [TeamB]
Dolphin Data Development Ltd.
http://www.datadevelopment.com/
NEW WHITEPAPERS
Team Development with JBuilder and Borland Enterprise Server
Securing Borland Enterprise Server
http://www.datadevelopment.com/papers/index.html
Please see Borland's newsgroup guidelines at
http://info.borland.com/newsgroups/guide.html
|
|
| Back to top |
|
 |
Anton Guest
|
Posted: Fri Jun 24, 2005 10:21 am Post subject: Re: Passing data into a jar file???? |
|
|
thanks
"Kevin Dean [TeamB]" <NkOdSePaAnM (AT) datadevelopment (DOT) com> escribió en el
mensaje news:xn0e3snvz3i8ze000-kdean (AT) www (DOT) teamb.com...
| Quote: | Anton wrote:
Sorry to say I dont understand how to do it.
In my case I dont use package, just the class itself..
If you're not using packages at all, then it becomes:
MyClass.class.getResource("MyApplication.properties");
However, you should really look into putting your classes in packages
to separate the logic in your application.
--
Kevin Dean [TeamB]
Dolphin Data Development Ltd.
http://www.datadevelopment.com/
NEW WHITEPAPERS
Team Development with JBuilder and Borland Enterprise Server
Securing Borland Enterprise Server
http://www.datadevelopment.com/papers/index.html
Please see Borland's newsgroup guidelines at
http://info.borland.com/newsgroups/guide.html
|
|
|
| Back to top |
|
 |
|
|
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
|
|