I'm doing a project in IntelliJ with GlassFish and it throws this error:
GlassFish requires Java SE version 6. Your JDK is version 0.
I ran the glassfish4/bin/asadmin start-domain command in a terminal but still get the same error.
I do have Java SE installed, SDK version 8u152 (I checked on Java Panel). Also, I don't know why it searches for jdk 9.
For me java home was good, the only issue was that the version was not matching up.
Open “glassfish -> config -> asenv.conf”.
Add the line AS_JAVA=PATH_TO_YOUR_JDK_DIRECTORY
The only stuff needs to be kept in mind is AS_JAVA=PATH_TO_YOUR_JDK_DIRECTORY should exactly match with the jdk version you mentioned in your intellij.
Now ->
C:\Program Files\Java\jdk1.8.0_40 is mentioned in intellij... file-> SDK's
set AS_JAVA=C:\Program Files\Java\jdk1.8.0_40 is mentioned in glassfish -> config -> asenv.conf
Which me, open asenv.conf in PATH_TO_YOUR_GLASSFISH/glassfish/config folder, go to end of lines and add set AS_JAVA=/PATH_TO_YOUR_JAVA/Java/JavaVirtualMachines/jdk-YOUR-VERSION.jdk
I tried all these approaches and none worked for me.
All answers talk about going to folder PATH_TO_YOUR_GLASSFISH/glassfish/config and then editing asenv.conf.
Editing that file didn't have have any effect.
I did go to that folder but ended up editing asenv.bat.
I literally added this to the end: set AS_JAVA=../../../../Program Files/Java/jdk1.8.0_261
The generic instruction would be: set AS_JAVA=PATH_TO_YOUR_JDK
Note: the asenv.conf file has quotes around values, asenv.bat does not.
I finally tracked the answer down from this question:
How do I specify the JDK for a GlassFish domain?
Go to folder '..\GlassFish-4.1.2\glassfish4\glassfish\config'.
Open in Notepad: asenv.bat
Add in end row:
set AS_JAVA=....\Java\jdk1.8.0_291
In my case, the issue was completely unrelated to IntelliJ setup and JAVA_HOME was pointing to correct path (version 1.8).
Despite that, runtime of java version 9 was actually used, so I uninstalled JRE 9.
Left JDK9, since removing the runtime was enough as a quick fix.
Related
Hello yesterday I updated my IntelliJ ide to the latest version (2020.3.2). The problem is that it's not starting anymore. When I try to open it, I get this error message:
I have two JDKs, 8 and 12
It seems like InteliJ does some kind of lookup by alphabetical order because when I rename my jdk 8 to other name that goes after the "jdk-12..." it actually works
The problem is that have to rename the folders and then return the original names to make my projects work, is there a way to avoid this renaming? Thanks a lot
This IntelliJ IDEA version requires Java 11 to run.
You override default bundled JetBrains Runtime with Java 8.
The solution is to remove this override. It's either idea.jdk file in the configuration directory or an environment variable as described in this document:
~/Library/Application Support/JetBrains/IntelliJIdea2020.3/idea.jdk
Note that JDK used to run IntelliJ IDEA itself is not related to the JDK that you are using to build and run your own projects. These two can be different.
I bumped into this issue with my PyCharm. In that case, pycharm.jdk was the one we need to remove.
~/Library/Application Support/JetBrains/PyCharm2020.3$ mv pycharm.jdk /tmp
Hope it helps someone came here by google.
I am trying to migrate my Springboot projects from Java 8 to Java 11 although I'm having issues first on updating the installed jre of my STS. Since java 11 doesn't have any separate jre, unlike the previous versions, I was trying to include the jdk 11. Although as you can see on the bottom photo, it does not seem to locate the jrt-fs.jar file.
I've also tried to configure the SpringToolSuite4.ini file by including these lines:
-vm
C:\Program Files\Java\jdk-11.0.7\bin\javaw.exe
This is how my .ini file looks like:
Although nothing still happens. Anyone who has other pieces of advice on where I should check? Thank you in advance!
In the preference for configuring the JREs you should select the JDK folder itself, not the lib nor the bin folder. Eclipse will find all the necessary files and libraries that are included in that JDK and can deal with JDKs >= 11.
Please note that this preference is different from the VM that you specify in your ini file. The VM in the ini file is used to run the IDE itself, not to compile your projects against or run them. It is a totally separate thing, which allows you to run your IDE on JDK11 (for example), whereas at the same time you can implement and run projects on JDK8 or JDK14 (or whatever).
You are adding the lib/ dir instead of bin/.
Don't forget to add bin/ to the %Path% environment variable.
Make sure you don't have duplicates from earlier versions of the jdk/jre.
Sorry, you are adding the jdk instead of the jre that is expected:
https://www.java.com/de/download/help/download_options.xml
I had java version 8 previous and my eclipse worked just fine. But now I have java version 7 and I can't open eclipse on my computer. What should I do? please help.
I think there are two options:
Upgrade to Java version 8 (or newer).
If you can't do that, downgrade to a version of eclipse that supports Java 7. eclipse 4.5 (Mars) (or earlier as noted on the linked page), as of eclipse 4.6 (Neon) Java 8 is required.
I feel I should note that newer versions of Java (and eclipse) can still target Java 7 (and many earlier versions).
But now I have java version 7 and I can't open eclipse on my computer. What should I do?
Use versions that work together. When you for example look at your second screen shot, it says something like "requiredJavaVersion=1.8" or so.
In other words: you can't just come in and run eclipse with any version of java.
The other answer gives you the required details.
And a final note here: in case you tried to start eclipse with that older JVM in order to "allow" to ensure that eclipse won't allow "java 8" stuff in a project: that isn't the right way then. Instead: eclipse allows you to "define" JDKs to be used for your project. So you can easily tell eclipse: "I have a Java7 jdk sitting here, please use that for project X".
You do not need to run eclipse itself with a Java7 JVM in order to use a Java7 JDK for an eclipse project!
There will be a file under the Eclipse installation directory named as eclipse.ini.
It will launch the eclipse for that specific jdf and you can change the path to your jdk7.
Hope it helps.
It depends basically on which version of the eclipse you have.
If you have eclipse 4.6(Neon) or the latest version, then you must need a newer JDK version of Java (>=1.8 which you need to download). Or If you want to roll back to an older version of Eclipse then consider downloading eclipse 4.5(Mars).
Or If you have an eclipse version of 4.5(Mars) or older then see in eclipse.ini
-Dosgi.requiredJavaVersion = 1.8 and change it to -Dosgi.requiredJavaVersion = 1.7 which can be found in the folder containing eclipse.exe file.
I have downloaded Eclipse and tried to create a sample servlet program but I got following error
The type java.io.ObjectInputStream cannot be resolved. It is indirectly referenced from required .class files
I have configured build path correctly.
I am using Java 8 and Apache Tomcat 7 and libraries for both are referenced correctly.
Problem is specifically for Java EE only. Ordinarily Java SE projects are running fine.
Something happened in Java 8 Update 91 that broke existing JSP code. That seems pretty clear. Here is a sample of similar questions and bug reports:
Unable to compile JSP file with JDK1.8.0_92
Spring MVC - Unable to compile class for JSP
Unable to access CloudPlatform Client
https://bugs.openjdk.java.net/browse/JDK-8155588 (closed as "not an issue")
https://bugs.openjdk.java.net/browse/JDK-8155223 (closed as "not an issue")
https://access.redhat.com/solutions/2294701
https://alluxio.atlassian.net/browse/ALLUXIO-1956
https://jira.atlassian.com/browse/CWD-4729
https://community.exoplatform.com/portal/intranet/forum/topic/topic991e097d9e45345236bb2bd1920a4c68
https://issues.apache.org/jira/browse/OOZIE-2533 (from a comment: "This is really looking like a JDK bug")
https://bugzilla.redhat.com/show_bug.cgi?id=1337940 (comment 2 mentions the change to java.io.ObjectInputStream in Update 91 that "made it incompatible with RHEL6's current ECJ version")
https://github.com/mit-cml/appinventor-sources/issues/814
https://community.oracle.com/thread/3953395
All these are about problems with Java 8 Update 91 (or later) that are not present when using earlier JRE/JDK versions.
The following OpenJDK changeset from 22 January 2016 appears to be related: http://hg.openjdk.java.net/jdk8u/jdk8u/jdk/rev/32f64c19b5fb (commit message "8144430: Improve JMX connections"). The changeset seems to be related to this vulnerability, https://cve.mitre.org/cgi-bin/cvename.cgi?name=CVE-2016-3427, which is mentioned in a comment to this Red Hat bug report, https://bugzilla.redhat.com/show_bug.cgi?id=1336481.
The Update 91 release notes document mentions JDK-8144430 (non-public ticket): http://www.oracle.com/technetwork/java/javase/8u91-relnotes-2949462.html.
In "Oracle Critical Patch Update Advisory - April 2016", the CVE-2016-3427 vulnerability is mentioned: http://www.oracle.com/technetwork/security-advisory/cpuapr2016v3-2985753.html.
You simply need to upgrade your Tomcat version, to Tomcat 8.0.xx.
Java8 <-> Tomcat8
This is the configuration that I have been using and it has always worked out well
same problem with me. This is not a solution but a workaround, which worked for me:
Buildpath->Configure buildpath->Libraries-> Here remove the JRE system library pointing to JRE8 and add JRE system library for JRE7.
Using the latest 7.x Tomcat (currently 7.0.69) solved the problem for me.
We did also try a workaround in a old eclipse bug, maybe that did it's part to solve the problem, too?
https://bugs.eclipse.org/bugs/show_bug.cgi?id=67414
Workaround:
Window->Preferences->Java->Installed JREs
Uncheck selected JRE
Click OK (this step may be optional?)
Check JRE again
Okay, this question was a year ago but I recently got this problem as well.
So what I did :
Update tomcat 7 to tomcat 8.
Update to the latest java (java 1.8.0_141).
Update the JRE System Library in Project > Properties > Java Build Path.
Make sure it has the latest version which in my case is jre1.8.0_141
(before it was the previous version jre1.8.0_111)
When I did the first two steps it still doesn't remove the error so the last step is important. It didn't automatically change the build path for jre.
Reason :
Old versions of Tomcat 6 JSP compiler don't seem to be aware of JDK 8 constant pool enhancements - eg. method handles. New code in JDK 8u is using a method handle instead of creating an anonymous class. This will cause the method handle to be listed in the constant pool and the eclipse compiler will choke on this - https://bz.apache.org/bugzilla/show_bug.cgi?id=56613
Workaround:
Window -> Preferences -> Java -> Installed JREs,
select a different JRE
maybe this JDK edition is not suitable:
So try this one instead:
Problem solved!
Upgrading to tomcat 7.0.70 resolved the issue for me
I am using Google appengine java sdk and was facing similar issue. I had to add
<runtime>java8</runtime>
in appengine-web.xml file to make it work.
I was also facing same issue. I had Jdk1.7.0.79. Then I updated it with Jdk8.0.120. Then the problem solved. After successful completion of upgraded jdk. Go to project->clean. It will rebuild the project and all red alert will be eliminated.
The type java.util.Comparator cannot be resolved. It is indirectly referenced from required .class files
I recently installed Java 8. While executing an application, I got above mentioned error can you please help me.
I am using:
Java - jdk1.8.0_51
Tomcat - apache-tomcat-5.5.26
Assuming you are using some IDE, like Eclipse. When you are using jdk 1.8 with IDE, you need to update your IDE to support version 1.8.
It does not matter you are using new jdk's feature or not, but compiler has to load new JRE files in order to compile your project.
If you are using IntelliJ, go to:
File/Settings/Build, Execution, Deployment/Compiler/Java Compiler
and make sure "Use compiler" and "Project bytecode version" have the right configuration.
I had this same error and tried many things to fix it, but finally worked was remarkably simple: It turns that I was simply using an older version of Eclipse that did not support a "Compliance Level" setting of Java that was as high as my JRE. I merely upgraded to a newer version and the problem went away.
From what I understand about "Compliance Level", it's the version of Java that your program is supposed to work on. That much I found out from reading stuff on the net. But what the other solutions did not mention is that your IDE has to be able to be set to a level as high as your JRE. In my case, I was using JRE 1.8, but the highest compliance level my older IDE supported was 1.6.
IMO, this situation should have been flagged as an error by Eclipse. But as it was, I wasted two nights trying to figure this out.
Your project build path could be referring to a jre instead of JDK.
Go to your build path. (In eclipse right click and choose build path).
Go to your libraries and replace the jre with the jdk.
pom.xml version is 1.6?
If this is the way,you would replace jdk1.8 with jdk1.6 ,and environment variable into jdk1.6。
Same strange problem occurred. It turned out that wrong jdk version was in JAVA_HOME
There you are I had the same issue but moment I saw your question i got it fixed. problem is you are not using old version since there is mismatch of referencing with new version. this error will come.
Work around:
1. Change your java version to old.(In my case I had to change to 7)
2. Update each libray and jar file compatible to java 8 that way it will refer java not class file
Here is the image of environment variable in my problem
check if build path is set to run with JDK. It is important point that JKD is software development kit while JRE is a runtime env. Advice who had this problem see the different between JDK, JRE and JVM. https://www.guru99.com/difference-between-jdk-jre-jvm.html