Win a copy of Clojure in Action this week in the Clojure forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

classpath file pick order

 
sridhar vedhanabatla
Greenhorn
Posts: 12
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi,


I have a classpath issue. My app folder is C:/agent I have src packages that start with com.abc and also few config files under my app folder. I have archived them as agent.jar so that compiled classes in com.abc package and files under config folder are archived into agent.jar.

Therefore the folder structure is something like following:-

C:\agent
|
| -> src -> com -> abc -> A.java
|
| -> config -> resources.properties


my jvm parameters are like

java -Xms800m -Xmx800m -XX:MaxPermSize=256m -XX:+UseParNewGC -classpath C:\agent2\config\res2.properties agent.jar



I want the jvm to pick res2.properties from C:\agent2\config folder instead of the one present in agent.jar file.

Currently jvm is still picking and using resources.properties from C:\agent\config\ only and not from C:\agent2\config folder.

I guess jvm should pick the first file that comes in the classpath and that should override the subsequent files of same name.




Is there anything wrong in above setup? If yes, then where and why?


Advance thanks,
 
salvin francis
Bartender
Pie
Posts: 1227
10
Eclipse IDE Google Web Toolkit Java
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
1. Class path should contain path, not file.
2. How does you code know it has to refer to "res2.properties" and not "resources.properties" ?

If the code is indeed referring to res2.properties, a FileNotFoundException would have occured.
 
sridhar vedhanabatla
Greenhorn
Posts: 12
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Thanks SF for your reply.


I understand that classpath spec needs to have file-path and not file. It was my mistake to write it that way in forum post.


Actually the second file too is "resources.properties". I mistakenly gave the different name. Infact I want to use a new value from new file instead of old value from config file in the agent.jar file. Thats the reason the filenames in the C:\agent\config folder and C:\agent2\config is same.


Sorry for the confusion.

Thanks,
 
salvin francis
Bartender
Pie
Posts: 1227
10
Eclipse IDE Google Web Toolkit Java
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Its ok

We learn only when we make mistakes.

in reply to your new explaination.....

1. Please change the Original message (so that others may able to answer your question too)
2. If the file resources.properties is indeed being supposed to be read from two places, why did you pack it into agent.jar ??
if you do not do so (i havent tried), i guess it would work fine, try it and let me know

 
I agree. Here's the link: http://aspose.com/file-tools
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic