Compiling and running java on Unix (from Windows)

Ok, this works on windows. Java application is up and running

javac -classpath .;ojdbc14.jar -g foo.java java -classpath .;ojdbc14.jar foo 

However, when I do the same on Unix, I get this error: ojdbc14.jar: not found

What am I doing wrong? I know ";" tells my shell that ojdbc14.jar is a new command, but I'm not sure how to fix it.

+4
source share
4 answers

Use a colon (":") instead of a semicolon (";").

See Setting the class path (Solaris and Linux) vs Setting the class path (Windows)

+12
source

The final decision was:

 javac -classpath .:ojdbc14.jar -g foo.java java -classpath .:ojdbc14.jar foo 

Note. Use '.; ojdbc14.jar 'deleted the initial error message I received, but the result was the following errro:

 Exception in thread "main" java.lang.NoClassDefFoundError: foo 
+2
source
 javac -classpath '.;ojdbc14.jar' -g foo.java java -classpath '.;ojdbc14.jar' foo 
0
source

Use ant, or even better, use ant with a continuous build environment such as Hudson and SCM, such as SVN.

0
source

All Articles