I have problem running this programpackage p1;class test{public static void main(String args[]){System.out.println("Hello world");}}I have placed the files (.java and .class) in the p1 directory. I have triedall the possible combinations of classpath and still it gives meclassnotfound exception
what error does it give u?Set the class path to the package level.
there is not any problem your codes.
you can download oracle9i jdeveloper from oracle.com then try your code on it.itis very simple.also oracle9i jdeveloper is free
Are u sure, that u are running your program from the requiered place. Yourpackage directory must be in your classpath or another choice shell scripts.set classpath=%classpath%;%cd%java p1.myclass4 ex: u can use the script above, from the upper directory of p1. This willincluderuntime path to your classpath(4 win platform) with "%cd%" option.
run it in pi directory only,it will surely runlook i will tell u dos promt commandc:\mkdir pic:\cd pic:\edit test.javaedit window---ur code------save itexit to command promtc:\pi\javac test.javait will run
change the declaration form 'class test' to 'public class test'and try to recompile and execute.
The current directory should be in p1's parent directory. Forexample (assuming Windows), if the path is c:\xxx\p1, then you shouldbe in xxx. Then to compile, do:javac -classpath . p1\test.javaTo run, do:java -classpath . p1.test