Error: A JNI error has occurred, please check your installation and try again.
Eclipse states: test has been compiled by a more recent version of the Java Runtime (class file version 56.0), this version of the Java Runtime only recognizes class file versions up to 52.0.
I had the problem referenced at this question: "Could not find or load main class" while trying to use JavaFX in Eclipse When using JDK13 and JavaFX13. All solutions pointed to downgrading to Java 8.
I installed Java 8, updated the build path, and it built fine. But now I get the error I am using Eclipse 2019-06 (4.12.0), JavaFX13, and JDK 1.8.0_231.
I researched the answer but the two questions that come didn't help. One was for an IntellJ solution and the other had a package I am unfamiliar with, and the error had to do with that package.
I simply don't know how to correct the build path or dependencies to fix this issue. It appears I need a lower version of the JVM, but cannot seem to locate it. Am I right, or can you please help?
Well, I have dropped back to JDK 8 and the built in JavaFX. Despite my best efforts, I cannot get JDK13 and JavaFX 13 to work without receiving the error "Could not find or load main class" (see link in post). Since there is no solution to that problem yet that works for me, I can bypass my error on this request all together and just use much older packages.
Related
I will be using JavaFX on a project. I am no expert but I did install it once with no major issue or problem.
But I switched to a new computer and after trying to install it doesn't build; at first I got the message that
JavaFX runtime components were missing then got the java.lang.module.FindException: Module javafx.controls not found
and I did check other posts that had the same error as the mentioned above but got no solution to the problem and now the message is
Unrecognized option: --module-path Error: Could not create the Java Virtual Machine. Error: A fatal exception has occurred. Program will exit.
(Please note that I'm using VS Code and no build tools, I am referencing the libraries to use JavaFX)
Path to JavaFX
launch.json configured
JRE path
Environment variables
And I'm really confused with the JRE, SDK and JDK, I installed the SDK using VS Code but I don't know if my environment variables are configured as they should be...
Thanks in advance for the help, since I'm no expert I don't know if this information is enough, I hope it is :)
My suggestion is to use JavaFX of vscode to build the project instead of JavaFX SDK.
I think the main problem is still caused by the environmental settings.
If you must use the JavaFX SDK, put it in a location without spaces, or quote the path when using it. And please read the document in detail.
I had some problems with JRE versions, so I tried to change it using the plugin Choose Runtime. I changed it to Java 1.8.0_112-release-287-b2. Now, when trying to start IntelliJ, i get an unsupported Java version error: Cannot start under Java 1.8.0_112-release-287-b2: Java 11 or later is required. I have tried to modify the runtime path in the ide64.exe.jdk file, but it seems like the old jdk IntelliJ ran on has been deleted. I also tried reinstalling intellij, no luck either. Anyone know how to get back the JDK? do I just download it from oracle and install it in the IdeaIC2020.3\jdks\ folder?
Thanks,
Jakob
I went to the jdks folder and deleted all contents. This fixed the issue. IntelliJ started without a problem.
I recently finished a project in Eclipse and it ran without a problem. Then recently I imported a new assignment to work on for class, but when I did my old project all of a sudden had a x on its icon. I looked through the code, nothing had been changed, but it threw this error in the console:
java.lang.UnsupportedClassVersionError
at java.lang.ClassLoader.defineClass1(Native Method)
at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.loadClass(RemoteTestRunner.java:685)
And others. Is this possibly due to the version of java being used or something else?
An UnsupportedClassVersionError is thrown when you use a higher JDK version to compile than when you try to run the program. For example, you compile Program.java using JDK1.7 but then attempt to run using JDK1.6. I am guessing that upon importing the new assignment for your class, you unknowingly adopted to use the JDK that the imported project was compiled in.
I suggest going to Eclipse Preferences and taking a look at your installed JRE's to make sure everything is okay and also to look at the projects Properties and looking at its Build Path. In general, make you you are using a version to run in that is at LEAST what you used to compile it. If you chose a higher version everything will still be okay.
EDIT:
Here is a link for more information on the matter and where I had originally read about this. I knew I had saved the link somewhere.
http://javarevisited.blogspot.com/2011/07/javalangunsupportedclassversionerror.html
My problem started the other day when I tried to run a jar file that was compiled in java 1.6 from a friend. I then got:
java.lang.NoClassDefFoundError
Since I was only using java 1.5 obviously. So I updated using the system update. This did not help and when I ran:
java -version
in the terminal it still said I had java 1.5. I then saw on the internet that there was an "java SE update 4" on apples download page available. I downloaded and installed this file but it still wouldn't work. I gave up and decided to go back to my programming in eclipse. When I tried to compile and run my application in eclipse I now recieved the same error java.lang.NoClassDefFoundError and it wouldnt let me proceed. I tried right clicking the project and viewing the properties but it wouldnt let me, just gave me another error. I figured I might messed something up when I installed the new java version so I tried reinstalling eclipse but it still gave me the same error. I tried creating a new workspace but that wouldnt help either. I then figured I would try to compile throught the terminal using:
javac main.java
java main
But I still get the same error. I went in under systems settings and diabled "java 1.6" and i tried creating new projects with both javaSE-5 and javaSE-6 but it just wont work. My thoughts now is if it has something to do with eclipse not being able to access the bin & src directories in the project directory but that should work if i reinstalled it? I also saw someone mention setting the classpath in os x but I don't know. I would really need some help solving this issue since a lot of my work rely on eclipse working. I would rather not have to reinstall the whole OS just because of this but if I can't get it to work I guess there is no other alternative.
Best Regards
Jonas Kristensson
"Reinstall the whole OS"? Good lord, no.
Your problems have nothing to do with the version of Java. You don't understand how CLASSPATH works.
The class you were trying to run wasn't on the CLASSPATH. If your friend gave you a JAR, you need to add it to your CLASSPATH and use the fully-resolved class name to run it.
A word of advice for your future mental health: When you have problems, don't assume the worst and jump to extreme measures. Try the simple solutions first.
I tried to run a jar file that was compiled in java 1.6 from a friend. ... Since I was only using java 1.5 obviously
Note that if this was really the case you'd get a java.lang.UnsupportedClassVersionError, since Java 5 can't run classes compiled for Java 6 (it might be able to do so, but the class files say "I'm Java 6+" (class version 50) and thus Java 5 would just refuse to run it (max class version in Java 5 would be 49).
Try to compile with
javac -source 1.5 target 1.5 .....
I have a code taht I am working on that was last worked on some time ago. It was an earlier version of grails (but I am not sure which) and I had to run the grails-upgrade command for it.
Now when I do grails run-app, i get the following:
[groovyc] org.codehaus.groovy.control.MultipleCompilationErrorsException: startup failed, General error during semantic analysis: unable to locate the java compiler com.sun.tools.javac.Main, please change your classloader settings
What does this mean exactly, and how do I fix it? Is it actually a groovy problem? I googled the error message but didnt find much.
Thanks#
The problem was the Java version, and not groovy. The original code was written and compiled with 1.5. I switched the JDK from 1.6 to 1.5 and it worked.