![]() |
Hello and Welcome from United States to the UNIX and Linux Forums! Thank You for Visiting and Joining Our Global Community.
|
|
google unix.com
|
|||||||
| Forums | Register | Forum Rules | Links | Albums | FAQ | Members List | Calendar | 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 !! |
More UNIX and Linux Forum Topics You Might Find Helpful
|
||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| UNIX newbie NEWBIE question! | Hanamachi | UNIX for Dummies Questions & Answers | 4 | 03-28-2009 04:10 PM |
| 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 08:12 AM |
| Newbie Question: passing a variable into java from script? | Cailet | Shell Programming and Scripting | 1 | 10-18-2007 09:31 PM |
| Newbie to Unix | Mafia | UNIX for Dummies Questions & Answers | 8 | 10-15-2002 04:42 PM |
| unix newbie | gavinlow1980 | UNIX for Dummies Questions & Answers | 1 | 12-20-2001 09:18 PM |
![]() |
|
|
LinkBack | Thread Tools | Search this Thread | Rate Thread | 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? |
|
||||
|
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 |
![]() |
| Bookmarks |
| Thread Tools | Search this Thread |
| Display Modes | Rate This Thread |
|
|