ResourceBundle problem: Cannot find properties file [message #43103] |
Thu, 29 May 2003 11:44  |
Eclipse User |
|
|
|
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 #44447 is a reply to message #43525] |
Fri, 30 May 2003 09:04   |
Eclipse User |
|
|
|
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 [Directorywiped out] [message #45128 is a reply to message #44881] |
Fri, 30 May 2003 14:12   |
Eclipse User |
|
|
|
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
|
|
|
|
|
|
Powered by
FUDForum. Page generated in 0.10422 seconds