How to use Eclipse ClassPath via CMD or Bash?

65 Views Asked by At

I have one app which I want to dockerize. But first, I need to run it via console(cmd or bash). When I run it from Eclipse everything is okay, but when I run it from bash(java -jar project-18.5.0-SNAPSHOT.jar) I get this error

Exception in thread "main" java.lang.NoClassDefFoundError: org/apache/commons/logging/LogFactory
        at com.hp.spacecat.util.PropertyUtil.<clinit>(PropertyUtil.java:35)
        at com.hp.spacecat.SpaceCat.main(SpaceCat.java:76)
Caused by: java.lang.ClassNotFoundException: org.apache.commons.logging.LogFactory
        at java.net.URLClassLoader.findClass(URLClassLoader.java:381)
        at java.lang.ClassLoader.loadClass(ClassLoader.java:424)
        at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:331)
        at java.lang.ClassLoader.loadClass(ClassLoader.java:357)
        ... 2 more

I have that jar in m2 and he has this LogFactory class. Mvn clean install is success. But for some reason I can't run it via console. I don't know is there some way to get that classpath from Eclipse or there is another way to solve this. Similar questions about this logging exception didn't help me.

0

There are 0 best solutions below