What does this next error mean?

I run my java program, but when executed it gives me the following error. before it worked fine, but now it throws the following error. I checked my class path, the path in the environment variable is correct.

Exception in thread "main" java.lang.UnsatisfiedLinkError: java.util.zip.ZipFile .open(Ljava/lang/String;IJ)J at java.util.zip.ZipFile.open(Native Method) at java.util.zip.ZipFile.<init>(ZipFile.java:114) at java.util.jar.JarFile.<init>(JarFile.java:135) at java.util.jar.JarFile.<init>(JarFile.java:72) at sun.misc.URLClassPath$JarLoader.getJarFile(URLClassPath.java:646) at sun.misc.URLClassPath$JarLoader.access$600(URLClassPath.java:540) at sun.misc.URLClassPath$JarLoader$1.run(URLClassPath.java:607) at java.security.AccessController.doPrivileged(Native Method) at sun.misc.URLClassPath$JarLoader.ensureOpen(URLClassPath.java:599) at sun.misc.URLClassPath$JarLoader.<init>(URLClassPath.java:583) at sun.misc.URLClassPath$3.run(URLClassPath.java:333) at java.security.AccessController.doPrivileged(Native Method) at sun.misc.URLClassPath.getLoader(URLClassPath.java:322) at sun.misc.URLClassPath.getLoader(URLClassPath.java:299) at sun.misc.URLClassPath.getResource(URLClassPath.java:168) at java.net.URLClassLoader$1.run(URLClassLoader.java:194) at java.security.AccessController.doPrivileged(Native Method) at java.net.URLClassLoader.findClass(URLClassLoader.java:190) at java.lang.ClassLoader.loadClass(ClassLoader.java:307) at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:301) at java.lang.ClassLoader.loadClass(ClassLoader.java:248) Could not find the main class: com.sun.tools.javac.Main. Program will exit. 
+4
source share
4 answers

To clarify @Peter Lawrey's answer ...

The beginning of stacktrace:

 Exception in thread "main" java.lang.UnsatisfiedLinkError: java.util.zip.ZipFile .open(Ljava/lang/String;IJ)J at java.util.zip.ZipFile.open(Native Method) at java.util.zip.ZipFile.<init>(ZipFile.java:114) ... 

UnsatisfiedLinkError is raised when you try to call the native method, which was not allowed by the method in the corresponding native library. The rest of the message tells us that the method has a signature on error:

 long java.util.zip.ZipFile.open(String, int, long) 

and this is the grid with the top stack trace frame ... and the fact that Java ZipFile code is known to use the native library for heavy lifting.

The fact that he got this far means that the JVM found the native library and loaded it. But, apparently, the load did not allow this overload of the native open method. This can only mean one thing: the version of the ZipFile class in the bootclasspath does not match the source library.

We cannot draw any definite conclusions about whether it is a JDK or a JRE, but it seems likely that it is a JDK ... unless the OP tries to invoke the Java compiler in a weird way. ("Could not find the main class: message com.sun.tools.javac.Main" probably means that the JVM was unable to load the class ... due to an UnsatisfiedLinkError break.)

In any case, the JDK vs. JRE is not an immediate problem. The real problem is the mismatch between the "rt.jar" in the bootclasspath JVM and the built-in libraries.


The question asks:

how to solve it?

It depends on what exactly you did to get this error.

  • Which team did you execute?
  • What were the command line options and arguments?
  • Did you really mess around with your JRE / JDK installation?
  • Are you trying to use the "rt.jar" file from one installation to another?
+2
source

This means that your rt.jar is for a different version of Java as your JVM.

I would make sure you don't have rt.jar in the path of your boot class, and your JRE is installed correctly.

Could not find main class: com.sun.tools.javac.Main. The program will exit.

When a class does not load due to a low-level error, it reports that the class was not found.

+1
source

The link in the com.sun.tools.javac.Main missing error message makes me think that this is a program that needs to be run using the JDK, not just the JRE.

0
source

your jre path points to the jdk path

Decision:

Step 1: right click the server

Step 2: click Runtime Configuration

Step 3: GIVE the JRE path under the JDK.

Solution fixed

0
source

Source: https://habr.com/ru/post/1443448/


All Articles