![]() |
|
|
|
|
|||||||
| Forums | Portal | Register | Forum Rules | FAQ | Contribute | Members List | Arcade | Search | Today's Posts | Mark Forums Read |
| UNIX for Dummies Questions & Answers If you're not sure where to post a UNIX or Linux question, post it here. All UNIX and Linux newbies welcome !! |
|
|
||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| Can we call JSP file from Unix.if so how.Please help me.Im newbie to Unix | mailsukumar | Shell Programming and Scripting | 0 | 05-26-2008 05:12 AM |
| Newbie Question: passing a variable into java from script? | Cailet | Shell Programming and Scripting | 1 | 10-18-2007 06:31 PM |
| UNIX newbie NEWBIE question! | Hanamachi | UNIX for Dummies Questions & Answers | 3 | 09-14-2006 07:23 AM |
| Newbie to Unix | Mafia | UNIX for Dummies Questions & Answers | 8 | 10-15-2002 01:42 PM |
| unix newbie | gavinlow1980 | UNIX for Dummies Questions & Answers | 1 | 12-20-2001 05:18 PM |
|
|
Submit Tools | LinkBack | Thread Tools | Display Modes |
|
|||
|
I need to run .java from a directory.
i.e. c:\aaa\bbb\ccc.java first I compile all the java using javac *.java under the c:\aaa\bbb directory, now I want to run this command under cd .. , Here is the command that I need to type.. java -classpath /home/share/postgresql/java/postgresql.jar:. ccc What do I need before ccc in order run ccc.java under the parent directory? |
| Forum Sponsor | ||
|
|
|
|||
|
Quote:
java -classpath /home/share/postgresql/java/postgresql.jar:. ccc |
|
|||
|
You need to set you enviroment to reflect these:
setenv CLASSPATH /home/share/postgresql/java or set CLASSPATH=/home/share/postgresql/java; export CLASSPATH Ensure that you JAVA_HOME is also define so you could execute any java programs from anywhere. You may want to add them to your .bashrc or you .cshrc or what ever shell you are using. |
|
|||
|
Usually I just set the classpath as an option to the java or javac command, instead of setting the CLASSPATH environment variable because it is likely that running/compiling one Java program needs a classpath different from another. Setting this environment variable overrides the default classpath up until the current session terminates. Sometimes you may not realize this environment variable is set, but somehow it has been defined somewhere, and you may get lots of classpath errors despite there should not be if it is not set (I have seen articles telling people to set the CLASSPATH in shell startup scripts, like .profile and the like).
A better way to manage all these is to write an Ant build file, similar to the concept of Makefiles, which has directives to override the list of classpaths. You can write a build file with two targets, one to compile it and another to run it. Then you can avoid a lot of troubles thereafter for writing really loooooong command-line arguments, as Ant knows how to compose the exact commands for you. It is particularly handy for projects that need to override the build paths. More info? http://ant.apache.org |
|||
| Google The UNIX and Linux Forums |