I have a task running on my WS2003 machine as inforadmin.PASCOUTIL via the task scheduler ( "C:\Program Files\Java\jdk1.6.0_13\jre\bin\java.exe" -jar "C:\CMMS_SCADA.jar" ). When I'm logged on as this user, I can run the jar file by double-clicking on it, but the task scheduler throws the NoClassDefFoundError pointing to javax.mail. I assume this as a javamail JAR file placement issue? I've attached a .gif showing the screenshot of this JAR file on the local computer, so if anyone would like to look and comment, I would greatly appreciate it.
Hello. My name is Inigo Montoya. You killed my father. Prepare to die.
When you use JAR files and the -jar flag, the class path is ignored. Try putting the JavaMail JAR file in a folder relative to your JAR file, then adding it to the Class-Path directive in your MANIFEST.MF file.
Rob Prime wrote:When you use JAR files and the -jar flag, the class path is ignored. Try putting the JavaMail JAR file in a folder relative to your JAR file, then adding it to the Class-Path directive in your MANIFEST.MF file.
Well, I'm using Netbeans, so I don't know of a way of modifying the manifest file. I've put the javamail JAR in both the compile and run-time libraries in Netbeans, but am still getting this error from the JAR that is generated from my project (the JAR in the dist path of my Netbeans project). Do I maybe need to look at building this without the use of Netbeans, so that I have more granularity of control? Surely Netbeans has the capabilities to do what I am wanting to do; maybe I'm just missing a step somewhere? Again, I can double-click the JAR file, and it runs, but when run via the task scheduler under those same account privileges, that's when I get the error.
subject: NoClassDefFoundError - where to put Javamail JAR file?