docs-to-pdf-converter
docs-to-pdf-converter copied to clipboard
Exception in thread "main" java.lang.NoClassDefFoundError: org/kohsuke/args4j/CmdLineException
I'm trying to run the jar from a nodejs script. Everytime I start my script when it's called the jar I will get the following error
Error: Command failed: java -jar docs-to-pdf-converter-1.7.jar -i C:\Users\b\Desktop\myfile.docx, -o C:\Users\b\Desktop\myfile.pdf
Exception in thread "main" java.lang.NoClassDefFoundError: org/kohsuke/args4j/CmdLineException
at java.base/java.lang.Class.forName0(Native Method)
at java.base/java.lang.Class.forName(Class.java:398)
at org.eclipse.jdt.internal.jarinjarloader.JarRsrcLoader.main(JarRsrcLoader.java:56)
Caused by: java.lang.ClassNotFoundException: org.kohsuke.args4j.CmdLineException
at java.base/java.net.URLClassLoader.findClass(URLClassLoader.java:476)
at java.base/java.lang.ClassLoader.loadClass(ClassLoader.java:589)
at java.base/java.lang.ClassLoader.loadClass(ClassLoader.java:522)
... 3 more
at ChildProcess.exithandler (node:child_process:430:12)
at ChildProcess.emit (node:events:513:28)
at maybeClose (node:internal/child_process:1091:16)
at ChildProcess._handle.onexit (node:internal/child_process:302:5) {
code: 1,
killed: false,
signal: null,
cmd: 'java -jar docs-to-pdf-converter-1.7.jar -i C:\\Users\\b\\Desktop\\myfile.docx, -o C:\\Users\\b\\Desktop\\myfile.pdf'
This is how I call the script from nodejs
for( let p = 0; p < docPaths.length; p++ ) {
childProcess.exec(`java -jar docs-to-pdf-converter-1.7.jar -i ${docPaths[p]}, -o ${docPaths[p].replace('.docx', '.pdf')}`, (err, stdout, stderr) => {
console.log(err, stdout, stderr);
});
}
Is there any bug into the library or I need to change the code??
As mentioned in the Readme, I'm not maintaining this library anymore. Issue will be left here in case others face a similar issue.