I am trying to change the IDE for IntelliJ, but It keeps running the wrong version












1















I have a class on Software Engineering and we have a gradle project for a sales system. It requires java 8 to operate, which I have installed on my computer. I also have java 9, which I use for anything else besides that class.



I have a very tedious problem that I can't seem to fix: I can't seem to get intelliJ to use java 8.



I've tried the following things:



File - Project structure



Under "Project" - Java 8



Under "Modules" - Everything is set to use Project SDK (1.8)



Under "SDKs" - I only have "1.8" there



Ctrl + Shift + A -> "Switch IDE boot JDK..."



I have 3 options there:




  1. 1.8.0_152 java (b16) [boot]

  2. 1.8.0_152 openjdk (release-1024-b11)[bundled]

  3. 1.8.0_181 java (b13)


I've tried all of those but still nothing.



When I open up the project, it says



C:Program FilesJavajdk1.8.0_181binjava...


In the "Run" Tab down below. However, when I type



java -version


Into the "Terminal" tab, it says



java version "9.0.4"
Java(TM) SE Runtime Environment (build 9.0.4+11)
Java HotSpot(TM) 64-Bit Server VM (build 9.0.4+11, mixed mode)


When I try to execute any gradlew command, for example hsql or run



I get this error:



FAILURE: Build failed with an exception.

* What went wrong:
Could not determine java version from '9.0.4'.

* Try:
Run with --stacktrace option to get the stack trace. Run with --info or --
debug option to get more log output.


I've tried running our main gradle.build file and not running it before trying those commands, but it doesn't make a difference. Our build.gradle file, if it helps anything:



apply plugin: 'java'
apply plugin: 'application'

repositories {
mavenCentral()
}

version = '1.0'

dependencies {
compile project(':')
compile group: 'org.apache.logging.log4j', name: 'log4j-api', version: '2.6.2'
compile group: 'org.apache.logging.log4j', name: 'log4j-core', version: '2.6.2'
}

mainClassName = 'ee.ut.math.tvt.salessystem.ui.SalesSystemUI'

jar {
doFirst {
manifest {
if (!configurations.runtime.isEmpty()) {
attributes('Class-Path': configurations.runtime.collect{it.toURI().toString()}.join(' '))
}
}
}
manifest {
attributes 'Implementation-Title': 'Gradle Quickstart',
'Implementation-Version': version,
'Main-Class': mainClassName
}
}


My other team member doesn't seem to have a problem and can run it nicely. Any help will be REALLY appreciated.










share|improve this question























  • I don't think changing the IntelliJ Java Project version is going to change your terminal version. Run a program and print System.getProperty("java.version"), what does it say?

    – Frzn Flms
    Nov 20 '18 at 19:37











  • If running through Intellij, check your settings in Build, Execution, Deployment > Build Tools > Gradle to make sure Gradle is using the correct JDK. If running through the terminal you can change the used JDK with -Dorg.gradle.java.home=<path>.

    – Slaw
    Nov 20 '18 at 19:42











  • @FrznFlms It prints out 9.0.4

    – Madrus
    Nov 20 '18 at 19:55











  • @Slaw I checked under Build, Execution, Deployment > Build Tools > Gradle and I am using the correct version.

    – Madrus
    Nov 20 '18 at 19:55











  • If worst comes to worst, you could try uninstalling Java 9 and running your program. If any settings were set to use Java 9, they will either switch to Java 8 or IntelliJ will ask you to change them. Once you got that working, you could reinstall Java 9 and cross your fingers IntelliJ doesn't change it back for you.

    – Frzn Flms
    Nov 20 '18 at 20:28
















1















I have a class on Software Engineering and we have a gradle project for a sales system. It requires java 8 to operate, which I have installed on my computer. I also have java 9, which I use for anything else besides that class.



I have a very tedious problem that I can't seem to fix: I can't seem to get intelliJ to use java 8.



I've tried the following things:



File - Project structure



Under "Project" - Java 8



Under "Modules" - Everything is set to use Project SDK (1.8)



Under "SDKs" - I only have "1.8" there



Ctrl + Shift + A -> "Switch IDE boot JDK..."



I have 3 options there:




  1. 1.8.0_152 java (b16) [boot]

  2. 1.8.0_152 openjdk (release-1024-b11)[bundled]

  3. 1.8.0_181 java (b13)


I've tried all of those but still nothing.



When I open up the project, it says



C:Program FilesJavajdk1.8.0_181binjava...


In the "Run" Tab down below. However, when I type



java -version


Into the "Terminal" tab, it says



java version "9.0.4"
Java(TM) SE Runtime Environment (build 9.0.4+11)
Java HotSpot(TM) 64-Bit Server VM (build 9.0.4+11, mixed mode)


When I try to execute any gradlew command, for example hsql or run



I get this error:



FAILURE: Build failed with an exception.

* What went wrong:
Could not determine java version from '9.0.4'.

* Try:
Run with --stacktrace option to get the stack trace. Run with --info or --
debug option to get more log output.


I've tried running our main gradle.build file and not running it before trying those commands, but it doesn't make a difference. Our build.gradle file, if it helps anything:



apply plugin: 'java'
apply plugin: 'application'

repositories {
mavenCentral()
}

version = '1.0'

dependencies {
compile project(':')
compile group: 'org.apache.logging.log4j', name: 'log4j-api', version: '2.6.2'
compile group: 'org.apache.logging.log4j', name: 'log4j-core', version: '2.6.2'
}

mainClassName = 'ee.ut.math.tvt.salessystem.ui.SalesSystemUI'

jar {
doFirst {
manifest {
if (!configurations.runtime.isEmpty()) {
attributes('Class-Path': configurations.runtime.collect{it.toURI().toString()}.join(' '))
}
}
}
manifest {
attributes 'Implementation-Title': 'Gradle Quickstart',
'Implementation-Version': version,
'Main-Class': mainClassName
}
}


My other team member doesn't seem to have a problem and can run it nicely. Any help will be REALLY appreciated.










share|improve this question























  • I don't think changing the IntelliJ Java Project version is going to change your terminal version. Run a program and print System.getProperty("java.version"), what does it say?

    – Frzn Flms
    Nov 20 '18 at 19:37











  • If running through Intellij, check your settings in Build, Execution, Deployment > Build Tools > Gradle to make sure Gradle is using the correct JDK. If running through the terminal you can change the used JDK with -Dorg.gradle.java.home=<path>.

    – Slaw
    Nov 20 '18 at 19:42











  • @FrznFlms It prints out 9.0.4

    – Madrus
    Nov 20 '18 at 19:55











  • @Slaw I checked under Build, Execution, Deployment > Build Tools > Gradle and I am using the correct version.

    – Madrus
    Nov 20 '18 at 19:55











  • If worst comes to worst, you could try uninstalling Java 9 and running your program. If any settings were set to use Java 9, they will either switch to Java 8 or IntelliJ will ask you to change them. Once you got that working, you could reinstall Java 9 and cross your fingers IntelliJ doesn't change it back for you.

    – Frzn Flms
    Nov 20 '18 at 20:28














1












1








1








I have a class on Software Engineering and we have a gradle project for a sales system. It requires java 8 to operate, which I have installed on my computer. I also have java 9, which I use for anything else besides that class.



I have a very tedious problem that I can't seem to fix: I can't seem to get intelliJ to use java 8.



I've tried the following things:



File - Project structure



Under "Project" - Java 8



Under "Modules" - Everything is set to use Project SDK (1.8)



Under "SDKs" - I only have "1.8" there



Ctrl + Shift + A -> "Switch IDE boot JDK..."



I have 3 options there:




  1. 1.8.0_152 java (b16) [boot]

  2. 1.8.0_152 openjdk (release-1024-b11)[bundled]

  3. 1.8.0_181 java (b13)


I've tried all of those but still nothing.



When I open up the project, it says



C:Program FilesJavajdk1.8.0_181binjava...


In the "Run" Tab down below. However, when I type



java -version


Into the "Terminal" tab, it says



java version "9.0.4"
Java(TM) SE Runtime Environment (build 9.0.4+11)
Java HotSpot(TM) 64-Bit Server VM (build 9.0.4+11, mixed mode)


When I try to execute any gradlew command, for example hsql or run



I get this error:



FAILURE: Build failed with an exception.

* What went wrong:
Could not determine java version from '9.0.4'.

* Try:
Run with --stacktrace option to get the stack trace. Run with --info or --
debug option to get more log output.


I've tried running our main gradle.build file and not running it before trying those commands, but it doesn't make a difference. Our build.gradle file, if it helps anything:



apply plugin: 'java'
apply plugin: 'application'

repositories {
mavenCentral()
}

version = '1.0'

dependencies {
compile project(':')
compile group: 'org.apache.logging.log4j', name: 'log4j-api', version: '2.6.2'
compile group: 'org.apache.logging.log4j', name: 'log4j-core', version: '2.6.2'
}

mainClassName = 'ee.ut.math.tvt.salessystem.ui.SalesSystemUI'

jar {
doFirst {
manifest {
if (!configurations.runtime.isEmpty()) {
attributes('Class-Path': configurations.runtime.collect{it.toURI().toString()}.join(' '))
}
}
}
manifest {
attributes 'Implementation-Title': 'Gradle Quickstart',
'Implementation-Version': version,
'Main-Class': mainClassName
}
}


My other team member doesn't seem to have a problem and can run it nicely. Any help will be REALLY appreciated.










share|improve this question














I have a class on Software Engineering and we have a gradle project for a sales system. It requires java 8 to operate, which I have installed on my computer. I also have java 9, which I use for anything else besides that class.



I have a very tedious problem that I can't seem to fix: I can't seem to get intelliJ to use java 8.



I've tried the following things:



File - Project structure



Under "Project" - Java 8



Under "Modules" - Everything is set to use Project SDK (1.8)



Under "SDKs" - I only have "1.8" there



Ctrl + Shift + A -> "Switch IDE boot JDK..."



I have 3 options there:




  1. 1.8.0_152 java (b16) [boot]

  2. 1.8.0_152 openjdk (release-1024-b11)[bundled]

  3. 1.8.0_181 java (b13)


I've tried all of those but still nothing.



When I open up the project, it says



C:Program FilesJavajdk1.8.0_181binjava...


In the "Run" Tab down below. However, when I type



java -version


Into the "Terminal" tab, it says



java version "9.0.4"
Java(TM) SE Runtime Environment (build 9.0.4+11)
Java HotSpot(TM) 64-Bit Server VM (build 9.0.4+11, mixed mode)


When I try to execute any gradlew command, for example hsql or run



I get this error:



FAILURE: Build failed with an exception.

* What went wrong:
Could not determine java version from '9.0.4'.

* Try:
Run with --stacktrace option to get the stack trace. Run with --info or --
debug option to get more log output.


I've tried running our main gradle.build file and not running it before trying those commands, but it doesn't make a difference. Our build.gradle file, if it helps anything:



apply plugin: 'java'
apply plugin: 'application'

repositories {
mavenCentral()
}

version = '1.0'

dependencies {
compile project(':')
compile group: 'org.apache.logging.log4j', name: 'log4j-api', version: '2.6.2'
compile group: 'org.apache.logging.log4j', name: 'log4j-core', version: '2.6.2'
}

mainClassName = 'ee.ut.math.tvt.salessystem.ui.SalesSystemUI'

jar {
doFirst {
manifest {
if (!configurations.runtime.isEmpty()) {
attributes('Class-Path': configurations.runtime.collect{it.toURI().toString()}.join(' '))
}
}
}
manifest {
attributes 'Implementation-Title': 'Gradle Quickstart',
'Implementation-Version': version,
'Main-Class': mainClassName
}
}


My other team member doesn't seem to have a problem and can run it nicely. Any help will be REALLY appreciated.







java gradle intellij-idea






share|improve this question













share|improve this question











share|improve this question




share|improve this question










asked Nov 20 '18 at 19:24









MadrusMadrus

61




61













  • I don't think changing the IntelliJ Java Project version is going to change your terminal version. Run a program and print System.getProperty("java.version"), what does it say?

    – Frzn Flms
    Nov 20 '18 at 19:37











  • If running through Intellij, check your settings in Build, Execution, Deployment > Build Tools > Gradle to make sure Gradle is using the correct JDK. If running through the terminal you can change the used JDK with -Dorg.gradle.java.home=<path>.

    – Slaw
    Nov 20 '18 at 19:42











  • @FrznFlms It prints out 9.0.4

    – Madrus
    Nov 20 '18 at 19:55











  • @Slaw I checked under Build, Execution, Deployment > Build Tools > Gradle and I am using the correct version.

    – Madrus
    Nov 20 '18 at 19:55











  • If worst comes to worst, you could try uninstalling Java 9 and running your program. If any settings were set to use Java 9, they will either switch to Java 8 or IntelliJ will ask you to change them. Once you got that working, you could reinstall Java 9 and cross your fingers IntelliJ doesn't change it back for you.

    – Frzn Flms
    Nov 20 '18 at 20:28



















  • I don't think changing the IntelliJ Java Project version is going to change your terminal version. Run a program and print System.getProperty("java.version"), what does it say?

    – Frzn Flms
    Nov 20 '18 at 19:37











  • If running through Intellij, check your settings in Build, Execution, Deployment > Build Tools > Gradle to make sure Gradle is using the correct JDK. If running through the terminal you can change the used JDK with -Dorg.gradle.java.home=<path>.

    – Slaw
    Nov 20 '18 at 19:42











  • @FrznFlms It prints out 9.0.4

    – Madrus
    Nov 20 '18 at 19:55











  • @Slaw I checked under Build, Execution, Deployment > Build Tools > Gradle and I am using the correct version.

    – Madrus
    Nov 20 '18 at 19:55











  • If worst comes to worst, you could try uninstalling Java 9 and running your program. If any settings were set to use Java 9, they will either switch to Java 8 or IntelliJ will ask you to change them. Once you got that working, you could reinstall Java 9 and cross your fingers IntelliJ doesn't change it back for you.

    – Frzn Flms
    Nov 20 '18 at 20:28

















I don't think changing the IntelliJ Java Project version is going to change your terminal version. Run a program and print System.getProperty("java.version"), what does it say?

– Frzn Flms
Nov 20 '18 at 19:37





I don't think changing the IntelliJ Java Project version is going to change your terminal version. Run a program and print System.getProperty("java.version"), what does it say?

– Frzn Flms
Nov 20 '18 at 19:37













If running through Intellij, check your settings in Build, Execution, Deployment > Build Tools > Gradle to make sure Gradle is using the correct JDK. If running through the terminal you can change the used JDK with -Dorg.gradle.java.home=<path>.

– Slaw
Nov 20 '18 at 19:42





If running through Intellij, check your settings in Build, Execution, Deployment > Build Tools > Gradle to make sure Gradle is using the correct JDK. If running through the terminal you can change the used JDK with -Dorg.gradle.java.home=<path>.

– Slaw
Nov 20 '18 at 19:42













@FrznFlms It prints out 9.0.4

– Madrus
Nov 20 '18 at 19:55





@FrznFlms It prints out 9.0.4

– Madrus
Nov 20 '18 at 19:55













@Slaw I checked under Build, Execution, Deployment > Build Tools > Gradle and I am using the correct version.

– Madrus
Nov 20 '18 at 19:55





@Slaw I checked under Build, Execution, Deployment > Build Tools > Gradle and I am using the correct version.

– Madrus
Nov 20 '18 at 19:55













If worst comes to worst, you could try uninstalling Java 9 and running your program. If any settings were set to use Java 9, they will either switch to Java 8 or IntelliJ will ask you to change them. Once you got that working, you could reinstall Java 9 and cross your fingers IntelliJ doesn't change it back for you.

– Frzn Flms
Nov 20 '18 at 20:28





If worst comes to worst, you could try uninstalling Java 9 and running your program. If any settings were set to use Java 9, they will either switch to Java 8 or IntelliJ will ask you to change them. Once you got that working, you could reinstall Java 9 and cross your fingers IntelliJ doesn't change it back for you.

– Frzn Flms
Nov 20 '18 at 20:28












2 Answers
2






active

oldest

votes


















0














I thik you have to specify Gradle to use the JVM you want.



Go to settings -> Build, Execution, Deployment -> Gradle-> Gradle JVM and choose the JDK you want. (It's pointed in this thread : https://stackoverflow.com/a/43624456/2799066 )



AFAIK giving JVM and command line arguments can also be configurable when importing project to idea.






share|improve this answer
























  • I checked under Build, Execution, Deployment > Build Tools > Gradle and I am using the correct version.

    – Madrus
    Nov 20 '18 at 19:54













  • Ok, then I think it may be issue with your JAVA_HOME environment variable. Check if it's pointing your 9.0.4 installation.

    – Hayrettin MAVIS
    Nov 20 '18 at 20:31











  • I didn't even have a JAVA_HOME environment variable before so I looked it up, craeted it, and restarted my computer. Now it's set to jdk1.8.0_181, however terminal's java -version is still giving me 9.0.4 as the answer.

    – Madrus
    Nov 20 '18 at 20:42











  • @Madrus Glad you solved :)

    – Hayrettin MAVIS
    Nov 20 '18 at 21:51











  • The terminal window in IntelliJ IDEA is independent of any IDE setting. The java command does not look at the JAVA_HOME environment variable; instead, the command shell simply runs the first java executable that is found in the PATH environment variable.

    – Klitos Kyriacou
    Nov 20 '18 at 21:56



















0














I think I got it working.



I clicked File -> New -> Project from existing sources -> Picked the Project folder and that I wish to overwrite it



Then I set up the initial gradle settings that open up when starting a brand new gradle project and voila, terminal now understands gradlew commands.



It's weird, however, that java -version still shows 9.0.4, but well at least everything seems to work now.



Tl;Dr for fix: Create a New project from existing sources and overwrite the current project. Pick the correct java version when asked during the setup.






share|improve this answer
























  • java -version has nothing to do with IntelliJ. It's like typing into the command prompt. You weren't changing your system default jdk, just your JDK that compiles and runs your project.

    – Frzn Flms
    Nov 20 '18 at 21:19











Your Answer






StackExchange.ifUsing("editor", function () {
StackExchange.using("externalEditor", function () {
StackExchange.using("snippets", function () {
StackExchange.snippets.init();
});
});
}, "code-snippets");

StackExchange.ready(function() {
var channelOptions = {
tags: "".split(" "),
id: "1"
};
initTagRenderer("".split(" "), "".split(" "), channelOptions);

StackExchange.using("externalEditor", function() {
// Have to fire editor after snippets, if snippets enabled
if (StackExchange.settings.snippets.snippetsEnabled) {
StackExchange.using("snippets", function() {
createEditor();
});
}
else {
createEditor();
}
});

function createEditor() {
StackExchange.prepareEditor({
heartbeatType: 'answer',
autoActivateHeartbeat: false,
convertImagesToLinks: true,
noModals: true,
showLowRepImageUploadWarning: true,
reputationToPostImages: 10,
bindNavPrevention: true,
postfix: "",
imageUploader: {
brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
allowUrls: true
},
onDemand: true,
discardSelector: ".discard-answer"
,immediatelyShowMarkdownHelp:true
});


}
});














draft saved

draft discarded


















StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f53400143%2fi-am-trying-to-change-the-ide-for-intellij-but-it-keeps-running-the-wrong-versi%23new-answer', 'question_page');
}
);

Post as a guest















Required, but never shown

























2 Answers
2






active

oldest

votes








2 Answers
2






active

oldest

votes









active

oldest

votes






active

oldest

votes









0














I thik you have to specify Gradle to use the JVM you want.



Go to settings -> Build, Execution, Deployment -> Gradle-> Gradle JVM and choose the JDK you want. (It's pointed in this thread : https://stackoverflow.com/a/43624456/2799066 )



AFAIK giving JVM and command line arguments can also be configurable when importing project to idea.






share|improve this answer
























  • I checked under Build, Execution, Deployment > Build Tools > Gradle and I am using the correct version.

    – Madrus
    Nov 20 '18 at 19:54













  • Ok, then I think it may be issue with your JAVA_HOME environment variable. Check if it's pointing your 9.0.4 installation.

    – Hayrettin MAVIS
    Nov 20 '18 at 20:31











  • I didn't even have a JAVA_HOME environment variable before so I looked it up, craeted it, and restarted my computer. Now it's set to jdk1.8.0_181, however terminal's java -version is still giving me 9.0.4 as the answer.

    – Madrus
    Nov 20 '18 at 20:42











  • @Madrus Glad you solved :)

    – Hayrettin MAVIS
    Nov 20 '18 at 21:51











  • The terminal window in IntelliJ IDEA is independent of any IDE setting. The java command does not look at the JAVA_HOME environment variable; instead, the command shell simply runs the first java executable that is found in the PATH environment variable.

    – Klitos Kyriacou
    Nov 20 '18 at 21:56
















0














I thik you have to specify Gradle to use the JVM you want.



Go to settings -> Build, Execution, Deployment -> Gradle-> Gradle JVM and choose the JDK you want. (It's pointed in this thread : https://stackoverflow.com/a/43624456/2799066 )



AFAIK giving JVM and command line arguments can also be configurable when importing project to idea.






share|improve this answer
























  • I checked under Build, Execution, Deployment > Build Tools > Gradle and I am using the correct version.

    – Madrus
    Nov 20 '18 at 19:54













  • Ok, then I think it may be issue with your JAVA_HOME environment variable. Check if it's pointing your 9.0.4 installation.

    – Hayrettin MAVIS
    Nov 20 '18 at 20:31











  • I didn't even have a JAVA_HOME environment variable before so I looked it up, craeted it, and restarted my computer. Now it's set to jdk1.8.0_181, however terminal's java -version is still giving me 9.0.4 as the answer.

    – Madrus
    Nov 20 '18 at 20:42











  • @Madrus Glad you solved :)

    – Hayrettin MAVIS
    Nov 20 '18 at 21:51











  • The terminal window in IntelliJ IDEA is independent of any IDE setting. The java command does not look at the JAVA_HOME environment variable; instead, the command shell simply runs the first java executable that is found in the PATH environment variable.

    – Klitos Kyriacou
    Nov 20 '18 at 21:56














0












0








0







I thik you have to specify Gradle to use the JVM you want.



Go to settings -> Build, Execution, Deployment -> Gradle-> Gradle JVM and choose the JDK you want. (It's pointed in this thread : https://stackoverflow.com/a/43624456/2799066 )



AFAIK giving JVM and command line arguments can also be configurable when importing project to idea.






share|improve this answer













I thik you have to specify Gradle to use the JVM you want.



Go to settings -> Build, Execution, Deployment -> Gradle-> Gradle JVM and choose the JDK you want. (It's pointed in this thread : https://stackoverflow.com/a/43624456/2799066 )



AFAIK giving JVM and command line arguments can also be configurable when importing project to idea.







share|improve this answer












share|improve this answer



share|improve this answer










answered Nov 20 '18 at 19:46









Hayrettin MAVISHayrettin MAVIS

12




12













  • I checked under Build, Execution, Deployment > Build Tools > Gradle and I am using the correct version.

    – Madrus
    Nov 20 '18 at 19:54













  • Ok, then I think it may be issue with your JAVA_HOME environment variable. Check if it's pointing your 9.0.4 installation.

    – Hayrettin MAVIS
    Nov 20 '18 at 20:31











  • I didn't even have a JAVA_HOME environment variable before so I looked it up, craeted it, and restarted my computer. Now it's set to jdk1.8.0_181, however terminal's java -version is still giving me 9.0.4 as the answer.

    – Madrus
    Nov 20 '18 at 20:42











  • @Madrus Glad you solved :)

    – Hayrettin MAVIS
    Nov 20 '18 at 21:51











  • The terminal window in IntelliJ IDEA is independent of any IDE setting. The java command does not look at the JAVA_HOME environment variable; instead, the command shell simply runs the first java executable that is found in the PATH environment variable.

    – Klitos Kyriacou
    Nov 20 '18 at 21:56



















  • I checked under Build, Execution, Deployment > Build Tools > Gradle and I am using the correct version.

    – Madrus
    Nov 20 '18 at 19:54













  • Ok, then I think it may be issue with your JAVA_HOME environment variable. Check if it's pointing your 9.0.4 installation.

    – Hayrettin MAVIS
    Nov 20 '18 at 20:31











  • I didn't even have a JAVA_HOME environment variable before so I looked it up, craeted it, and restarted my computer. Now it's set to jdk1.8.0_181, however terminal's java -version is still giving me 9.0.4 as the answer.

    – Madrus
    Nov 20 '18 at 20:42











  • @Madrus Glad you solved :)

    – Hayrettin MAVIS
    Nov 20 '18 at 21:51











  • The terminal window in IntelliJ IDEA is independent of any IDE setting. The java command does not look at the JAVA_HOME environment variable; instead, the command shell simply runs the first java executable that is found in the PATH environment variable.

    – Klitos Kyriacou
    Nov 20 '18 at 21:56

















I checked under Build, Execution, Deployment > Build Tools > Gradle and I am using the correct version.

– Madrus
Nov 20 '18 at 19:54







I checked under Build, Execution, Deployment > Build Tools > Gradle and I am using the correct version.

– Madrus
Nov 20 '18 at 19:54















Ok, then I think it may be issue with your JAVA_HOME environment variable. Check if it's pointing your 9.0.4 installation.

– Hayrettin MAVIS
Nov 20 '18 at 20:31





Ok, then I think it may be issue with your JAVA_HOME environment variable. Check if it's pointing your 9.0.4 installation.

– Hayrettin MAVIS
Nov 20 '18 at 20:31













I didn't even have a JAVA_HOME environment variable before so I looked it up, craeted it, and restarted my computer. Now it's set to jdk1.8.0_181, however terminal's java -version is still giving me 9.0.4 as the answer.

– Madrus
Nov 20 '18 at 20:42





I didn't even have a JAVA_HOME environment variable before so I looked it up, craeted it, and restarted my computer. Now it's set to jdk1.8.0_181, however terminal's java -version is still giving me 9.0.4 as the answer.

– Madrus
Nov 20 '18 at 20:42













@Madrus Glad you solved :)

– Hayrettin MAVIS
Nov 20 '18 at 21:51





@Madrus Glad you solved :)

– Hayrettin MAVIS
Nov 20 '18 at 21:51













The terminal window in IntelliJ IDEA is independent of any IDE setting. The java command does not look at the JAVA_HOME environment variable; instead, the command shell simply runs the first java executable that is found in the PATH environment variable.

– Klitos Kyriacou
Nov 20 '18 at 21:56





The terminal window in IntelliJ IDEA is independent of any IDE setting. The java command does not look at the JAVA_HOME environment variable; instead, the command shell simply runs the first java executable that is found in the PATH environment variable.

– Klitos Kyriacou
Nov 20 '18 at 21:56













0














I think I got it working.



I clicked File -> New -> Project from existing sources -> Picked the Project folder and that I wish to overwrite it



Then I set up the initial gradle settings that open up when starting a brand new gradle project and voila, terminal now understands gradlew commands.



It's weird, however, that java -version still shows 9.0.4, but well at least everything seems to work now.



Tl;Dr for fix: Create a New project from existing sources and overwrite the current project. Pick the correct java version when asked during the setup.






share|improve this answer
























  • java -version has nothing to do with IntelliJ. It's like typing into the command prompt. You weren't changing your system default jdk, just your JDK that compiles and runs your project.

    – Frzn Flms
    Nov 20 '18 at 21:19
















0














I think I got it working.



I clicked File -> New -> Project from existing sources -> Picked the Project folder and that I wish to overwrite it



Then I set up the initial gradle settings that open up when starting a brand new gradle project and voila, terminal now understands gradlew commands.



It's weird, however, that java -version still shows 9.0.4, but well at least everything seems to work now.



Tl;Dr for fix: Create a New project from existing sources and overwrite the current project. Pick the correct java version when asked during the setup.






share|improve this answer
























  • java -version has nothing to do with IntelliJ. It's like typing into the command prompt. You weren't changing your system default jdk, just your JDK that compiles and runs your project.

    – Frzn Flms
    Nov 20 '18 at 21:19














0












0








0







I think I got it working.



I clicked File -> New -> Project from existing sources -> Picked the Project folder and that I wish to overwrite it



Then I set up the initial gradle settings that open up when starting a brand new gradle project and voila, terminal now understands gradlew commands.



It's weird, however, that java -version still shows 9.0.4, but well at least everything seems to work now.



Tl;Dr for fix: Create a New project from existing sources and overwrite the current project. Pick the correct java version when asked during the setup.






share|improve this answer













I think I got it working.



I clicked File -> New -> Project from existing sources -> Picked the Project folder and that I wish to overwrite it



Then I set up the initial gradle settings that open up when starting a brand new gradle project and voila, terminal now understands gradlew commands.



It's weird, however, that java -version still shows 9.0.4, but well at least everything seems to work now.



Tl;Dr for fix: Create a New project from existing sources and overwrite the current project. Pick the correct java version when asked during the setup.







share|improve this answer












share|improve this answer



share|improve this answer










answered Nov 20 '18 at 21:02









MadrusMadrus

61




61













  • java -version has nothing to do with IntelliJ. It's like typing into the command prompt. You weren't changing your system default jdk, just your JDK that compiles and runs your project.

    – Frzn Flms
    Nov 20 '18 at 21:19



















  • java -version has nothing to do with IntelliJ. It's like typing into the command prompt. You weren't changing your system default jdk, just your JDK that compiles and runs your project.

    – Frzn Flms
    Nov 20 '18 at 21:19

















java -version has nothing to do with IntelliJ. It's like typing into the command prompt. You weren't changing your system default jdk, just your JDK that compiles and runs your project.

– Frzn Flms
Nov 20 '18 at 21:19





java -version has nothing to do with IntelliJ. It's like typing into the command prompt. You weren't changing your system default jdk, just your JDK that compiles and runs your project.

– Frzn Flms
Nov 20 '18 at 21:19


















draft saved

draft discarded




















































Thanks for contributing an answer to Stack Overflow!


  • Please be sure to answer the question. Provide details and share your research!

But avoid



  • Asking for help, clarification, or responding to other answers.

  • Making statements based on opinion; back them up with references or personal experience.


To learn more, see our tips on writing great answers.




draft saved


draft discarded














StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f53400143%2fi-am-trying-to-change-the-ide-for-intellij-but-it-keeps-running-the-wrong-versi%23new-answer', 'question_page');
}
);

Post as a guest















Required, but never shown





















































Required, but never shown














Required, but never shown












Required, but never shown







Required, but never shown

































Required, but never shown














Required, but never shown












Required, but never shown







Required, but never shown







Popular posts from this blog

MongoDB - Not Authorized To Execute Command

How to fix TextFormField cause rebuild widget in Flutter

in spring boot 2.1 many test slices are not allowed anymore due to multiple @BootstrapWith