So, I can do this very well:
java mypackage.MyClass
if ./mypackage/MyClass.class
exists. I can also happily do this:
Possibly :)
# On Unix
java -cp utilities.jar:. mypackage.MyClass
# On Windows
java -cp utilities.jar;. mypackage.MyClass
Basically that's just including .
(the current directory) on the classpath as well as the jar file.
You should include the mypackage.MyClass into the CLASSPATH or the -cp parameter. For example:
java -cp utilities.jar;myjar.jar mypackage.MyClass
The path separator is ; on windows and : on Unix/Linux
Try this if you're on Windows:
java -cp .;utilities.jar mypackage.MyClass
Or this if you're on Linux:
java -cp .:utilities.jar mypackage.MyClass
The current directory is not in the CLASSPATH by default when you specify a value for -cp
.