I downloaded the opencsv (from http://sourceforge.net/projects/javacsv/files/latest/download) and since then I have been getting this error with all my Java programs
java.lang.NoClassDefFoundError: HelloWorld
Caused by: java.lang.ClassNotFoundException: HelloWorld
at java.net.URLClassLoader$1.run(Unknown Source)
at java.security.AccessController.doPrivileged(Native Method)
at java.net.URLClassLoader.findClass(Unknown Source)
at java.lang.ClassLoader.loadClass(Unknown Source)
at sun.misc.Launcher$AppClassLoader.loadClass(Unknown Source)
at java.lang.ClassLoader.loadClass(Unknown Source)
at java.lang.ClassLoader.loadClassInternal(Unknown Source)
Exception in thread "main"
How can I fix this? I realized I didn't need the opencsv anyway...how can I remove it so that my programs can compile and run as usual? I'm using Eclipse Version: 1.4.2.20120213-0813
You can remove a plugin by going to Help->About (or Eclipse->About on a Mac), choosing installations details, selecting the plugin you wish to remove, and choosing 'Uninstall'.
Related
Using Eclipse, I am modifying a Java project we have been using for years. a specific class method is typically executed by sending a message through IBM WebSphere MQ. However, I now have a need to develop some new functionality and I need to be able to test it out side the MQ world.
I am able to successfully debug the application in Eclipse, but if I attempt to execute the jar file from a command prompt I receive the following error:
Exception in thread "main" java.lang.NoClassDefFoundError: XMLBuilder/Node
at java.lang.Class.getDeclaredMethods0(Native Method)
at java.lang.Class.privateGetDeclaredMethods(Unknown Source)
at java.lang.Class.getMethod0(Unknown Source)
at java.lang.Class.getMethod(Unknown Source)
at sun.launcher.LauncherHelper.getMainMethod(Unknown Source)
at sun.launcher.LauncherHelper.checkAndLoadMain(Unknown Source)
Caused by: java.lang.ClassNotFoundException: XMLBuilder.Node
at java.net.URLClassLoader$1.run(Unknown Source)
at java.net.URLClassLoader$1.run(Unknown Source)
at java.security.AccessController.doPrivileged(Native Method)
at java.net.URLClassLoader.findClass(Unknown Source)
at java.lang.ClassLoader.loadClass(Unknown Source)
at sun.misc.Launcher$AppClassLoader.loadClass(Unknown Source)
at java.lang.ClassLoader.loadClass(Unknown Source)
... 6 more
My build is done using an ant script. This does not include a Class-Path attribute when creating the manifest.
The XMLBuilder.jar file is included in the target jar. Running jar -tf file.jar shows
META-INF/)
META-INF/MANIFEST.MF)
... Omitted for Brevity ...
XMLBuilder.jar
What might I be missing?
Thank you
As the title says, I'm trying to run a class in Command Prompt which uses the Apache POI library but when I run this command:
java -cp C:\Users\rperera\IdeaProjects\LinkingNames\libs; HyperlinkWriter
I get this error:
Exception in thread "main" java.lang.NoClassDefFoundError: org/apache/poi/ss/usermodel/CreationHelper
at java.lang.Class.getDeclaredMethods0(Native Method)
at java.lang.Class.privateGetDeclaredMethods(Unknown Source)
at java.lang.Class.getMethod0(Unknown Source)
at java.lang.Class.getMethod(Unknown Source)
at sun.launcher.LauncherHelper.getMainMethod(Unknown Source)
at sun.launcher.LauncherHelper.checkAndLoadMain(Unknown Source)
Caused by: java.lang.ClassNotFoundException: org.apache.poi.ss.usermodel.CreationHelper
at java.net.URLClassLoader$1.run(Unknown Source)
at java.net.URLClassLoader$1.run(Unknown Source)
at java.security.AccessController.doPrivileged(Native Method)
at java.net.URLClassLoader.findClass(Unknown Source)
at java.lang.ClassLoader.loadClass(Unknown Source)
at sun.misc.Launcher$AppClassLoader.loadClass(Unknown Source)
at java.lang.ClassLoader.loadClass(Unknown Source)
... 6 more
the libs folder contains the entire POI folder that's zipped up when downloaded so I'm not sure why it's throwing this error. I also tested this with IntelliJ and it ran fine. I know that the way Command Prompt and IntelliJ handles libraries is different but I'm not sure why this is happening.
I would appreciate any help! Thanks!
You need to actually compile the jar with the original .java files and the specified POI jars.
javac -cp \path_to_jars \path_to_java_files
and then
java MyProject
I found the answer from a previous answer of StackOverflow. I had to add a '*' to the end, and a '.' after the semicolon. So with my example, in terms of compiling, I had to do:
javac -cp C:\Users\rperera\IdeaProjects\LinkingNames\libs\*;. C:\Users\rperera\IdeaProjects\LinkingNames\src\HyperlinkWriter.java
and then to run it (Credit to #andrewdleach), I just did:
java HyperlinkWriter
I got the standard jar files + juh-2.4.1.jar and ridl-3.2.1.jar (got errors on import) as referenced libraries in my project. When i get an example piece of code from http://api.libreoffice.org/examples/DevelopersGuide/examples.html#FirstSteps i always land on this error:
Exception in thread "main" java.lang.NoClassDefFoundError: com/sun/star/comp/loader/JavaLoader
at com.sun.star.comp.helper.Bootstrap.createInitialComponentContext(Bootstrap.java:118)
at com.sun.star.comp.helper.Bootstrap.bootstrap(Bootstrap.java:241)
at TextDocuments.getRemoteServiceManager(TextDocuments.java:410)
at TextDocuments.storePrintExample(TextDocuments.java:378)
at TextDocuments.runDemo(TextDocuments.java:152)
at TextDocuments.main(TextDocuments.java:142)
Caused by: java.lang.ClassNotFoundException: com.sun.star.comp.loader.JavaLoader
at java.net.URLClassLoader$1.run(Unknown Source)
at java.net.URLClassLoader$1.run(Unknown Source)
at java.security.AccessController.doPrivileged(Native Method)
at java.net.URLClassLoader.findClass(Unknown Source)
at java.lang.ClassLoader.loadClass(Unknown Source)
at sun.misc.Launcher$AppClassLoader.loadClass(Unknown Source)
at java.lang.ClassLoader.loadClass(Unknown Source)
... 6 more
Always a NoClassDefFoundError on bootstrap.. Searching for this but can't find much.. Anybody has an idea how to fix this?
In my LibreOffice installation the missing class is located in the file jurt.jar
Background: I am a C# developer, but my next project needs to be on the JVM. I have researched Scala and I think that it lets me to what I can in C# (Lambdas, inferred types, functional-style, etc). I would classify myself as a very novice Java developer... especially when it comes to using the IDE's, etc.
I have a Scala project that seems to work...
I made a Java project and referenced the Scala project
The editor seems to know about the classes in the Scala project (typeahead, etc)
When I try to run the Java project, I get this error:
Exception in thread "main" java.lang.NoClassDefFoundError: scala/ScalaObject
at java.lang.ClassLoader.defineClass1(Native Method)
at java.lang.ClassLoader.defineClassCond(Unknown Source)
at java.lang.ClassLoader.defineClass(Unknown Source)
at java.security.SecureClassLoader.defineClass(Unknown Source)
at java.net.URLClassLoader.defineClass(Unknown Source)
at java.net.URLClassLoader.access$000(Unknown Source)
at java.net.URLClassLoader$1.run(Unknown Source)
at java.security.AccessController.doPrivileged(Native Method)
at java.net.URLClassLoader.findClass(Unknown Source)
at java.lang.ClassLoader.loadClass(Unknown Source)
at sun.misc.Launcher$AppClassLoader.loadClass(Unknown Source)
at java.lang.ClassLoader.loadClass(Unknown Source)
at learning_scala.java.Main.main(Main.java:12)
Caused by: java.lang.ClassNotFoundException: scala.ScalaObject
at java.net.URLClassLoader$1.run(Unknown Source)
at java.security.AccessController.doPrivileged(Native Method)
at java.net.URLClassLoader.findClass(Unknown Source)
at java.lang.ClassLoader.loadClass(Unknown Source)
at sun.misc.Launcher$AppClassLoader.loadClass(Unknown Source)
at java.lang.ClassLoader.loadClass(Unknown Source)
Clearly something has gone awry in the Java/Scala compilation, but I have no idea how to resolve it (my lack of Java experience being the primary culprit here)
I'm using Eclipse w/ the official Scala plugin... all of which are up to date as of 2-3 days ago.
Thanks
You need to add the scala-library.jar library to your classpath. You can do that a few different ways but the simplest is to copy the file into your project (drag and drop it into your eclipse package explorer). Next, right click on the file and select add to build path. That adds the scala jar to your classpath. That should fix the problem.
i found the following ruby app in git:
https://github.com/chrislo/sourceclassifier
and it is exactly what i need for the final part of my school project.
It would be great if i could use it in a my java project.
i used jRuby and managed to compile the class i need ( sourceclassifier.rb ) to a Java .class file, and added it to the build path of my eclipse app.
how can i now use it inside my app?
using sourceclassifier s = new sourceclassifier() throws me the following exception:
Exception in thread "main" java.lang.NoClassDefFoundError: sourceclassifier/lib/sourceclassifier
at StackOverFlowReader.main(StackOverFlowReader.java:208)
Caused by: java.lang.ClassNotFoundException: sourceclassifier.lib.sourceclassifier
at java.net.URLClassLoader$1.run(Unknown Source)
at java.security.AccessController.doPrivileged(Native Method)
at java.net.URLClassLoader.findClass(Unknown Source)
at java.lang.ClassLoader.loadClass(Unknown Source)
at sun.misc.Launcher$AppClassLoader.loadClass(Unknown Source)
at java.lang.ClassLoader.loadClass(Unknown Source)
... 1 more`
and help will be appreciated,
Boris.