Win a copy of The Java Performance Companion this week in the Performance forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

setting classpath

 
Sudhakar Sharma
Ranch Hand
Posts: 71
Eclipse IDE Java
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hello Everyone,

I have resource-bundle in my server and a runnable jar file using this resource-bundle, I want to set the path for it. how to do this? please help.

thanks & regards
 
fred rosenberger
lowercase baba
Bartender
Posts: 12149
31
Chrome Java Linux
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Your subject says 'classpath', but your post says 'path'. These are two VERY different things.

the process to set either is the same, but you should be sure of which you need first.

My final comment is "How to set it depends on what operating system you are using".
 
Sudhakar Sharma
Ranch Hand
Posts: 71
Eclipse IDE Java
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator

Thanks for reminding me, I actually want to set path on linux operating system, the resource-bundle is outside of my jar, how to do that.

thanks & regards
 
fred rosenberger
lowercase baba
Bartender
Posts: 12149
31
Chrome Java Linux
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
well it would depend on what shell you are using. a quick google search shows this:

For bash shell:
export PATH=$PATH:/usr/sbin/:/usr/local/bin
For tcsh or csh:
set PATH = ($PATH /usr/sbin /usr/local/bin)


That will let you set it in your current session. that basically says "set the PATH variable to what it currently is plus these two new directories."

if you want a more permanent change to it, you will probably have to edit your profile. in the tsch, it should be in your home directory, and is called '.cshrc'. There should be something similar for bash and other shells.
 
Singh Harmeet
Ranch Hand
Posts: 115
Eclipse IDE Java Tomcat Server
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
if you want to set the class path, then this is the band programming , if you want to use the jar packages , you just specified at command with with the help of -cp switch. if you want to the the path only then foloow the above answer.
 
Sudhakar Sharma
Ranch Hand
Posts: 71
Eclipse IDE Java
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Thanks,

But it is not working, I have a Resource.Cofig.properties file and a jar file. In jar file classes are using this resource file using ResourceBundle.getBundle("Resource.Cofig"), Now this properties file is not inside jar file, it is on the server at location /usr/emtize/ with its package structure. I want to run this jar (Runnable jar). How to do this.

I donot want to chage code.

Thanks & Regards
 
John Jai
Rancher
Posts: 1776
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
when you use java -jar MyApp.jar, the jar's own classpath settings defined by its manifest file will override anything on the command line that is defined by the cp option. The cp option is worthless for setting a classpath in this situation.

Source - Discovering Resourcebundles
 
Sudhakar Sharma
Ranch Hand
Posts: 71
Eclipse IDE Java
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
thank you, class-path entry in menifest file resolve my problem. thanks a lot.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic