Himalay Majumdar wrote:Thanks Balu.. Yeah.I messed up myself with the syntax here.
While working with javac -classpath..the package name is appended in the search class path.
I want to check if the same happens when we use java -classpath.....
C:\Documents and Settings\himalay\Desktop\foo>java -classpath Testing test\xcom\Test
// Am expecting Testing.class will be searched after appending its path and Test.class will be executed as I have provided the complete path.
but...
Exception in thread "main" java.lang.NoClassDefFoundError: test\xcom\Test
if you provide -classpath in your java ot javac , you are overriding the default classpath. At any case
you should execute javac or java at top level of the package.
When using java , the classname should be provided with complete package name and not by directory name
java -classpath . test.xcom.Test // see use of package name as "." and not "/"
Testing class need not be included in -classpath as already "." covers the current directory. Any class from different package needs to be provided if Test ot Testing class refers it.
HTH
(i have edited the previous post)