After creating a number of Android apps using Java in Eclipse. I now need to create a stand alone Java program so that I can create an sqlite database - that will eventually be used in a future Android app.
I am using the SQLJet library from http://sqljet.com and have copied their example code.
When I try to run the code by using the "Run" button in Eclipse I get the following error.
Exception in thread "main" java.lang.NoClassDefFoundError: org/antlr/runtime/RecognitionException
at org.tmatesoft.sqljet.core.table.engine.SqlJetEngine$2.runSynchronized(SqlJetEngine.java:282)
at org.tmatesoft.sqljet.core.table.engine.SqlJetEngine.runSynchronized(SqlJetEngine.java:217)
at org.tmatesoft.sqljet.core.table.engine.SqlJetEngine.readSchema(SqlJetEngine.java:276)
at org.tmatesoft.sqljet.core.table.engine.SqlJetEngine.getOptions(SqlJetEngine.java:299)
at nlmc.loader.apps4care.com.Test.main(Test.java:36)
Caused by: java.lang.ClassNotFoundException: org.antlr.runtime.RecognitionException
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)
... 5 more
Now as the code has been copied without change, I am guessing there is nothing wrong with that and I suspect that I don't have my environment set up correctly. As a newbie Java developer (normally C#) I'm struggling to make sense of what the problem is. never mind the solution.
Code now working and the database is created. Unfortunately looks like it is not compatible with the sqlite3, the version Android uses. Back to the drawing board...!
The program needs the class org.antlr.runtime.RecognitionException. See here for a list of jars where you can find it: http://www.jarfinder.com/index.php/java/info/org.antlr.runtime.RecognitionException
EDIT: And here you can see all the dependencies for SQLJet: http://mvnrepository.com/artifact/org.tmatesoft.sqljet/sqljet/1.1.1
Related
I have been building a Java game using LWJGL. Recently I decided to stop using a bitmap font (low resolution and low flexibility) and start using Slick for displaying text. I've imported slick-util.jar into my Libraries (I am on Eclipse).
When trying to initialize a TrueTypeFont (I am using this tutorial), however, the code crashes. Here is the stack trace:
Exception in thread "main" java.lang.NoClassDefFoundError: org/lwjgl/opengl/GLContext
at org.newdawn.slick.opengl.renderer.ImmediateModeOGLRenderer.canTextureMirrorClamp(ImmediateModeOGLRenderer.java:408)
at org.newdawn.slick.util.BufferedImageUtil.getTexture(BufferedImageUtil.java:124)
at org.newdawn.slick.util.BufferedImageUtil.getTexture(BufferedImageUtil.java:39)
at org.newdawn.slick.TrueTypeFont.createSet(TrueTypeFont.java:237)
at org.newdawn.slick.TrueTypeFont.<init>(TrueTypeFont.java:98)
at org.newdawn.slick.TrueTypeFont.<init>(TrueTypeFont.java:112)
at StarshipArena.loop(StarshipArena.java:956)
at StarshipArena.run(StarshipArena.java:225)
at StarshipArena.main(StarshipArena.java:1470)
Caused by: java.lang.ClassNotFoundException: org.lwjgl.opengl.GLContext
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)
... 9 more
Other posts have suggested that one must put initialization of TrueTypeFont behind glInit; I have done that but am unsure if there are other OpenGL commands that need to be run to establish GLContext or something.
Any help is appreciated; thanks.
I'm trying to run an application in eclipse which is setup as MVC app and it is the solution code posted by our professor for a homework. After I copy and pasted all of the classes and tried to run it, I got the following error:
JOGL> Hello JOAL Exception in thread "main" java.lang.NoClassDefFoundError: com/jogamp/openal/JoalVersion at jogamp.opengl.openal.av.ALDummyUsage.main(ALDummyUsage.java:14) Caused by: java.lang.ClassNotFoundException: com.jogamp.openal.JoalVersion 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) ... 1 more
I'm not entirely sure what the issue is and apparently no one else has been having the same issue.
My buildpath has a library I titled "JOGL" and I added the external jars gluegen-rt.jar and jogl-all.jar as was instructed by the professor.
Thanks for the help!
Actually, your code uses JOAL too, you need to put joal.jar into your classpath (Build path in Eclipse) and you need to put the JAR(s) containing its native libraries into the same directory as you did for JOGL and GlueGen. I assume you followed these instructions:
http://jogamp.org/wiki/index.php/Setting_up_a_JogAmp_project_in_your_favorite_IDE#Eclipse_IDE_project
Edit.: You don't run your own program for your homework, you try to run ALDummyUsage which is in JOGL itself. If you want to run your own program with your own main class, rather right-click on it and choose "Run As" -> "Java application" in Eclipse.
I have a class that uses Java3D that successfully compiles, although when I try to run it it says: Exception in thread "main" java.lang.NoClassDefFoundError:
javax/media/j3d/Canvas3D,
With the following stack trace:
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: javax.media.j3d.Canvas3D
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)
Stuff I have already tried:
I couldn't even get it to compile until I copied the Java3D jars into /jre/lib/ext/.
I have the latest Java, Java3D and I am using Notepad++ and I have tried reinstalling Java3D.
I have set the classpath/path correctly.
There are no errors in the code.
I can run normal Java applications I have created.
I have tried using the classpath thing when running the application (java -classpath blahblah ApplicationName).
I have checked inside the jars and the classes (including Canvas3D) are definitely in there.
Not everything you say is true.
IF the classes are in the jars, and IF you have set the classpath correctly, THEN you would not get this message.
I suspect you have a build path confused with a classpath (which is mostly associated with runtime, where build path is associated with compile time). Without knowing more details of your runtime environment, it's hard to be more specific.
It always puzzles me how someone with a problem they cannot solve asserts so definitely that all these things are set up "correctly": how do you know? Isn't the problem some evidence to the contrary, at least enough for a small doubt?
I have an application that has only signed jars, all by the same certificate, mine. I wan't to run the application with Webstart. The application runs a compiler, and the compiled code runs LWJGL. However when I run the application, it returns errors by the compiled code that it literally cant find the LWJGL(-library) packages (the original application can see it fine). When I compile the application as a Trusted-Library, it errors out as well:
Exception in thread "CompilerThread" java.lang.NoClassDefFoundError: com/sun/tools/javac/api/JavacTool
at customcompile.CustomCompile$2.run(CustomCompile.java:82)
at java.lang.Thread.run(Unknown Source)
Caused by: java.lang.ClassNotFoundException: com.sun.tools.javac.api.JavacTool
at java.net.URLClassLoader$1.run(Unknown Source)
at java.security.AccessController.doPrivileged(Native Method)
at java.net.URLClassLoader.findClass(Unknown Source)
at com.sun.jnlp.JNLPClassLoader.findClass(Unknown Source)
at java.lang.ClassLoader.loadClass(Unknown Source)
at java.lang.ClassLoader.loadClass(Unknown Source)
... 2 more
http://download.oracle.com/javase/6/docs/technotes/guides/jweb/mixed_code.html
I found this site, but it doesn't get me much wiser on the particular subject, since it is clearly related to the compiled code being handled differently than the other code.
Can anyone help me out with this? Or clear it up?
Edit: I have concluded the compiled code is treated as unsigned.
Getting the libraries to be recognized, requires them being added in the classpath.
I think redirecting System.getProperty calls and the like, to the signed classes, will solve any problems in the unsigned code, giving it indirectly more rights.
I'm running OpenStreetMap's Osmosis in Windows XP to cut a subset of data from a larger set. In various incarnations, the program either hangs or gives me the following error:
C:\Documents and Settings\mmorisy\tools>osmosis.bat --read-xml enableDateParsing
=no file="us_zipcodes.osm" --log-progress interval="10" --bounding-box top=43.22
868195 left=-73.5981635 bottom=41.2283584 right=-69.814204 --write-xml file="mas
s_zipcodes.osm"
Exception in thread "main" java.lang.NoClassDefFoundError: org/codehaus/classwor
lds/Launcher
Caused by: java.lang.ClassNotFoundException: org.codehaus.classworlds.Launcher
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)
Could not find the main class: org.codehaus.classworlds.Launcher. Program will
exit.
I get the feeling that Java isn't properly installed or configured, but I have installed the most revent SDK from Oracle's website and can't figure out where else I might be going wrong, despite maybe half dozen variations.
The error you're getting implies that Java itself is installed correctly, but it can't find the .class file it's trying to run.
At a guess, osmosis.bat has an incorrect -jar or -cp (or -classpath) argument to the classworlds.jar file in it.