Help coderanch get a
new server
by contributing to the fundraiser
  • 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
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

setting classpath

 
Ranch Hand
Posts: 71
Eclipse IDE Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
 
lowercase baba
Posts: 13091
67
Chrome Java Linux
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
Posts: 13091
67
Chrome Java Linux
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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.
 
Ranch Hand
Posts: 115
Eclipse IDE Tomcat Server Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
 
Rancher
Posts: 1776
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
thank you, class-path entry in menifest file resolve my problem. thanks a lot.
 
The fastest and most reliable components of any system are those that are not there. Tiny ad:
We need your help - Coderanch server fundraiser
https://coderanch.com/t/782867/Coderanch-server-fundraiser
reply
    Bookmark Topic Watch Topic
  • New Topic