IntelliJ not recognising JDK version - java

I have write one java project on IntelliJ idea 8.1.1.When I go to compile option of IntelliJ IDEA 8.1.1 then it shows pop-up message box, in that it shows error-
cannot determine version for JDK
Update JDK configuration.
Even though I have proper JDK version, I have jdk1.5.0 installed in my PC working properly with other environment.
Please suggest any settings that I may need to change.

I got this same error message just recently in IntelliJ IDEA 9.0.4. "Cannot Detect JDK Version", "Probably JDK installed in C:\Program Files\Java\jdk1.6.0_24 is corrupt."
I was able to solve it by removing the JDK from Project Structure | SDKs and then re-adding it.

What is the output of the "java -version" for this JDK installation? It could be that the output contains some non-standard strings before the actual version information. Such strings can be added by the environment variables on your system. IDEA may not be able to parse this output and detect the JDK version correctly.

Related

Intellij IDEA is not able to detect jdk what to do?

I have recently moved from windows to ubuntu-22.04 and it is a bit confusing.
I have installed intellij IDEA, after installing java and jdk, but still intellij is not able to detect the jdk version installed in my pc.intellij not detecting jdk
The path of installed java is also set but still it is not working in intellij.Path of installed java. what should I do, I am not able to use intellij IDEA for java programming.
I have tried setting up the path in .bashrc file but still there is no change in intellij IDEA.
.bashrc file.
From the screen of your first screenshot, Click "Download JDK", then select the version you need.
What you might already have installed is the Java Runtime

java version in not match for eclipse

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.

The type java.util.Comparator cannot be resolved

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

Error: jdk1.7 or higher needed to run Google plugin for eclipse

I have been trying to make this work all day long but there seems to be no end to my frustration. I want to use Google App Engine for my android application. I have downloaded the jdk 1.7 u51 but still whenever i start the eclipse ADT, a dialog box appears saying that jdk 1.6 is in use; jdk 1.7 or higher needs to be installed. I have set the path in the preference to jre inside the jdk 1.7. Also, the app engine SDK path shows the error "Failed to initialize App Engine SDk[path]". I have referred all the threads here and over the internet relating to this issue and have tried all the proposed solutions but to no avail. Any help would be greatly appreciated.
versions
eclipse 4.2(ADT)
JDK 1.7u51
App Engine SDK 1.8.9
Try uninstalling the old java version, and making sure that the latest version is the only one installed. Another problem might be if you have a 64-bit computer, you may have the older version installed to one program files, but Eclipse is looking through the x86 program files and not finding the correct version(or vice-versa). You may also want to set your PATH and CLASSPATH.
Type
java -version
javac -version
into the command prompt, and it will return with what Java you have installed.
If all else fails, try reading https://developers.google.com/appengine/docs/java/gettingstarted/installing for more information and see what went wrong.
You must have matching architecture for Eclipse and JDK. If you are using 32-bit eclipse, then use 32-bit JDK else use 64-bit versions of both.
Everything else will fall in place automatically
I am using Indigo and found this forum thread to do the trick.
To your eclipse.ini file add
-vm
/Library/Java/JavaVirtualMachines/jdk1.7.0_WHATEVERTHESUFFIXIS/Contents/Home/jre/lib/server/libjvm.dylib
Note the suffix "lib/server/libjvm.dylib" which is not what you use for later versions of Eclipse. (For them you link to "bin/java".) This needs to be above any "-vmargs" flags in eclipse.ini.

Unable to run Java Applications in Eclipse [duplicate]

I'm trying to get started with Eclipse/Java/Scala on a MacBook. The installed JDK was 1.5. The SDT plugin for Scala requires 1.6 which was included in an OS update, but I also manually installed a package from Apple to update 1.6.
The problem is that I cannot run anything from Eclipse. I always get the following error:
An internal error occurred during: "Launching TestFooBasicTest".
Could not initialize class com.ibm.icu.impl.JavaTimeZone
I also tried to use the old 1.5 version, but to no avail.
What is going wrong here?
I had the same problem trying to run a scala program with Ubuntu 10.4 and stock eclipse (Galileo 3.5.2) and java (java-6-openJdk ) - and the scala pluging downloaded from scala site, of course. I fixed it by manually changing /usr/lib/eclipse/plugins/com.ibm.icu_4.0.1.v20100125.jar as suggested in this thread (btw I discovered that Emacs can change a jar file in place: nice):
http://www.eclipse.org/forums/index.php?t=msg&goto=488654
It's caused by ubuntu openjdk package with broken symbol links for TimeZone configuration. The best solution from forum thread is,
Reinstalling tzdata-java was the fix for me:
sudo apt-get --reinstall install tzdata-java
The problem is:
An internal error occurred during: "Launching TestFooBasicTest". Could not initialize class com.ibm.icu.impl.JavaTimeZone
A quick google search reveals that this class belongs to the IBM Globalization package ICU. http://www-01.ibm.com/software/globalization/icu/index.jsp
A guess would be that this is a package used internally by Scala that you have not installed properly, causing Scala startup to fail.
Make sure that you set java 1.6 in the run configuration (Run/Run configurations).
Did you upgrade to Snow Leopard? Are you using the Eclipse SWT/Carbon or the Eclipse SWT/Cocoa? I was seeing some strangeness with Eclipse after I upgraded to SL. Switching to the Eclipse SWT/Cocoa from Eclipse SWT/Carbon helped. Also restoring my 1.5 VM, which the SL install removes in a sneaky way(by deleting and leaving the symbolic link pointing to 1.6), helped me fix several issues with Java code that had natives(i.e. usb-serial port code).
Check what are the JVMs that Eclipse is aware of and where they are located (Preferences -> Java -> Installed JRE), and also check the run/debug configuration of your programs. By default, Eclipse knows about the JRE that was used to launch itself, and other JREs that you add manually. However, if you upgrade some components and the JREs changed, Eclipse can get "confused" about them.
I had this same issue with Eclipse on Windows. I tried a number of different things including a new hello world program in a new workspace. I finally got this to work by pointing Eclipse to a different JRE to execute with. I know that Apple provides the JRE for Mac, but it does seem like this issue is related to Eclipse having trouble with the JRE used to run Eclipse itself. See here for configuring which VM Eclipse executes with.

Categories