Christopher Rucinski
Christopher Rucinski

Reputation: 4867

Unsupported Java Version: Cannot start under Java 1.7: Java 1.8 or later is required

I just updated to IntelliJ IDEA 16 which comes with Java JDK 1.8. Fyi, I had downloaded Java JDK 1.8 a long time ago.

I tried to run my plugin that I am developing, and I cannot even do that, I get the following error message (slightly condensed)

"C:\Program Files\Java\jdk1.7.0_45\bin\java" -Xmx512m -Xms256m -XX:MaxPermSize=250m -ea "-Xbootclasspath/a:C:/Program Files (x86)/JetBrains/IntelliJ IDEA Community Edition 144.3143.6\lib\boot.jar" -Didea.config.path=C:\Users\Christopher.IdeaIC14\system\plugins-sandbox\config - ... -Dfile.encoding=windows-1252 -classpath "C:\Program Files\Java\jdk1.7.0_45\lib\tools.jar; ... ;C:\Program Files (x86)\JetBrains\IntelliJ IDEA Community Edition 144.3143.6\lib\idea_rt.jar" com.intellij.rt.execution.application.AppMain com.intellij.idea.Main

Unsupported Java Version: Cannot start under Java 1.7.0_45-b18: Java 1.8 or later is required.

So, I clearly know what the problem is; however, I cannot seem to figure out where the location to fix this is.

I have tried a lot of things so far; most involve using the search box in Settings and switching whatever I could to version 1.8. Also, I had updated my Environment Variable for Java from 1.6 to 1.8

With all of these changes, nothing is working! So how do I go about fixing this seemingly simple issue?

Upvotes: 13

Views: 42094

Answers (13)

Kaushik Moralwar
Kaushik Moralwar

Reputation: 1

Under pom.xml file you have to update the java version you are using from 1.7 to 1.8 or whichever you are using

<maven. compiler. source>1.8</maven. compiler. source>
<maven.compiler.target>1.8</maven.compiler.target>

Upvotes: 0

In my case, Ubuntu 14 (32-bit), I opened the file:

/home/<user>/Programs/PhpStorm/bin/phpstorm.sh

and after

if [ "$JDK" = "" ] && [ "$OS_TYPE" = "Linux" ] && ........... fi 

I added:

if [ "$JDK" = "" ]; then
    JDK="/usr/lib/jvm/java-8-oracle"
fi

And then it works!

Upvotes: 1

Dimmduh
Dimmduh

Reputation: 843

Run in cmd

setx JAVA_HOME "C:\Program Files\Java\jdk1.8.0_111"

don't foget to change to your java path

Upvotes: 1

Israelm
Israelm

Reputation: 1675

Just set JAVA_HOME system variable to your JDK 8:

enter image description here

Upvotes: 1

Fran Matsusaka
Fran Matsusaka

Reputation: 1

I had the same problem. All paths pointing to java jdk 8, but still throwing the error. I was able to run Android Studio by running the "studio64.exe" instead "studio.exe" in the bin folder

Upvotes: 0

ccpizza
ccpizza

Reputation: 31666

Apart from setting the correct Java version for the global, per project and per module SDK, for the Java Compiler, and for the language level, you also must set the Target bytecode version both for the project and (if you use maven) for each maven module.

Often the project bytecode version is correct but the module bytecode version is lower, i.e. 1.5.

Intellij Idea: target bytecode version for maven module

The per-module bytecode version is not displayed when opening the default preferences via File > Other Settings > Default Settings. You must edit the current preferences either via a shortcut (i.e. +,) or from the main menu as shown below (for mac):

Intellij Idea current preferences

Upvotes: 0

Andreas DM
Andreas DM

Reputation: 10998

Under Arch Linux you can simply set java 8 as default (you must have it installed):

$ sudo archlinux-java set java-8-openjdk

Upvotes: 4

Pierre-Luc Paour
Pierre-Luc Paour

Reputation: 1755

Just in case this page needs one more recommendation, I fixed the problem in my case by going to the IDE's config folder (as @Nate puts it, see here for how to locate it), and deleting the idea.jdk file (which held a reference to a 1.6 VM).

Upvotes: 0

Srujan Kumar Gulla
Srujan Kumar Gulla

Reputation: 5841

TL;DR --> Set JAVA_HOME to C:\Program Files\Java\jdk1.8.0_51

Java 8 is required to run IntelliJ IDEA starting from version 16 on all the supported platforms.

The actual JDK version used by the IDE can be verified in Help | About dialog (open any project to access the menu).

idea64.exe uses this JDK search in the following sequence:

IDEA_JDK_64 environment variable
..\jre64 directory
system Registry
JDK_HOME environment variable
JAVA_HOME environment variable

Upvotes: 12

Nate
Nate

Reputation: 1482

In case anyone arrives here and hasn't had any luck with the other solutions, try this. I'm using PhpStorm under OSX, but the steps are probably applicable to JetBrains' other IDEs too:

  1. Navigate to your IDE's config folder (see this article to learn how to find this folder's location).
  2. Open the idea.propeties file.
  3. If a JVMVersion attribute exists, delete that entire entry. If it doesn't exist, then this probably won't be of much help!
  4. Save the file.
  5. Launch your IDE.

Upvotes: 3

jwenting
jwenting

Reputation: 5663

IntelliJ 16 REQUIRES Java 8 to run, it won't run under Java 7. It's compiled to Java 8 classes so it can't ever be run on an older JVM.
This is well and clearly mentioned in the documentation.

So if you have your system JVM be an older one, it will fail to start unless you coerce it into using a non-default JVM.
Possibly you have some java related executables left over in your Windows/System32 directory, where some older Java installers would drop them. Delete these by hand from the file system and see what happens.

Upvotes: 0

Leet-Falcon
Leet-Falcon

Reputation: 2137

Set IDEA_JDK (or IDEA_JDK_64) environment variable.
Check Selecting the JDK version the IDE will run under

Upvotes: 31

OttavioMonzione
OttavioMonzione

Reputation: 123

Double check that your JAVA_HOME points to the correct 1.8 Installation and make sure that in the PATH env there is no reference to "C:\Program Files\Java\jdk1.7.0_45\bin". Try to print your JAVA_HOME/PATH from the Console and see what the output is. If your changes are not reflected logout and then login again.

Upvotes: 0

Related Questions