Results 1 to 4 of 4
- 03-11-2009, 09:55 AM #1
Member
- Join Date
- May 2008
- Posts
- 31
- Rep Power
- 0
loading .properties file dynamically
Hi
I am using swingapplication framework for the desktop programme. To get the properties we should use resourceMap = org.jdesktop.application.Application.getInstance() .getContext().getResourceMap(com.aob.test.class);
But the jar classes i am loading dynamically using ClassLoader.
Can run the class instance, cannot load the property file.
How to load the property file along with class file.
If i keep jar file under classpath, it is working fine.
- 03-16-2009, 02:22 PM #2
You're right, keep the JAR in the classpath. That's how the ClassLoader finds the .properties file.
- 03-17-2009, 02:04 AM #3
Member
- Join Date
- May 2008
- Posts
- 31
- Rep Power
- 0
Thanks for reply. But i don't want to keep the jar under classpath. Bcz i m planning to load the jar classes using dynamic classLoader.
I will appreciate if you have any idea .
Thanks
Nanaji
- 03-17-2009, 03:40 AM #4
ClassLoader only works with the classpath. I don't know how to do this, but it is possible to alter the classpath inside the JVM and to then create a new ClassLoader instance. That is how Web application servers like Tomcat can reload classes for a particular application without affecting the rest of the server.
In your case, you want to identify a JAR file, modify the classpath so that JAR is on the classpath, and then create a new ClassLoader, using that ClassLoader instance to load the properties and anything else in the JAR. Again, I don't know how to do that. I suggest reading the API carefully and googling.
Similar Threads
-
Not able to load a properties file
By Happy9959 in forum New To JavaReplies: 12Last Post: 07-29-2008, 07:15 AM -
Dynamically loading the jsp page to the application
By shekar in forum JavaServer Pages (JSP) and JSTLReplies: 3Last Post: 04-09-2008, 03:28 PM


LinkBack URL
About LinkBacks
Reply With Quote
Bookmarks