Classpath exported OK,java Class.class invokes error
executed ok:
export CLASSPATH=/home/sergio/workspace/teal
Anon.class
resides in teal
directory
both java Anon
or ja开发者_运维技巧va -cp /home/sergio/workspace/teal Anon
invoke classical:
Exception in thread "main" java.lang.NoClassDefFoundError: Anon
Have I missed something in CLASSPATH declaration?
If the package of your class is teal
, you should be exporting the classpath "till" the package directory, not into it.
export CLASSPATH=/home/sergio/workspace/
To make it more generic, if the package of a class Bar
is com.foo
and the directory structure looks like,
[+] classes/
[+] com/
[+] foo/
[-] Bar.class
You should set classpath till classes
only.
You need to have "." in your classpath.
For Unix this is done with
export CLASSPATH=/home/sergio/workspace/teal:.
精彩评论