Jabref: NoClassDefFoundError: org/apache/commons/logging/LogFactory

Created on 17 Oct 2017  路  6Comments  路  Source: JabRef/jabref

When running JabRefMain.java as an Application, i get the following exception:

Exception in thread "main" java.lang.NoClassDefFoundError: org/apache/commons/logging/LogFactory
    at org.jabref.JabRefMain.<clinit>(JabRefMain.java:42)
    at java.lang.Class.forName0(Native Method)
    at java.lang.Class.forName(Class.java:264)
    at com.intellij.rt.execution.application.AppMain.main(AppMain.java:123)
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)
    ... 4 more

Process finished with exit code 1

I ran all gradle tasks in the _build_ folder, but I keep getting the exception.

waiting-for-customer-feedback

Most helpful comment

@SilasBerger In IDEA this is simple. Open the project and ensure that you have the Gradle plugin installed first. You start all tasks from the Gradle tool-window on the right side. For the tasks used, you will get a run configuration automatically so that you can restart them by pressing the green run button at the top (or use shortcuts).

And a further note. You could have run the Gradle task releaseJar which gives you the final jar under build/releases. This can be started in the usual way with java -jar JabRev-XXX.jar.

All 6 comments

I ran all gradle tasks in the build folder, but I keep getting the exception.

You have to run the gradle tasks in the main folder of the project, where the gradle files reside,
Running: ./gradlew run

Okay, running ./gradlew run builds and starts the application successfully, thanks. Is there also a way to start it from within an IDE? I imagined that I could in some way build the application, then run JabRefMain.java as a Java Application (in IntelliJ, or Eclipse).

@SilasBerger In IDEA this is simple. Open the project and ensure that you have the Gradle plugin installed first. You start all tasks from the Gradle tool-window on the right side. For the tasks used, you will get a run configuration automatically so that you can restart them by pressing the green run button at the top (or use shortcuts).

And a further note. You could have run the Gradle task releaseJar which gives you the final jar under build/releases. This can be started in the usual way with java -jar JabRev-XXX.jar.

That was it! I didn't look at the applicationfolder in the Gradle tool-window. I just built it with tasks in the build folder, then tried to directly run the JabRefMain.java class. Thank you very much for your help!

@SilasBerger Btw, in the preferences under Build, Execution, Deployment -> BuildTools -> Gradle -> Runner you find a check box "Delegate IDE build/run actions to gradle" which might make things even easier.

Or you import the project as a Gradle project and than simply use the normal 'run' command

Was this page helpful?
0 / 5 - 0 ratings

Related issues

wujastyk picture wujastyk  路  37Comments

nswitte picture nswitte  路  39Comments

aytekinar picture aytekinar  路  57Comments

Codeberg-AsGithubAlternative-buhtz picture Codeberg-AsGithubAlternative-buhtz  路  32Comments

HainesB picture HainesB  路  37Comments