Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Archived » DSDP - Mobile Tools for Java (MTJ) » Resouce files
Resouce files [message #19047] Tue, 01 May 2007 13:24 Go to next message
Eclipse UserFriend
Originally posted by: agrillage.yahoo.com

I am trying to load a resource file thus:

InputStream in = this.getClass().getResourceAsStream("test.xml");

I have tried putting the file in the project root and I have tried putting
it in the res folder. It never seems to get packed in the jar. My in is
always null. What do I need to do?

Andrew
Re: Resouce files [message #19290 is a reply to message #19047] Wed, 02 May 2007 13:13 Go to previous messageGo to next message
Kevin Horowitz is currently offline Kevin HorowitzFriend
Messages: 36
Registered: July 2009
Member
Files from the res directory should be copied directly into the jar file
in the deployed directory. Try deleting this directory and see if the
file is in the newly created jar.

kevin horowitz
Andrew Grillage wrote:
> I am trying to load a resource file thus:
>
> InputStream in = this.getClass().getResourceAsStream("test.xml");
>
> I have tried putting the file in the project root and I have tried putting
> it in the res folder. It never seems to get packed in the jar. My in is
> always null. What do I need to do?
>
> Andrew
>
>
Re: Resouce files [message #19331 is a reply to message #19047] Sat, 05 May 2007 18:14 Go to previous messageGo to next message
Miha Vitorovic is currently offline Miha VitorovicFriend
Messages: 6
Registered: July 2009
Junior Member
Andrew Grillage wrote:
> I have tried putting the file in the project root and I have tried putting
> it in the res folder. It never seems to get packed in the jar. My in is
> always null. What do I need to do?

When creating the jar (in the wizard) you may select which folders/files
to pack in besides the class files.

Br, Mike
Re: Resouce files [message #20017 is a reply to message #19331] Wed, 24 October 2007 08:03 Go to previous messageGo to next message
GNU KNOW WHO is currently offline GNU KNOW WHOFriend
Messages: 4
Registered: July 2009
Junior Member
But, er... I don't see that option.

On the MTJ menu, the option "Build MTJ Project" does not offer any
options... yet the documentation specifies that the resources from the res
folder will be included in the Jar.

It doesn't work (at least for version 0.70) when attempting to use it for
S80 Peronal Profile development. Indeed, the project only includes the
classes.zip file.... in the J2ME Library; I had to attach the standard S80
device libraries manually (e.g., locale.jar, etc.)

We have to be careful, even though MTJ's page identifies MTJ1 and MTJ2,
the official version is 0.70... even the numbering doesn't seem to be
consistent with other Eclipse.org projects...

Looks like it will be AT LEAST 2Q 2008 before this tool is (minimally)
dependable.
Re: Resouce files [message #20055 is a reply to message #20017] Wed, 24 October 2007 08:15 Go to previous message
GNU KNOW WHO is currently offline GNU KNOW WHOFriend
Messages: 4
Registered: July 2009
Junior Member
Aha! I just caught it... you are speaking of ignoring the MTJ/Build MTJ
Project (which doesn't seem to work) and using the standard Eclipse JAR
Export wizard... Yes, this does work... and it's nicer because one can
create the JARDESC file for repeatability...
Re: Resouce files [message #566246 is a reply to message #19047] Wed, 02 May 2007 13:13 Go to previous message
Kevin Horowitz is currently offline Kevin HorowitzFriend
Messages: 36
Registered: July 2009
Member
Files from the res directory should be copied directly into the jar file
in the deployed directory. Try deleting this directory and see if the
file is in the newly created jar.

kevin horowitz
Andrew Grillage wrote:
> I am trying to load a resource file thus:
>
> InputStream in = this.getClass().getResourceAsStream("test.xml");
>
> I have tried putting the file in the project root and I have tried putting
> it in the res folder. It never seems to get packed in the jar. My in is
> always null. What do I need to do?
>
> Andrew
>
>
Re: Resouce files [message #566267 is a reply to message #19047] Sat, 05 May 2007 18:14 Go to previous message
Miha Vitorovic is currently offline Miha VitorovicFriend
Messages: 6
Registered: July 2009
Junior Member
Andrew Grillage wrote:
> I have tried putting the file in the project root and I have tried putting
> it in the res folder. It never seems to get packed in the jar. My in is
> always null. What do I need to do?

When creating the jar (in the wizard) you may select which folders/files
to pack in besides the class files.

Br, Mike
Re: Resouce files [message #566712 is a reply to message #19331] Wed, 24 October 2007 08:03 Go to previous message
GNU KNOW WHO is currently offline GNU KNOW WHOFriend
Messages: 4
Registered: July 2009
Junior Member
But, er... I don't see that option.

On the MTJ menu, the option "Build MTJ Project" does not offer any
options... yet the documentation specifies that the resources from the res
folder will be included in the Jar.

It doesn't work (at least for version 0.70) when attempting to use it for
S80 Peronal Profile development. Indeed, the project only includes the
classes.zip file.... in the J2ME Library; I had to attach the standard S80
device libraries manually (e.g., locale.jar, etc.)

We have to be careful, even though MTJ's page identifies MTJ1 and MTJ2,
the official version is 0.70... even the numbering doesn't seem to be
consistent with other Eclipse.org projects...

Looks like it will be AT LEAST 2Q 2008 before this tool is (minimally)
dependable.
Re: Resouce files [message #566736 is a reply to message #20017] Wed, 24 October 2007 08:15 Go to previous message
GNU KNOW WHO is currently offline GNU KNOW WHOFriend
Messages: 4
Registered: July 2009
Junior Member
Aha! I just caught it... you are speaking of ignoring the MTJ/Build MTJ
Project (which doesn't seem to work) and using the standard Eclipse JAR
Export wizard... Yes, this does work... and it's nicer because one can
create the JARDESC file for repeatability...
Previous Topic:Configuring MTJ & PhoneME Advanced
Next Topic:IBM J9
Goto Forum:
  


Current Time: Tue Apr 23 06:58:17 GMT 2024

Powered by FUDForum. Page generated in 0.03992 seconds
.:: Contact :: Home ::.

Powered by: FUDforum 3.0.2.
Copyright ©2001-2010 FUDforum Bulletin Board Software

Back to the top