My program compiles fine, but when I attempt to launch a java program on Linux using the "java" command, I get a NoClassDefFoundError for a class that is definitely in the classpath and another error that says it could not find the main class. I have ruled out most of the basic problems for this error.
My program is just 40 lines of code and sends a basic email. It links to one jar - the mail.jar available from Oracle/Sun. The command I'm using is :
java MailTest -classpath ./mail.jar
I have unset the $CLASSPATH variable to prevent conflicts. $JAVA_HOME is correctly set and I have tried running the java executable with the full java path with the same result. The directory is readable and writable by the user I'm logged in as. The case in the command matches the case of the MailTest.class file.
The program was compiled with 'javac MailTest.java -classpath ./mail.jar' and successfully generated a MailTest.class file. The NoClassDefFoundError I'm getting is for the javax/mail/Address class which is definitely in the mail.jar file which is explicitly listed in my classpath.
I'm completely stumped. Suggestions?