Skip to main content



      Home
Home » Language IDEs » Java Development Tools (JDT) » ResourceBundle problem: Cannot find properties file
ResourceBundle problem: Cannot find properties file [message #43103] Thu, 29 May 2003 11:44 Go to next message
Eclipse UserFriend
Originally posted by: mobiko.lycos.com

Hi,

I have written a code snippet to retrieve internationalisation params from
a resource bundle properties file. I have created this resource bundle
file and store it in my project root directory c:\xxx. I can run my
program with no problem from a standalone run.bat @ the shell prompt. My
program is able to locate the resource properties file.

But when I tried running my program via the Eclipse IDE, from the RUN
menu, I encounter problems. The error is printed as follows.

<i>
#Exception: java.util.MissingResourceException: Can't find bundle for base
name MessagesBundle, locale en_US
java.lang.NullPointerException
at com.mutant.messenger.util.Resource.getI18NString(Resource.ja va:45)
at com.mutant.messenger.MessengerApp.open(MessengerApp.java:97)
at com.mutant.messenger.MessengerApp.main(MessengerApp.java:57)
Exception in thread "main"
</i>

Eclipse cannot locate this resource bundle file, if I run my program from
the IDE, via the RUN menu. I have also tried changing the classpath
setting in RUN to point to c:\xxx but to no avail.

Running from my shell is not a problem. Can someone point me what is
wrong?

Many Thanks
Mobiko
Re: ResourceBundle problem: Cannot find properties file [message #43173 is a reply to message #43103] Thu, 29 May 2003 12:26 Go to previous messageGo to next message
Eclipse UserFriend
Originally posted by: mobiko.lycos.com

Silly me, I got my problem fixed. I just need to put the resource bundle
properties files in the directory setting I specify in the \"Default
Output Folder\" in my Project settings.

Regards,
Mobiko

mobiko wrote:

> Hi,

> I have written a code snippet to retrieve internationalisation params from
> a resource bundle properties file. I have created this resource bundle
> file and store it in my project root directory c:\\xxx. I can run my
> program with no problem from a standalone run.bat @ the shell prompt. My
> program is able to locate the resource properties file.
Re: ResourceBundle problem: Cannot find properties file [message #43525 is a reply to message #43173] Thu, 29 May 2003 15:07 Go to previous messageGo to next message
Eclipse UserFriend
Originally posted by: richkulp.NOSPAM.us.ibm.com

No, don't do that! That folder can be wiped at any time. It is a folder
owned by the compiler to put its output. And at times it decides to
scrub this entire directory.

Instead, either put your properties file under the source directory
containing your code, or if you want to keep them separate:

1) Create a folder under your project
2) Copy the resources into that new folder
3) Open the properties on the project, goto Java Build Path and
select on the "Libraries" page the "Add Class Folder" button,
and then select your new folder.
Re: ResourceBundle problem: Cannot find properties file [message #44447 is a reply to message #43525] Fri, 30 May 2003 09:04 Go to previous messageGo to next message
Eclipse UserFriend
Originally posted by: mobiko.lycos.com

Hi Richard,

I follow your instructions, created a sub-dir called "config" under my
project root, store the properties files there, then set up the class
folder to point to this new "config" dir via the Project Properties' "Add
Class Folder", but it returns the same error I encountered earlier.

What did I miss?

Richard L. Kulp wrote:

> No, don't do that! That folder can be wiped at any time. It is a folder
> owned by the compiler to put its output. And at times it decides to
> scrub this entire directory.

> Instead, either put your properties file under the source directory
> containing your code, or if you want to keep them separate:

> 1) Create a folder under your project
> 2) Copy the resources into that new folder
> 3) Open the properties on the project, goto Java Build Path and
> select on the "Libraries" page the "Add Class Folder" button,
> and then select your new folder.
Re: ResourceBundle problem: Cannot find properties file [Directory wiped out] [message #44665 is a reply to message #43525] Fri, 30 May 2003 10:05 Go to previous messageGo to next message
Eclipse UserFriend
Originally posted by: mobiko.lycos.com

Richard L. Kulp wrote:

> No, don\'t do that! That folder can be wiped at any time. It is a folder
> owned by the compiler to put its output. And at times it decides to
> scrub this entire directory.

Richard,

Your advice comes too late. Alas, the IDE now wipes out my entire sub
directory of images in my defailt output folder.

Is this an IDE bug? Can it be remedied? How do I recover my files?

Thanks
mobiko
Re: ResourceBundle problem: Cannot find properties file [Directory wiped out] [message #44694 is a reply to message #44665] Fri, 30 May 2003 10:20 Go to previous messageGo to next message
Eclipse UserFriend
Originally posted by: richkulp.NOSPAM.us.ibm.com

It is not a bug. As I said, it is the output directory. It is where the
compiler puts ITS output. So it owns it. There is an option to turn this
off but I don't recommend it. If you do that, it could possibly leave
some files around that should of gone away. It allows the compiler to
say, "Let's start from scratch with nothing left around from before
causing problems and recompile the java files into the output area to
get a clean compile."

How are you accessing the files in your program? That determines the
location you put the files in Eclipse.

Rich
Re: ResourceBundle problem: Cannot find properties file [Directorywiped out] [message #44881 is a reply to message #44694] Fri, 30 May 2003 11:42 Go to previous messageGo to next message
Eclipse UserFriend
Originally posted by: mobiko.lycos.com

Richard L. Kulp wrote:

> It is not a bug. As I said, it is the output directory. It is where the
> compiler puts ITS output. So it owns it. There is an option to turn this
> off but I don't recommend it. If you do that, it could possibly leave
> some files around that should of gone away. It allows the compiler to
> say, "Let's start from scratch with nothing left around from before
> causing problems and recompile the java files into the output area to
> get a clean compile."

> How are you accessing the files in your program? That determines the
> location you put the files in Eclipse.

> Rich

Hi Richard,

This is my directory structure

c:\mutant
- docs
- src
- bin
-> image
-> com
->> mutant
->>> messenger

blah blah... (-> indicates subdirectory within bin, so in bin, i have
"images" sub-folder, and bin is set as my default output folder)

So what is your advice?

Does that mean that I have no way to recover the lost image folder?

Thanks very much,
mobiko
Re: ResourceBundle problem: Cannot find properties file [Directorywiped out] [message #45128 is a reply to message #44881] Fri, 30 May 2003 14:12 Go to previous messageGo to next message
Eclipse UserFriend
Originally posted by: richkulp.NOSPAM.us.ibm.com

mobiko wrote:
> Richard L. Kulp wrote:
>
>
>>It is not a bug. As I said, it is the output directory. It is where the
>>compiler puts ITS output. So it owns it. There is an option to turn this
>>off but I don't recommend it. If you do that, it could possibly leave
>>some files around that should of gone away. It allows the compiler to
>>say, "Let's start from scratch with nothing left around from before
>>causing problems and recompile the java files into the output area to
>>get a clean compile."
>
>
>>How are you accessing the files in your program? That determines the
>>location you put the files in Eclipse.
>
>
>>Rich
>
>
> Hi Richard,
>
> This is my directory structure
>
> c:\mutant
> - docs
> - src
> - bin
> -> image
> -> com
> ->> mutant
> ->>> messenger
>
> blah blah... (-> indicates subdirectory within bin, so in bin, i have
> "images" sub-folder, and bin is set as my default output folder)
>
> So what is your advice?
>
> Does that mean that I have no way to recover the lost image folder?
>
> Thanks very much,
> mobiko
>
>

Try the following, from the bin directory popup the menu and select
"Restore from Local History". It may still be in there. Restore it and
immediately move it out of the bin directory. You may want to turn
"Build on Resource Modification" off first so that it doesn't accidently
wipe it away before you can move it out. Then turn that back on again.

Also, I meant when creating the source folder that the folder is in your
project BUT NOT under the bin directory. You create the folder structure
somewhere else in your project. Everything under the bin directory on
down to subdirectories can be wiped at any time.

--
Thanks, Rich Kulp

Re: ResourceBundle problem: Cannot find properties file [Directorywipedout] [message #46775 is a reply to message #45128] Mon, 02 June 2003 13:06 Go to previous messageGo to next message
Eclipse UserFriend
Originally posted by: mobiko.lycos.com

Hi Richard,

Thanks for your advice. I have managed to got it sorted out. The trip is
to define a Class variable that reference my Project folder e.g. c:\xxx
and add this new classpath in the CLASSPATH setting of my run
configuration. Next I store my resource bundle properties files in c:\xxx.
Then I execute run via the Eclipse IDE. Now my application is able to
locate my resource bundles properties, no problem.

Thanks very much. I am now more familier with Eclipse IDE.

cheers,
mobiko
Re: ResourceBundle problem: Cannot find properties file [Directorywipedout] [message #46805 is a reply to message #46775] Mon, 02 June 2003 14:00 Go to previous messageGo to next message
Eclipse UserFriend
Originally posted by: richkulp.NOSPAM.us.ibm.com

What you did only makes sense if the resources are OUTSIDE of Eclipse.
That is how you point to things that are not under control of Eclipse.
If they are in the Eclipse project itself what you did doesn't seem like
the best way.
Re: ResourceBundle problem: Cannot find properties file [Directorywipedout] [message #47338 is a reply to message #46805] Tue, 03 June 2003 09:39 Go to previous message
Eclipse UserFriend
Originally posted by: mobiko.lycos.com

Richard L. Kulp wrote:

> What you did only makes sense if the resources are OUTSIDE of Eclipse.
> That is how you point to things that are not under control of Eclipse.
> If they are in the Eclipse project itself what you did doesn't seem like
> the best way.

Yes, my resources are outside of Eclipse.

Thanks,
mobiko
Previous Topic:Overriding preferences in Eclipse.
Next Topic:Newbie question
Goto Forum:
  


Current Time: Sun Jul 13 13:33:56 EDT 2025

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

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

Back to the top