shell - run a java program -


I want to run a Java program via shell script. The Java program is in p2 directory and its name is maxconnect4 and I have already compiled it, the name of the class is maxconnect4. I write a shell command like this:

Java p2 / maxconnect4 arg1 arg2 arg3

This shell command does not work. It returns an error: Exception in thread "main" java.lang.NoClassDefFoundError: p2 / maxconnect

, however, I compile Java program like this:

javac p2 / * Java, and it works.

just use java -cp p2 maxconnect4 arg1 arg2 arg3 . -CP sets the Javascript classpath edit: I think you do not use the package for maximum connection 4.


Comments