This week's book giveaway is in the Agile and other Processes forum. We're giving away four copies of The Mikado Method and have Ola Ellnestam and Daniel Brolund on-line! See this thread for details.
Do I need to add CLASSPATH/PATH to run java codes in a script ?
Steve Yu
Ranch Hand
Joined: Mar 26, 2003
Posts: 60
posted
0
I need to write a UNix script to run a java code written by a third party team. For example, I want to do "java MyApplication ..." in the script. Now my questions are -- 1. do I need add "PATH" and/or CLASSPATH in the script and then export the PATH/CLASSPATH before I call "java MyApplication ..." ? 2. The "MyApplication" code uses some special API developed by the third party team and they have a special .jar file for that. So, do I need to add that in the CLASSPATH in my script ?
Joel McNary
Bartender
Joined: Aug 20, 2001
Posts: 1815
posted
0
generally speaking, if java is properly installed on the system, then you do not need to add that to the path. If you are trying to run a third party .jar file, yes, you do have to specify the CLASSPATH. If you don't want to mess with the system classpath, you can add the -classpath switch to the call to java e.g., java -classpath <your classpath here> YourApplication. Just remember that the -classpath switch overrides the system CLASSPATH; it is not in addition to it.
Piscis Babelis est parvus, flavus, et hiridicus, et est probabiliter insolitissima raritas in toto mundo.
I agree. Here's the link: http://ej-technologies/jprofiler - if it wasn't for jprofiler, we would need to
run our stuff on 16 servers instead of 3.
subject: Do I need to add CLASSPATH/PATH to run java codes in a script ?