• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Tim Cooke
  • Liutauras Vilda
  • Jeanne Boyarsky
  • paul wheaton
Sheriffs:
  • Ron McLeod
  • Devaka Cooray
  • Henry Wong
Saloon Keepers:
  • Tim Holloway
  • Stephan van Hulst
  • Carey Brown
  • Tim Moores
  • Mikalai Zaikin
Bartenders:
  • Frits Walraven

messages.properties file location

 
Ranch Hand
Posts: 137
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi,

I put this file under a package mypackage in the source directory and in my jsp
I have:

<f:loadBundle basename="mypackage.messages" var="msg" />

But I am getting an error that says resource bundle cannot be found on classpath.
What is the problem here?

Thanks,

Sonia
 
Ranch Hand
Posts: 82
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Where is your mypackage located? always give the full path like mypackage/messages.properties. Its a '/' which separates the path hierarchy and not a '.'

Regards,
Teena
 
Saloon Keeper
Posts: 28319
210
Android Eclipse IDE Tomcat Server Redhat Java Linux
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
The message is correct, although the idea might seem surprising. Properties files and bundles are intended to be placed in the same directories as your java classes, which means that they can be found on the app's classpath. Treat them exactly like you would treat your classes, which means refer to them using fully qualified "classnames".

For examples, let's say I have an "appResources.properties" file and I want to put it in "WEB-INF/classes/com/mousetech/myapp/resources", since WEB-INF/classes is a fundamental part of any WAR's classpath. The fully qualified resource name would then be "com.mousetech.myapp.resources.appResources.properties".
 
Teena George
Ranch Hand
Posts: 82
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

Thanks Tim. You are right. I never created a resources file in the source packages. I copied all my properties files under a folder in WebContent and accessed it using the '/'. Yes, we can access it using the fully qualified name of the resource file, when the resource files are under one of the source packages, or even under WebContent. Thanks once again, it was a new piece of information.

Regards,
Teena
 
sonia pandit
Ranch Hand
Posts: 137
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
So if I understood you correctly, build/classes is also on the classpath. So I tried copying my messages.properties to this directory and to the mypackage directory underneath build/classes and
eclipse still complains that it cant find it?

Thanks,

Sonia
 
Tim Holloway
Saloon Keeper
Posts: 28319
210
Android Eclipse IDE Tomcat Server Redhat Java Linux
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Eclipse is not a web application server. You can install a web application service debugging and control interface into Eclipse, but Eclipse itself doesn't participate. Therefore the build classpath isn't sufficient.

A J2EE web application server needs a WAR, either as a WAR file or the unzipped (exploded) equivalent. The classpath for that WAR is the WEB-INF/classes and the jars in the WEB-INF/lib directory of that WAR. Additional system classpath elements come from the web application server and not from Eclipse.
 
Friends help you move. Good friends help you move bodies. This tiny ad will help:
Gift giving made easy with the permaculture playing cards
https://coderanch.com/t/777758/Gift-giving-easy-permaculture-playing
reply
    Bookmark Topic Watch Topic
  • New Topic