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 ?
Related
Good day,
I am new to Talend, I am trying to create a Schema for tFileInputDelimited component. The Schema is trying to read a text file from a folder.
However, during step 3 on creating this Schema, I am hitting some class not found exception:
Exception in thread "main" java.lang.NoClassDefFoundError: com/talend/csv/CSVWriter
at orion_dl_track.shadowfileinputtodelimitedoutput_0_1.ShadowFileInputToDelimitedOutput.tFileInputDelimitedProcess(ShadowFileInputToDelimitedOutput.java:1709)
at orion_dl_track.shadowfileinputtodelimitedoutput_0_1.ShadowFileInputToDelimitedOutput.runJobInTOS(ShadowFileInputToDelimitedOutput.java:2436)
at orion_dl_track.shadowfileinputtodelimitedoutput_0_1.ShadowFileInputToDelimitedOutput.main(ShadowFileInputToDelimitedOutput.java:2295)
Caused by: java.lang.ClassNotFoundException: com.talend.csv.CSVWriter
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:522)
... 3 more
Preview error. Some settings must be changed.
Note: Preview errors are generally due to a wrong encoding setting.
org.talend.designer.runprocess.shadow.ShadowFilePreview.preview(ShadowFilePreview.java:90)
org.talend.metadata.managment.ui.utils.ShadowProcessHelper.getCsvArray(ShadowProcessHelper.java:383)
org.talend.repository.ui.wizards.metadata.connection.files.delimited.DelimitedFileStep2Form$PreviewProcessor.nonUIProcessInThread(DelimitedFileStep2Form.java:1309)
org.talend.commons.ui.swt.thread.SWTUIThreadProcessor$1.run(SWTUIThreadProcessor.java:74)
For java program, then I will know I need to import this library into my project, like adding the gradle implementation script from Maven website.
But how about this talend? Is it I need to go some where to download the jar and import into Talend Studio?
OS: Ubuntu 22.04.1 LTS
java: openjdk-18.0.2.1
I got the folowing error when trying to connect to a MongoDB database from ReactiveMongo API (reactivemongo_3-1.1.0-noshaded-RC6):
java.lang.NoClassDefFoundError: reactivemongo/core/errors/ConnectionException
Exception in thread "main" java.lang.NoClassDefFoundError: reactivemongo/core/errors/ConnectionException
at reactivemongo.api.AsyncDriver$.apply(AsyncDriver.scala:503)
at e2m.MongoExport.<init>(MongoExport.scala:35)
at e2m.MongoExport$.<clinit>(MongoExport.scala:82)
at e2m.MongoExport.main(MongoExport.scala)
Caused by: java.lang.ClassNotFoundException: reactivemongo.core.errors.ConnectionException
at java.base/jdk.internal.loader.BuiltinClassLoader.loadClass(BuiltinClassLoader.java:641)
at java.base/jdk.internal.loader.ClassLoaders$AppClassLoader.loadClass(ClassLoaders.java:188)
at java.base/java.lang.ClassLoader.loadClass(ClassLoader.java:521)
... 4 more
I looked for the package "reactivemongo.core.errors" inside the jar file and I did not found it.
Could you help me out by telling me which jar file should I include in my project to solve this problem?
Thanks
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?
I am new to Java and trying around. Now I would like to learn about network - server client communications. Long story short I found jars on github which should make the start easier. So I downloaded the file and added it to my Modulepath. Everything looked OK while writing a simple start to just connect but when I want to run for testing I get the NoClassDefFoundError ...
Exception in thread "main" java.lang.NoClassDefFoundError: com/blogspot/debukkitsblog/net/Server
at java.base/java.lang.ClassLoader.defineClass1(Native Method)
at java.base/java.lang.ClassLoader.defineClass(ClassLoader.java:1010)
at java.base/java.security.SecureClassLoader.defineClass(SecureClassLoader.java:150)
at java.base/jdk.internal.loader.BuiltinClassLoader.defineClass(BuiltinClassLoader.java:855)
at java.base/jdk.internal.loader.BuiltinClassLoader.findClassOnClassPathOrNull(BuiltinClassLoader.java:753)
at java.base/jdk.internal.loader.BuiltinClassLoader.loadClassOrNull(BuiltinClassLoader.java:676)
at java.base/jdk.internal.loader.BuiltinClassLoader.loadClass(BuiltinClassLoader.java:634)
at java.base/jdk.internal.loader.ClassLoaders$AppClassLoader.loadClass(ClassLoaders.java:182)
at java.base/java.lang.ClassLoader.loadClass(ClassLoader.java:519)
at fst.serverclient.ssc.SSCNetzwerkTester.main(SSCNetzwerkTester.java:6)
Caused by: java.lang.ClassNotFoundException: com.blogspot.debukkitsblog.net.Server
at java.base/jdk.internal.loader.BuiltinClassLoader.loadClass(BuiltinClassLoader.java:636)
at java.base/jdk.internal.loader.ClassLoaders$AppClassLoader.loadClass(ClassLoaders.java:182)
at java.base/java.lang.ClassLoader.loadClass(ClassLoader.java:519)
... 10 more
I do not have any idea what am I doing wrong, the jar should work otherwise it should not be there for download I guess. But the error comes from one of the jar classes called Server:
java.lang.NoClassDefFoundError: com/blogspot/debukkitsblog/net/Server
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