July 8, 2009
The same image can be seen in detail at:
Wednesday, May 27, 2009
Source (logging in necessary): http://www.daniweb.com/forums/thread193778.html
"Thanks a lot to all!
@sos and @adatapost
Sorry for not being able to heed to your(sos) first comment. The concept of package is yet unclear to me. As you advised I tried to create a new folder
I removed the package code line and save the rest of the code as it was in the previous example after changing the class name to j2.
Then I used the following commands:
javac j2.java -d . //as recommended by adatapost
java -classpath . j2
After that the output was
Hello World!
This was my first step in learning Java. I will try to study Java further and the concept of package. Will post a new problem if I have any with regards to package.
Thank You once again.
Regards,
-sgsawant"
Monday, May 25, 2009
Today (actually Yesterday considering it is 0236hrs in the morning) I started with Java programming. Downloaded the ebooks Complete Reference Java by Herbert Schildt and Java for dummies from esnips.com
Also downloaded the bundle of JDK and Netbeans from Sun's official site.
After fiddling with netbeans for some time I ventured into the command prompt method of operating Java. After a lot of headache and changing variables in Control Panel>System>Advanced>System Variable I was able to correctly execute "javac HelloWorldApp.java" command, which worked fine.
But I could not execute "java HelloWorldApp" command which kept on returning the error:
Exception in thread "main" java.lang.noclassdef
..
..
So to see whether this was a universal problem I tried downloading the CMUcamGUI files which were bundled with the CMUCAM I used for my robot Ouimet.
Even that thing did not execute for a while when I tried "java CMUcamGUI" (the class file was already there; so no need of javac command).
Finally I tried the command "java -classpath . CMUcamGUI" which asks the compiler to look for the class file in the current directory. That solved the problem for CMUcamGUI but the problem for HelloWorldApp still persists.
Moral of the story: Remember the following command (though it has not entirely solved the above problem)
java -classpath . CMUcamGUI