I have a Java program compiled into a JAR that runs well on Windows. On Mac, it does not run well. I've included the stack trace, I get a
"java.lang.UnsatisfiedLinkError: org.sqlite.core.NativeDB._open(LJava/lang/String;I)V" error
It seems that it's failing at the second of these two lines in my program:
Class.forName("org.sqlite.JDBC").newInstance();
connection = DriverManager.getConnection(dbURL + dbLoc); //fails here
I've never seen one of these errors before, some research revealed that it may be a problem with the SQLite version and that I needed to include another JAR Library for SQLite that was compatible for Mac since the snapshot version below was not compatible. I have both of these libraries included in my project's libraries now:
sqlite-jdbc-3.7.2.jar
sqlite-jdbc4-3.8.2-SNAPSHOT.jar
Unfortunately I'm still getting the same error message. Again, the program runs flawlessly on Windows. This is a Mac issue only.
Anyone have any ideas?
Stack Trace:
java -jar "PRG - RYADD.jar"
Exception in thread "AWT-EventQueue-0" java.lang.UnsatisfiedLinkError: org.sqlite.core.NativeDB._open(Ljava/lang/String;I)V
at org.sqlite.core.NativeDB._open(Native Method)
at org.sqlite.core.DB.open(DB.java:161)
at org.sqlite.core.CoreConnection.open(CoreConnection.java:145)
at org.sqlite.core.CoreConnection.<init>(CoreConnection.java:66)
at org.sqlite.jdbc3.JDBC3Connection.<init>(JDBC3Connection.java:21)
at org.sqlite.jdbc4.JDBC4Connection.<init>(JDBC4Connection.java:23)
at org.sqlite.SQLiteConnection.<init>(SQLiteConnection.java:44)
at org.sqlite.JDBC.createConnection(JDBC.java:113)
at org.sqlite.JDBC.connect(JDBC.java:87)
at java.sql.DriverManager.getConnection(DriverManager.java:582)
at java.sql.DriverManager.getConnection(DriverManager.java:207)
at prgryadd.DBConnect.createConnection(DBConnect.java:43)
at prgryadd.DBConnect.<init>(DBConnect.java:32)
at prgryadd.PRGRYADDView.<clinit>(PRGRYADDView.java:756)
at prgryadd.PRGRYADDApp.startup(PRGRYADDApp.java:19)
at org.jdesktop.application.Application$1.run(Application.java:171)
at java.awt.event.InvocationEvent.dispatch(InvocationEvent.java:209)
at java.awt.EventQueue.dispatchEventImpl(EventQueue.java:682)
at java.awt.EventQueue.access$000(EventQueue.java:85)
at java.awt.EventQueue$1.run(EventQueue.java:643)
at java.awt.EventQueue$1.run(EventQueue.java:641)
at java.security.AccessController.doPrivileged(Native Method)
at java.security.AccessControlContext$1.doIntersectionPrivilege(AccessControlContext.java:87)
at java.awt.EventQueue.dispatchEvent(EventQueue.java:652)
at java.awt.EventDispatchThread.pumpOneEventForFilters(EventDispatchThread.java:296)
at java.awt.EventDispatchThread.pumpEventsForFilter(EventDispatchThread.java:211)
at java.awt.EventDispatchThread.pumpEventsForHierarchy(EventDispatchThread.java:201)
at java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:196)
at java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:188)
at java.awt.EventDispatchThread.run(EventDispatchThread.java:122)
Got it working. Deleted the other SQLite-JDBC libraries and included only the oldest named "sqlite-jdbc-3.7.15-SNAPSHOT.jar" from the following URL:
https://bitbucket.org/xerial/sqlite-jdbc/downloads
This solved the problem. Apparently there are some compatibility issues with the newest SQLite-JDBC library not playing well with Macs. The older versions don't seem to have this problem.
Related
This evening, I downloaded a .jar file from Jsqlquiz website. However, when I try to execute it in the terminal, I have these two displayed exceptions (I'm on Windows 10) :
Exception in thread "WindowsNativeRunloopThread" java.lang.NoSuchMethodError:
at com.sun.glass.ui.win.WinApplication.staticScreen_getScreens(Native Method)
at com.sun.glass.ui.Screen.initScreens(Screen.java:412)
at com.sun.glass.ui.Application.lambda$run$1(Application.java:152)
at com.sun.glass.ui.win.WinApplication._runLoop(Native Method)
at com.sun.glass.ui.win.WinApplication.lambda$runLoop$3(WinApplication.java:174)
at java.base/java.lang.Thread.run(Thread.java:830)
and
Exception in thread "JavaFX Application Thread" java.lang.NullPointerException
at com.sun.prism.d3d.D3DPipeline.getAdapterOrdinal(D3DPipeline.java:205)
at com.sun.javafx.tk.quantum.QuantumToolkit.assignScreensAdapters(QuantumToolkit.java:695)
at com.sun.javafx.tk.quantum.QuantumToolkit.runToolkit(QuantumToolkit.java:313)
at com.sun.javafx.tk.quantum.QuantumToolkit.lambda$startup$10(QuantumToolkit.java:258)
at com.sun.glass.ui.Application.lambda$run$1(Application.java:153)
at com.sun.glass.ui.win.WinApplication._runLoop(Native Method)
at com.sun.glass.ui.win.WinApplication.lambda$runLoop$3(WinApplication.java:174)
at java.base/java.lang.Thread.run(Thread.java:830)
I check my java's versions to see if I have a bad/old one, but all is on date :
JDK 13.0.1
JRE 1.8.0_241
JavaFX 11.0.2
I found answers on this forum but none helped me. :
Write java -jar filename.jar in a .bat file and execute it.
Extract the folder and try to run it.
Place jdk-13.0.1\bin and Java\jre1.8.0_241\bin above the Common_Files\Oracle\Java\javapath (I deleted it finally, it was the easiest way to try to fix my problem).
If anyone here thinks they can help me, tell me! :)
Okay, after hours spent fixing my problem, I finally found it for myself!
For all those who have the same problem, follow what I will say:
There must be ONLY one version of Java on your pc (wether it's the JDK or JRE). So, only keep the java version you want and try to compile your file with java -jar fileName.jar and it should work.
I myself had the JDK and the JRE, both added to the path of the environment variables. So the error came from here.
The only thing I don't understand is why the JRE created a problem during the execution when I had put the path of the JDK above.
My application uses javafx 11.0.1 and is shipped bundled with a jlinked version of openjdk 11. It runs fine for the vast majority of the users but few of them are getting this stack:
Exception in thread "WindowsNativeRunloopThread" java.lang.NoSuchMethodError: <init>
at com.sun.glass.ui.win.WinApplication.staticScreen_getScreens(Native Method)
at com.sun.glass.ui.Screen.initScreens(Screen.java:412)
at com.sun.glass.ui.Application.lambda$run$1(Application.java:152)
at com.sun.glass.ui.win.WinApplication._runLoop(Native Method)
at com.sun.glass.ui.win.WinApplication.lambda$runLoop$3(WinApplication.java:174)
at java.base/java.lang.Thread.run(Unknown Source)
Exception in thread "JavaFX Application Thread" java.lang.NullPointerException
at com.sun.javafx.tk.quantum.QuantumToolkit.assignScreensAdapters(QuantumToolkit.java:695)
at com.sun.javafx.tk.quantum.QuantumToolkit.runToolkit(QuantumToolkit.java:313)
at com.sun.javafx.tk.quantum.QuantumToolkit.lambda$startup$10(QuantumToolkit.java:258)
at com.sun.glass.ui.Application.lambda$run$1(Application.java:153)
at com.sun.glass.ui.win.WinApplication._runLoop(Native Method)
at com.sun.glass.ui.win.WinApplication.lambda$runLoop$3(WinApplication.java:174)
at java.base/java.lang.Thread.run(Unknown Source)
I found some discussion related to the same exception but regarding Maven+Eclipse, here and here. The issue is very similar, user reporting it, do have other java installations and uninstalling them solves the issue, so basically leaving my bundled openjdk as the only option the application starts, but if there is another Java installed on the system, the wrong .dll is picked up and the application crashes with the above stacktrace.
I tried the suggested java.library.path workaround but users are saying it doesn't solve. Unfortunately I cannot reproduce it myself, any idea on how to solve it or what to ask the users reporting it?
EDIT: we fixed the exe generated by lauch4j here and the bash script here. The idea is basically to restrict/change the PATH env variable to avoid the wrong dll being picked up.
We fixed the exe generated by lauch4j here and the bash script here. The idea is basically to restrict/change the PATH env variable to avoid the wrong dll being picked up.
I'm trying to develop a java3d application, i try everything, i just download the jogamp-platform because how i could read in many websites the java3d is obsolete and for mac os x you need this, i put them all in /System/Frameworks/Java/Extensions where are my .jar files in order to not add to the classpath in Eclipse but it still getting the same error:
Exception in thread "main" java.lang.NoClassDefFoundError: javax/media/opengl/AbstractGraphicsDevice
at java.lang.Class.forName0(Native Method)
at java.lang.Class.forName(Class.java:171)
at javax.media.j3d.Pipeline$1.run(Pipeline.java:143)
at java.security.AccessController.doPrivileged(Native Method)
at javax.media.j3d.Pipeline.createPipeline(Pipeline.java:138)
at javax.media.j3d.MasterControl.loadLibraries(MasterControl.java:926)
at javax.media.j3d.VirtualUniverse.<clinit>(VirtualUniverse.java:280)
at javax.media.j3d.Canvas3D.<clinit>(Canvas3D.java:3862)
at Apartado_a.<init>(Apartado_a.java:17)
at Apartado_a.main(Apartado_a.java:67)
Caused by: java.lang.ClassNotFoundException: javax.media.opengl.AbstractGraphicsDevice
at java.net.URLClassLoader$1.run(URLClassLoader.java:202)
at java.security.AccessController.doPrivileged(Native Method)
at java.net.URLClassLoader.findClass(URLClassLoader.java:190)
at sun.misc.Launcher$ExtClassLoader.findClass(Launcher.java:229)
at java.lang.ClassLoader.loadClass(ClassLoader.java:306)
at java.lang.ClassLoader.loadClass(ClassLoader.java:247)
... 10 more
These are the files inside extensions folder:
j3daudio.jar
j3dcore.jar
j3dutils.jar
joal-natives-macosx-universal.jar
jogl-all.jar
gluegen-rt.jar
gluegen-rt-natives-macosx-universal.jar
Regards!
Mac OS X comes pre-installed with Java 3D version 1.3. You can find these files in /System/Library/Java/Extensions. If you need to install Java 3D version 1.5 (and it sounds like you do), then you can use this installer: http://create.ife.no/vr/tools/j3d/java3d_1_5_2-macosx.pkg.zip
Don't use the /System/Frameworks/Java/Extensions folder for this.
Instead, include the relevant libraries in the lib/ folder of your application. Also, check which version of the JDK you are using. I believe there are some issues with Java3D running on the newer Apple-provided JVMs versus the older Oracle/Sun provided ones.
Background, this application is running on Play! Framework 1.2.4 on a Mac OS X 10.5.8
The command I'm running: sudo play run
The exception thrown:
Exception in thread "main" java.lang.UnsupportedClassVersionError: Bad version number in .class file
at java.lang.ClassLoader.defineClass1(Native Method)
at java.lang.ClassLoader.defineClass(ClassLoader.java:676)
at java.security.SecureClassLoader.defineClass(SecureClassLoader.java:124)
at java.net.URLClassLoader.defineClass(URLClassLoader.java:260)
at java.net.URLClassLoader.access$100(URLClassLoader.java:56)
at java.net.URLClassLoader$1.run(URLClassLoader.java:195)
at java.security.AccessController.doPrivileged(Native Method)
at java.net.URLClassLoader.findClass(URLClassLoader.java:188)
at java.lang.ClassLoader.loadClass(ClassLoader.java:317)
at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:280)
at java.lang.ClassLoader.loadClass(ClassLoader.java:252)
at java.lang.ClassLoader.loadClassInternal(ClassLoader.java:375)
at java.lang.Class.getDeclaredConstructors0(Native Method)
at java.lang.Class.privateGetDeclaredConstructors(Class.java:2357)
at java.lang.Class.getConstructor0(Class.java:2671)
at java.lang.Class.newInstance0(Class.java:321)
at java.lang.Class.newInstance(Class.java:303)
at play.plugins.PluginCollection.loadPlugins(PluginCollection.java:158)
at play.Play.init(Play.java:294)
at play.server.Server.main(Server.java:158)
The application.conf for the application and all dependent modules are set to java.source=1.6
sudo $JAVA_HOME/bin/java -version yields java version "1.6.0_26"
I've even pointed /System/Java/Home to the 1.6 installation.
What else could be causing this?
Which Java version(s) do you have in your PATH? We got a similar issue (not with Play, though) in which all the settings of the application seemed to point to 1.6 but the PATH had a reference to 1.5 that was loaded first due to its position inside the PATH string.
Check your PATH. And, I'm not a Mac user, but it's necessary to use sudo? In Ubuntu I run Play without. If possible, this may help to reduce unexpected conflicts due to root user paths and configuration.
I have this error creating a new project on netbeans 6.10M (on 25% of project creation), on other versions, the creation of a new project just fails.. some other functionalities of netbeans are also not working..
im using Snow Leopard, last version
java.lang.NoSuchMethodError: org.apache.xerces.impl.xs.XMLSchemaLoader.loadGrammar([Lorg/apache/xerces/xni/parser/XMLInputSource;)V
at org.apache.xerces.jaxp.validation.XMLSchemaFactory.newSchema(Unknown Source)
at org.netbeans.modules.project.ant.ProjectXMLCatalogReader.projectXmlCombinedSchema(ProjectXMLCatalogReader.java:189)
at org.netbeans.modules.project.ant.ProjectXMLCatalogReader.validate(ProjectXMLCatalogReader.java:154)
at org.netbeans.modules.project.ant.AntBasedProjectFactorySingleton.loadProjectXml(AntBasedProjectFactorySingleton.java:384)
at org.netbeans.modules.project.ant.AntBasedProjectFactorySingleton.loadProject(AntBasedProjectFactorySingleton.java:237)
at org.netbeans.api.project.ProjectManager.createProject(ProjectManager.java:361)
at org.netbeans.api.project.ProjectManager.access$300(ProjectManager.java:85)
at org.netbeans.api.project.ProjectManager$2.run(ProjectManager.java:282)
at org.netbeans.api.project.ProjectManager$2.run(ProjectManager.java:233)
at org.openide.util.Mutex.readAccess(Mutex.java:330)
at org.netbeans.api.project.ProjectManager.findProject(ProjectManager.java:233)
at org.netbeans.spi.project.support.ant.ProjectGenerator$1.run(ProjectGenerator.java:190)
at org.netbeans.spi.project.support.ant.ProjectGenerator$1.run(ProjectGenerator.java:120)
at org.openide.util.Mutex.writeAccess(Mutex.java:436)
at org.netbeans.spi.project.support.ant.ProjectGenerator.createProject0(ProjectGenerator.java:120)
at org.netbeans.spi.project.support.ant.ProjectGenerator.createProject(ProjectGenerator.java:114)
at org.netbeans.modules.java.j2seproject.J2SEProjectGenerator.createProject(J2SEProjectGenerator.java:235)
at org.netbeans.modules.java.j2seproject.J2SEProjectGenerator.access$000(J2SEProjectGenerator.java:87)
at org.netbeans.modules.java.j2seproject.J2SEProjectGenerator$1.run(J2SEProjectGenerator.java:108)
at org.openide.filesystems.EventControl.runAtomicAction(EventControl.java:125)
at org.openide.filesystems.FileSystem.runAtomicAction(FileSystem.java:566)
at org.netbeans.modules.java.j2seproject.J2SEProjectGenerator.createProject(J2SEProjectGenerator.java:106)
at org.netbeans.modules.java.j2seproject.ui.wizards.NewJ2SEProjectWizardIterator.instantiate(NewJ2SEProjectWizardIterator.java:185)
at org.openide.loaders.TemplateWizard$InstantiatingIteratorBridge.instantiate(TemplateWizard.java:1019)
at org.openide.loaders.TemplateWizard.handleInstantiate(TemplateWizard.java:591)
at org.openide.loaders.TemplateWizard.instantiateNewObjects(TemplateWizard.java:412)
at org.openide.loaders.TemplateWizardIterImpl.instantiate(TemplateWizardIterImpl.java:256)
at org.openide.loaders.TemplateWizardIteratorWrapper.instantiate(TemplateWizardIteratorWrapper.java:168)
at org.openide.WizardDescriptor.callInstantiateOpen(WizardDescriptor.java:1541)
at org.openide.WizardDescriptor.callInstantiate(WizardDescriptor.java:1498)
at org.openide.WizardDescriptor.access$1700(WizardDescriptor.java:130)
at org.openide.WizardDescriptor$Listener$2$1.run(WizardDescriptor.java:2069)
at org.openide.util.RequestProcessor$Task.run(RequestProcessor.java:1426)
at org.openide.util.RequestProcessor$Processor.run(RequestProcessor.java:1968)
Caused: org.openide.util.RequestProcessor$SlowItem: task failed due to
at org.openide.util.RequestProcessor.post(RequestProcessor.java:421)
at org.openide.WizardDescriptor$Listener$2.run(WizardDescriptor.java:2115)
at org.openide.WizardDescriptor$8.run(WizardDescriptor.java:1430)
at org.openide.WizardDescriptor.lazyValidate(WizardDescriptor.java:1470)
at org.openide.WizardDescriptor.access$1300(WizardDescriptor.java:130)
at org.openide.WizardDescriptor$Listener.actionPerformed(WizardDescriptor.java:2125)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
at java.lang.reflect.Method.invoke(Method.java:597)
at org.openide.util.WeakListenerImpl$ProxyListener.invoke(WeakListenerImpl.java:459)
at $Proxy14.actionPerformed(Unknown Source)
at javax.swing.AbstractButton.fireActionPerformed(AbstractButton.java:2028)
at javax.swing.AbstractButton$Handler.actionPerformed(AbstractButton.java:2351)
at javax.swing.DefaultButtonModel.fireActionPerformed(DefaultButtonModel.java:387)
at javax.swing.DefaultButtonModel.setPressed(DefaultButtonModel.java:242)
at javax.swing.plaf.basic.BasicButtonListener.mouseReleased(BasicButtonListener.java:236)
at java.awt.Component.processMouseEvent(Component.java:6348)
at javax.swing.JComponent.processMouseEvent(JComponent.java:3267)
at java.awt.Component.processEvent(Component.java:6113)
at java.awt.Container.processEvent(Container.java:2085)
at java.awt.Component.dispatchEventImpl(Component.java:4714)
at java.awt.Container.dispatchEventImpl(Container.java:2143)
at java.awt.Component.dispatchEvent(Component.java:4544)
at java.awt.LightweightDispatcher.retargetMouseEvent(Container.java:4618)
at java.awt.LightweightDispatcher.processMouseEvent(Container.java:4282)
at java.awt.LightweightDispatcher.dispatchEvent(Container.java:4212)
at java.awt.Container.dispatchEventImpl(Container.java:2129)
at java.awt.Window.dispatchEventImpl(Window.java:2478)
at java.awt.Component.dispatchEvent(Component.java:4544)
[catch] at java.awt.EventQueue.dispatchEvent(EventQueue.java:635)
at org.netbeans.core.TimableEventQueue.dispatchEvent(TimableEventQueue.java:137)
at java.awt.EventDispatchThread.pumpOneEventForFilters(EventDispatchThread.java:296)
at java.awt.EventDispatchThread.pumpEventsForFilter(EventDispatchThread.java:211)
at java.awt.EventDispatchThread.pumpEventsForFilter(EventDispatchThread.java:205)
at java.awt.Dialog$1.run(Dialog.java:1046)
at java.awt.Dialog$3.run(Dialog.java:1098)
at java.security.AccessController.doPrivileged(Native Method)
at java.awt.Dialog.show(Dialog.java:1096)
at org.netbeans.core.windows.services.NbPresenter.superShow(NbPresenter.java:1006)
at org.netbeans.core.windows.services.NbPresenter.doShow(NbPresenter.java:1040)
at org.netbeans.core.windows.services.NbPresenter.run(NbPresenter.java:1028)
at org.netbeans.core.windows.services.NbPresenter.run(NbPresenter.java:121)
at org.openide.util.Mutex.doEventAccess(Mutex.java:1361)
at org.openide.util.Mutex.readAccess(Mutex.java:271)
at org.netbeans.core.windows.services.NbPresenter.show(NbPresenter.java:1013)
at java.awt.Component.show(Component.java:1563)
at java.awt.Component.setVisible(Component.java:1515)
at java.awt.Window.setVisible(Window.java:842)
at java.awt.Dialog.setVisible(Dialog.java:986)
at org.openide.loaders.TemplateWizard.instantiateImpl(TemplateWizard.java:498)
at org.openide.loaders.TemplateWizard.instantiate(TemplateWizard.java:365)
at org.netbeans.modules.project.ui.actions.NewProject$2.run(NewProject.java:139)
at java.awt.event.InvocationEvent.dispatch(InvocationEvent.java:209)
at java.awt.EventQueue.dispatchEvent(EventQueue.java:633)
at org.netbeans.core.TimableEventQueue.dispatchEvent(TimableEventQueue.java:137)
at java.awt.EventDispatchThread.pumpOneEventForFilters(EventDispatchThread.java:296)
at java.awt.EventDispatchThread.pumpEventsForFilter(EventDispatchThread.java:211)
at java.awt.EventDispatchThread.pumpEventsForHierarchy(EventDispatchThread.java:201)
at java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:196)
at java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:188)
at java.awt.EventDispatchThread.run(EventDispatchThread.java:122)
NetBeans 6.9 works nicely here on 10.6.
I would uninstall everything related to Netbeans (throw the installed folders in the Trash and empty it), and then install just 6.9 again.
NetBeans IDE 6.10M1 is not a stable version of NetBeans IDE, this version is released for early access by the community to test it and report bugs to the NetBeans Development team through the NetBeans Issue system. If you have found a bug you should file a bug report and help the developers identify scenarios which they may fix eventually. By old versions do you mean any version before 6.10M1?
If you want to use NetBeans IDE for production you should use the latest stable version of NetBeans IDE that is NetBeans IDE 6.9.1. I am using Snow Leopard on MacBook pro and I am able to create Java Projects as well as NetBeans Platform Project.
Please elaborate your project scenario so more detailed answer can be written. Many a times just deleting the user directory $HOME/.netbeans help in fixing configuration issues
Hope this helps
with regards
Tushar