java.lang.NoClassDefFoundError
Dear Sir i want to load my jar thorugh your api but it always show java.lang.NoClassDefFoundError. This is my sample code which i written: My Code: var java = require("java"); var path = require('path'); var fs = require('fs'); var version = java.callStaticMethodSync("java.lang.System", "getProperty", "java.version"); java.classpath.push('.'); java.classpath.push("commons-lang3-3.1.jar"); java.classpath.push("commons-io.jar"); java.classpath.push( path.resolve('C:\webkit\test.jar') ); console.log("Java Version: "+version); console.log("Java Classpath: "+java.classpath); java.classpath.push(path.join(__dirname, "test.jar")); console.log('jar exists: ' + fs.existsSync(path.join(__dirname, "test.jar")));
java.newInstance("test.Sample", function(err, list2) {
if(err)
{
console.log(err);
return;
}else{
console.log("Sample class load successfully");
}
});
But when i run by prog by node it always show unable to find class. I already test this jar with another java class file its works fine. Please give me solution
You have to set up the classpath BEFORE calling any Java method.
I have already done this but same issue happened
On 18-Dec-2017 4:22 pm, "Jakub Zakrzewski" [email protected] wrote:
You have to set up the classpath BEFORE calling any Java method.
— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub https://github.com/joeferner/node-java/issues/419#issuecomment-352392211, or mute the thread https://github.com/notifications/unsubscribe-auth/AEU96CK0Ww6J0YX98AvDL4beUjLUZNkjks5tBkPrgaJpZM4RFP06 .
I had issues with classpath and special characters. Can you post the full value of java.classpath ?
@malay0345 Did you manage to fix this issue ? Im running into the same problem with my own .jar
+1