I got this error message in the console when I tried to run, I just switched laptops and I've wiped my old one. This project has always been stored in a USB so I use that to run it on my new laptop. (So I had to re-download all the applications), I need this to fix so bad due to its my project for class and I haven't record it and I'm supposed to do that and I don't want to fail the class please could u help thank u:
java.lang.NoClassDefFoundError: com/apple/eawt/QuitHandler
at java.base/java.lang.Class.getDeclaredMethods0(Native Method)
at java.base/java.lang.Class.privateGetDeclaredMethods(Class.java:3119)
at java.base/java.lang.Class.getMethodsRecursive(Class.java:3260)
at java.base/java.lang.Class.getMethod0(Class.java:3246)
at java.base/java.lang.Class.getMethod(Class.java:2065)
at processing.core.PApplet.runSketch(PApplet.java:10751)
at processing.core.PApplet.main(PApplet.java:10548)
at processing.core.PApplet.main(PApplet.java:10530)
at robothead.Robothead.main(Robothead.java:8)
Caused by: java.lang.ClassNotFoundException: com.apple.eawt.QuitHandler
at java.base/jdk.internal.loader.BuiltinClassLoader.loadClass(BuiltinClassLoader.java:582)
at java.base/jdk.internal.loader.ClassLoaders$AppClassLoader.loadClass(ClassLoaders.java:190)
at java.base/java.lang.ClassLoader.loadClass(ClassLoader.java:499)
... 9 more
I at first download JDK 10 and I read it only works with JDK 8 so I download that and delete JDK 10 in hopes that stuff will return back to normal and it does not works. Also the project, I did it in java oxygen and I downloaded photon on my new laptop and click on the yes I want to convert the files thing so I decided to make a new workspace and copy paste the code but still got that error?Before it was MacBook Air and I switch to the MacBook Pro.
You are mixing up a lot of things.
The basic problem is that starting with Java 9 oracle made changes that lead to such errors ( see https://docs.oracle.com/javase/9/migrate/toc.htm#JSMIG-GUID-C86F7403-7D7C-456F-8873-18C7F1BEDE2F).
So, in order to get this to work, you have to ensure that Java 8 is used. And that your Java 10 installation was really, fully removed. You should then check your eclipse settings to also ensure that it is pointing to Java 8.
Related
I have a Java desktop application that was running fine in Java 1.8; I'm upgrading to Java 1.11 for a client, and am getting the above error.
Full stacktrace:
java.lang.ExceptionInInitializerError
at net.sourceforge.tess4j.Tesseract.init(Tesseract.java:442)
at net.sourceforge.tess4j.Tesseract.doOCR(Tesseract.java:326)
at net.sourceforge.tess4j.Tesseract.doOCR(Tesseract.java:309)
at net.sourceforge.tess4j.Tesseract.doOCR(Tesseract.java:290)
at net.sourceforge.tess4j.Tesseract.doOCR(Tesseract.java:274)
at drivingrecordtool.file.DrivingRecordPDFTextReader.getOCRText(DrivingRecordPDFTextReader.java:152)
at drivingrecordtool.file.DrivingRecordPDFTextReader.getText(DrivingRecordPDFTextReader.java:46)
at drivingrecordtool.file.DrivingRecordFileReader.doInBackground(DrivingRecordFileReader.java:78)
at drivingrecordtool.file.DrivingRecordFileReader.doInBackground(DrivingRecordFileReader.java:1)
at java.desktop/javax.swing.SwingWorker$1.call(SwingWorker.java:304)
at java.base/java.util.concurrent.FutureTask.run(FutureTask.java:264)
at java.desktop/javax.swing.SwingWorker.run(SwingWorker.java:343)
at java.base/java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1128)
at java.base/java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:628)
at java.base/java.lang.Thread.run(Thread.java:834)
Caused by: java.lang.IllegalStateException: zip file closed
at java.base/java.util.zip.ZipFile.ensureOpen(ZipFile.java:913)
at java.base/java.util.zip.ZipFile.getEntry(ZipFile.java:348)
at java.base/java.util.zip.ZipFile$1.getEntry(ZipFile.java:1130)
at java.base/java.util.jar.JarFile.getEntry0(JarFile.java:586)
at java.base/java.util.jar.JarFile.getEntry(JarFile.java:516)
at java.base/sun.net.www.protocol.jar.URLJarFile.getEntry(URLJarFile.java:131)
at java.base/java.util.jar.JarFile.getJarEntry(JarFile.java:478)
at java.base/jdk.internal.loader.URLClassPath$JarLoader.getResource(URLClassPath.java:945)
at java.base/jdk.internal.loader.URLClassPath.getResource(URLClassPath.java:315)
at java.base/java.net.URLClassLoader$1.run(URLClassLoader.java:455)
at java.base/java.net.URLClassLoader$1.run(URLClassLoader.java:452)
at java.base/java.security.AccessController.doPrivileged(Native Method)
at java.base/java.net.URLClassLoader.findClass(URLClassLoader.java:451)
at java.base/java.lang.ClassLoader.loadClass(ClassLoader.java:588)
at java.base/java.lang.ClassLoader.loadClass(ClassLoader.java:521)
at net.sourceforge.tess4j.util.LoadLibs.getTessAPIInstance(LoadLibs.java:83)
at net.sourceforge.tess4j.TessAPI.<clinit>(TessAPI.java:42)
... 15 more
The Tesseract library has a Java wrapper that I've used for months successfully but now seems involved in the error, whatever it is. I've been using the same DLL and started getting this failure, and I've updated the Tesseraact DLL and the wrapper to their latest version.
More puzzling is that the application runs fine within eclipse, and only fails like this when run from a command line (Windows 10). I have uninstalled and reinstalled the DLL a couple of times, rebooted the machine each time, and am running out of things to try. I went through the entire Maven dependencies list and deleted all files found there from my repository, then refreshed the eclipse project to reload all the files in the list.
I saw one suggestion of placing a breakpoint in ZipFile, but that won't help since the problem does not appear in eclipse.
I'm willing to upgrade the Java further, but it would be nice, first, to have some knowledge of what the problem is so that I have some confidence that will fix it.
Can someone suggest what might be wrong, or strategies to find out?
Using journey browser project I have set up a simple maven project in eclipse, using the dependency provided on the page, I have tried to run the code example (also provided on the page)
And I get an NPE:
Exception in thread "main" java.lang.ExceptionInInitializerError
at java.base/java.lang.Class.forName0(Native Method)
at java.base/java.lang.Class.forName(Class.java:315)
at java.desktop/java.awt.Toolkit$2.run(Toolkit.java:588)
at java.desktop/java.awt.Toolkit$2.run(Toolkit.java:583)
at java.base/java.security.AccessController.doPrivileged(Native Method)
at java.desktop/java.awt.Toolkit.getDefaultToolkit(Toolkit.java:582)
at java.desktop/java.awt.Toolkit.getEventQueue(Toolkit.java:1494)
at java.desktop/java.awt.EventQueue.isDispatchThread(EventQueue.java:1086)
at java.desktop/javax.swing.SwingUtilities.isEventDispatchThread(SwingUtilities.java:1493)
at com.codebrig.journey.JourneyBrowserView.<init>(JourneyBrowserView.java:78)
at com.codebrig.journey.JourneyBrowserView.<init>(JourneyBrowserView.java:71)
at JourneyBrowser.main(JourneyBrowser.java:13)
Caused by: java.lang.NullPointerException
at java.base/java.lang.ClassLoader.loadLibrary(ClassLoader.java:2646)
at java.base/java.lang.Runtime.loadLibrary0(Runtime.java:830)
at java.base/java.lang.System.loadLibrary(System.java:1870)
at java.desktop/sun.awt.windows.WToolkit$1.run(WToolkit.java:118)
at java.desktop/sun.awt.windows.WToolkit$1.run(WToolkit.java:115)
at java.base/java.security.AccessController.doPrivileged(Native Method)
at java.desktop/sun.awt.windows.WToolkit.loadLibraries(WToolkit.java:114)
at java.desktop/sun.awt.windows.WToolkit.<clinit>(WToolkit.java:129)
... 12 more
Can anyone explain what is happening and why here, I have tried this on 64bit windows with java Coretto 11(jdk11.0.7_10),I initially found a bug here, relating to loadLibray in open JDK and thought that maybe the problem, I just don't have a good enough understanding to work out how to get around it?
I'm not sure, but I think that Corretto bug is probably the one that is causing the problem. As noted, it is from their "upstream"; i.e the OpenJDK codebase. It was due to regression that appeared in jdk11.0.7 due to a backport of a fix for another problem. Apparently, the fix changes some internal JDK fields and that breaks application code. As JDK-8240521 puts it:
The backport of the JDK-8231584 changes internal JDK fields processing. The problem is that the many third-party applications copy-pasted a hack that depends on particular JDK implementation.
If I am reading the Oracle bug entries correctly, the reversion of the broken fix should be in JDK11.0.8. Alternatively, an earlier JDK 11 release than 11.0.7 shouldn't have the broken fix.
Let me know if changing your Java 11 install solves the problem. (If not, I'll see if I can get the line numbers to match up.)
I am encountering a "KeyGenerator not available" error when trying to create a SSL connection using Javax.mail.
The project was functional 3-4 years ago and it was updates to JDK1.8 and to the new JRE. I assume that it's the issue is some fundamental quirk from updating the project.
I've followed everything listed Here.
I added the path from JKD1.8.0_131/jre/lib/ext/sunjce_provider.jar to my project library so that it's both in the JRE library and the project classpath.
java.security.NoSuchAlgorithmException: SunTls12RsaPremasterSecret KeyGenerator not available
at javax.crypto.KeyGenerator.<init>(KeyGenerator.java:169) ~[?:1.8.0_131]
at javax.crypto.KeyGenerator.getInstance(KeyGenerator.java:223) ~[?:1.8.0_131]
at sun.security.ssl.JsseJce.getKeyGenerator(JsseJce.java:251) ~[?:1.8.0_131]
at sun.security.ssl.RSAClientKeyExchange.<init>(RSAClientKeyExchange.java:78) ~[?:1.8.0_131]
.....
I expected the code to create a connection at this point. What can I do to resolve this issue?
not sure why, but this method helped me in eclipse: https://www.codetd.com/en/article/9438315
Preferences -> installed JREs -> Edit your java 8 JRE and 'Restore Defaults'
You should update Java 8 to the current patchlevel anyway, but according to this issue, you will need at least patch level 192 instead of 131. This is an issue for OpenJDK, but for Oracle Java it seems to be the same.
I assume your code was connecting to a server that has been updated to TLS 1.2 since your last usage.
Using R2014b on OS X Yosemite.
Exception in thread "Startup Class Loader" java.lang.UnsatisfiedLinkError: jogamp.common.jvm.JVMUtil.initialize(Ljava/nio/ByteBuffer;)Z
at jogamp.common.jvm.JVMUtil.initialize(Native Method)
at jogamp.common.jvm.JVMUtil.<clinit>(JVMUtil.java:58)
at com.jogamp.common.os.Platform$1.run(Platform.java:212)
at java.security.AccessController.doPrivileged(Native Method)
at com.jogamp.common.os.Platform.<clinit>(Platform.java:179)
at javax.media.opengl.GLProfile.<clinit>(GLProfile.java:83)
at com.mathworks.hg.peer.JavaSceneServerPeer.initializeJOGL(JavaSceneServerPeer.java:114)
at com.mathworks.hg.peer.JavaSceneServerPeer.<clinit>(JavaSceneServerPeer.java:100)
at java.lang.Class.forName0(Native Method)
at java.lang.Class.forName(Class.java:190)
at com.mathworks.mde.desk.StartupClassLoader.loadClass(StartupClassLoader.java:258)
at com.mathworks.mde.desk.StartupClassLoader.access$900(StartupClassLoader.java:25)
at com.mathworks.mde.desk.StartupClassLoader$2.run(StartupClassLoader.java:244)
at java.lang.Thread.run(Thread.java:745)
This pops up the moment I start matlab. I am unable to use imagesc() or imshow() and probably loads of other functions, because matlab crashes with Caught unexpected exception of unknown type. instantly.
I'm at my wits end. The matlab install is fresh, and so is the OS. Same problem using the Java from Apple or the Java from Oracle.
EDIT: Response from MathWorks is that integration with Maple breaks everything. Emptying the .maplerc.sh file in the /bin/ directory fixes everything.
This issue is caused by having installed Matlab integration through maple. A file called .maplerc.sh is placed within the /bin/ folder in the matlab .app, and it apparently breaks everything. You cannot delete the file (this causes matlab to not launch on start up) but you can erase its contents. This will create an error upon launch, but you can ignore it and everything will work fine.
Uninstall matlab and maple, and reinstall maple and matlab without integration will fix the issue entirely.
Replace the contents of the file /Applications/MATLAB_R2014b.app/bin/.maplerc.sh by an empty line (as suggested by the other answer from Dorako), and
Modify the file /Applications/MATLAB_R2014b.app/toolbox/local/matlabrc.m, by searching for Maple in this text file and comment-out or remove the part between the two lines containing %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%.
The second step ensures that there is no error or warning message any more on startup, so that re-installing the programs is not necessary.
With InterClient 7.5.1 and 8.1.5, the creation of a new JDBC connection in Java 8 fails with
java.lang.NoClassDefFoundError: sun/io/ByteToCharConverter
This class seems to be referenced or used by the InterClient JDBC library.
The error does not occur with Java 7. Is there a way to work around this error?
This code reproduces the problem on Java 8:
package com.example.so25365952;
import java.sql.DriverManager;
import java.sql.SQLException;
import java.util.logging.Level;
import java.util.logging.Logger;
public class Main {
interbase.interclient.Connection conn;
public static void main(String[] args) {
try {
Class.forName("interbase.interclient.Driver");
DriverManager.getConnection("jdbc:interbase://localhost/data/mydb.gdb", "sysdba", "password123");
} catch (ClassNotFoundException | SQLException ex) {
Logger.getLogger(Main.class.getName()).log(Level.SEVERE, null, ex);
}
}
}
Output:
Exception in thread "main" java.lang.NoClassDefFoundError:
sun/io/ByteToCharConverter at
interbase.interclient.Connection.connect(Unknown Source) at
interbase.interclient.Connection.(Unknown Source) at
interbase.interclient.Driver.connect(Unknown Source) at
java.sql.DriverManager.getConnection(DriverManager.java:664) at
java.sql.DriverManager.getConnection(DriverManager.java:247) at
com.example.so25365952.Main.main(Main.java:14) Caused by:
java.lang.ClassNotFoundException: sun.io.ByteToCharConverter at
java.net.URLClassLoader$1.run(URLClassLoader.java:372) at
java.net.URLClassLoader$1.run(URLClassLoader.java:361) at
java.security.AccessController.doPrivileged(Native Method) at
java.net.URLClassLoader.findClass(URLClassLoader.java:360) at
java.lang.ClassLoader.loadClass(ClassLoader.java:424) at
sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:308) at
java.lang.ClassLoader.loadClass(ClassLoader.java:357) ... 6 more
Use db2jcc4.jar which is latest version. If you changed your mind to use Java 8 you need to use this.
I have the similiar problem and this change help me to fix the error.
The sun.* and sunw.* packages are internal and should not be used for exactly this reason. Seems like someone at InterClient screwed up. I'd advise you to contact them with a bug report, so they'll know to fix this for future releases.
If you can't wait for a future release, and are willing to break some licences (which I don't recommend of course). You may be able to create your own sun.io.ByteToCharConverter by copying the code from here, and adding it to the bootstrap classpath with -Xbootclasspath, but that would be a last resort.
sun.io.ByteToCharConvertor was deprecated in java 7. and it seems they remove it in java 8.
The answer to the question interbase.interclient.UnlicensedComponentException with the latest interclient.jar IB (v7.5.80) seems to work for me too. It suggests to use version 1.5 of the JDBC driver for Firebird. Fortunately this driver does not rely on deprecated sun classes and works with JRE 8.
I agree with Sergio, this is now an even older question! :-) But at my workplace, too, we are unfortunately as of 2018 for various reasons still using a super-old Interbase (v9, 2009). So at some point I too was unable to continue using the interclient.jar packaged with IBv9, because I would receive this same sun.io.ByteToCharConverter error. No doubt this was because the Java on my client machine was so much newer now. After all, it is 9 years later. But I did not want in my case to go with the solution of installing a legacy Java on my machine, as has worked for others.
So as a solution, on my client machine (Linux/Debian x64), I installed Interbase 2017, the latest at the time(*). But when installing, I only installed the IB Client (not Server + Client). The /opt/interbase/lib/interclient.jar that is packaged with the IB 2017 client works just fine now (no sun.io error). And yes, this IB 2017 (v13) interclient.jar works just fine connecting to our old IB 2009 server.
(I have to hand it to Embarcadero: They are still 'supporting' being able to connect to older versions -- at least in their interclient.jar and libgds.so. This makes sense as useful of course for those sysadmins who want to migrate from older systems to newer ones.)
(*) You can get a free trial version of Interbase from embarcadero. As far as I can tell, though, when you install it, if you install the Client only and use the interclient.jar, this does not require a license. Only installing the IB server (and depending on number of users/connections, etc) but that is nothing new to IB users/admins.
Works for us, at least, until we upgrade our server's IB version, or move to Firebird.
Hope this helps at least one other person out there.
This is an old question, but in case this helps someone:
Find the Java 7 rt.jar in the lib folder.
Open the file, and go to the folder sun/io.
Find the Java 8 rt.jar in the lib folder.
Open the file, and go to the folder sun/io.
Move all the .class files in the folder sun/io from the Java 7 to the Java 8 sun/io folder, except for Win32ErrorMode.class (this class was in both jar files).
Save the Java 8 rt.jar with the added classes.
This worked for me, using an old jdbc driver for SQL Server.
use
<!-- https://mvnrepository.com/artifact/com.ibm.db2.jcc/db2jcc -->
<dependency>
<groupId>com.ibm.db2.jcc</groupId>
<artifactId>db2jcc</artifactId>
<version>db2jcc4</version>
</dependency>
replace
<dependency>
<groupId>com.ibm.db2.jcc</groupId>
<artifactId>db2jcc</artifactId>
<version>10.1</version>
</dependency>
can Solve the problem