I've created a java project in Netbeans and I am trying to run it in the command prompt by creating a .jar of the project and then doing java -jar nameOfThePorject.jar but I get this error:
Exception in thread "main" java.lang.NoClassDefFoundError: com/coti/tools/Rutas
at controller.Controller.compruebaBinario(Controller.java:41)
at view.Vista.comienzaLaFiesta(Vista.java:23)
at musicfy.Main.main(Main.java:25)
Caused by: java.lang.ClassNotFoundException: com.coti.tools.Rutas
at java.base/jdk.internal.loader.BuiltinClassLoader.loadClass(BuiltinClassLoader.java:604)
at java.base/jdk.internal.loader.ClassLoaders$AppClassLoader.loadClass(ClassLoaders.java:178)
at java.base/java.lang.ClassLoader.loadClass(ClassLoader.java:521)
... 3 more
How can I fix it?
PS: I am running the project in Netbeans without any error
Related
Everything works fine when debugging the project on the intelij environment.
But when I try to execute
java -jar myJar.jar
I get
Exception in thread "main" java.lang.NoClassDefFoundError: org/openqa/selenium/support/ui/Wait
at com.anyclip.App.main(App.java:43)
Caused by: java.lang.ClassNotFoundException: org.openqa.selenium.support.ui.Wait
at java.base/jdk.internal.loader.BuiltinClassLoader.loadClass(BuiltinClassLoader.java:606)
at java.base/jdk.internal.loader.ClassLoaders$AppClassLoader.loadClass(ClassLoaders.java:168)
at java.base/java.lang.ClassLoader.loadClass(ClassLoader.java:522)
... 1 more
I tried several solutions, including this one (ClassNotFoundException on a Maven Project using Selenium), but all failed.
How can I overcome this?
This question already has answers here:
What is a classpath and how do I set it?
(10 answers)
Closed 2 years ago.
When run application from command line I get the following:
Exception in thread "main" java.lang.NoClassDefFoundError: org/json/JSONException
at com.poker5o.Main.main(Main.java:39)
Caused by: java.lang.ClassNotFoundException: org.json.JSONException
at java.base/jdk.internal.loader.BuiltinClassLoader.loadClass(BuiltinClassLoader.java:581)
at java.base/jdk.internal.loader.ClassLoaders$AppClassLoader.loadClass(ClassLoaders.java:178)
at java.base/java.lang.ClassLoader.loadClass(ClassLoader.java:521)
The application compiled fine and even when i specify class path to the json jar still get same error.
root#poker5o:/usr/local/poker5o/SignalChannel# ls
com json-20190722.jar
root#poker5o:/usr/local/poker5o/SignalChannel# java -cp . com.poker5o.Main
Allocating server socket for the server
Sending parameters to DoListen
Back from DoListen
Setting up read/write buffers
Back from SetBuffers
Exception in thread "main" java.lang.NoClassDefFoundError: org/json/JSONException
at com.poker5o.Main.main(Main.java:39)
Caused by: java.lang.ClassNotFoundException: org.json.JSONException
at java.base/jdk.internal.loader.BuiltinClassLoader.loadClass(BuiltinClassLoader.java:581)
at java.base/jdk.internal.loader.ClassLoaders$AppClassLoader.loadClass(ClassLoaders.java:178)
at java.base/java.lang.ClassLoader.loadClass(ClassLoader.java:521)
... 1 more
I managed to solve the problem by extracting the json JAR , so now i have:
com & org directories on my working directory. DO i always need to extract jars ?
and do i allways have to place my appliction in same path that represents full name ? com.poker5o.Main...? what if i want to bundle everything like distribute application is there a good way to do so ?
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.
I am trying to create AVD on my mac from command line,
avdmanager create avd -n test -k "system-images;android-28;google_apis;x86"
Then I got this error message
Exception in thread "main" java.lang.NoClassDefFoundError: javax/xml/bind/annotation/XmlSchema
at com.android.repository.api.SchemaModule$SchemaModuleVersion.(SchemaModule.java:156)
at com.android.repository.api.SchemaModule.(SchemaModule.java:75)
at com.android.sdklib.repository.AndroidSdkHandler.(AndroidSdkHandler.java:81)
at com.android.sdklib.tool.AvdManagerCli.run(AvdManagerCli.java:213)
at com.android.sdklib.tool.AvdManagerCli.main(AvdManagerCli.java:200)
Caused by: java.lang.ClassNotFoundException: javax.xml.bind.annotation.XmlSchema
at java.base/jdk.internal.loader.BuiltinClassLoader.loadClass(BuiltinClassLoader.java:602)
at java.base/jdk.internal.loader.ClassLoaders$AppClassLoader.loadClass(ClassLoaders.java:178)
at java.base/java.lang.ClassLoader.loadClass(ClassLoader.java:521)
... 5 more
I tried to fix the problem by doing
export JAVA_OPTS='-XX:+IgnoreUnrecognizedVMOptions --add-modules java.se.ee'
And then the error message become
Error occurred during initialization of boot layer
java.lang.module.FindException: Module java.se.ee not found
It seems java.se.ee was removed in JAVA 11 but now I am using JAVA 13. Is there any solution other than downgrade JAVA version?
At last I downgrade my java to 8 and it worked.
I am trying to run a groovy script like:
java -jar %JAVA_HOME%\..\lib\groovy-all-2.1.7.jar hello.groovy.
The problem is, I am grabbing dependencies in the beggining of the script like:
#Grapes([
#Grab("org.apache.poi:poi:3.11"),
])
but I get the following error:
Caught: java.lang.NoClassDefFoundError: org/apache/ivy/core/report/ResolveReport
java.lang.NoClassDefFoundError: org/apache/ivy/core/report/ResolveReport
Caused by: java.lang.ClassNotFoundException: org.apache.ivy.core.report.ResolveReport
How can I fix this?