Skip to content
This repository has been archived by the owner on Jul 14, 2023. It is now read-only.

Exception in thread "main" java.lang.NoClassDefFoundError: org/kohsuke/args4j/CmdLineException #36

Open
orizzontiholding opened this issue Jul 14, 2023 · 1 comment

Comments

@orizzontiholding
Copy link

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??

@yeokm1
Copy link
Owner

yeokm1 commented Jul 14, 2023

As mentioned in the Readme, I'm not maintaining this library anymore. Issue will be left here in case others face a similar issue.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants