Wednesday, April 05, 2006

Getting Java to Compile

Well, with a new Linux installation comes a new set of problems. I was initially unable to compile any Java programs short of a single file containing a single "main" function (no object definitions). I kept receiving the error message below:

javac ./Javimapper.java
java ./Javimapper
Exception in thread "main" java.lang.NoClassDefFoundError: ./Javimapper

I eventually fixed the problem by referring to the following website:

http://www.cs.princeton.edu/introcs/11hello/linux.html

Upon reading the webpage above, I simply typed in the following and I was able to compile and run the program just fine:
java -classpath ./ Javimapper



No comments: