JAVA_HOME is set to an invalid directory - ionic - java

I just got a new computer which didn't have java or android sdk installed, I added both today, but the first time I made a mistake and downloaded java 10 and set that as the JAVA_HOME but since then I downloaded java jdk 1.8 and made that the JAVA_HOME but I'm still getting an error:
I'm doing - ionic cordova run android --device with the error report saying:
ANDROID_HOME=C:\Users\Simon\AppData\Local\Android\sdk
JAVA_HOME=C:\Program Files\Java\jdk1.8.0_172\bin
studio
ERROR: JAVA_HOME is set to an invalid directory: C:\Program Files\Java\jdk1.8.0_172\bin
Please set the JAVA_HOME variable in your environment to match the
location of your Java installation.
(node:56548) UnhandledPromiseRejectionWarning: Error: cmd: Command failed with exit code 1
So it's saying I don't have the correct directory, but I'm pretty sure I do:
and here is my environment variables:
However... when I do java -version it returns:
java version "10.0.1" 2018-04-17
Java(TM) SE Runtime Environment 18.3 (build 10.0.1+10)
Java HotSpot(TM) 64-Bit Server VM 18.3 (build 10.0.1+10, mixed mode)
Not sure if that's normal...
What should I do? I think all the info should be correct.. Any ideas? Thanks!

Related

Is PATH or Java_Home messed up?

I was able to install Java and SonarQube, configured the wrapper.conf, and adjusted the port to 9000 to make it work 3 days ago.
Now, running StartSonar.bat gave this
Unable to execute Java command. Access is denied. (0x5) wrapper |
"C:\Program Files\Java\jdk-11.0.11\bin" -Dsonar.wrapped=true ...
C:\Program Files\Java\jdk-11.0.11\bin is what I have in wrapper.conf and it did work.
In a cmd window, C:\windows\system32>java -version
java version "11.0.11" 2021-04-20 LTS Java(TM) SE Runtime Environment
18.9 (build 11.0.11+9-LTS-194) Java HotSpot(TM) 64-Bit Server VM 18.9 (build 11.0.11+9-LTS-194, mixed mode)
navigate to the path above do java -version reports the same.
However I noticed my system Path has this, verified the one in javapath is the same version.
C:\Program Files\Common Files\Oracle\Java\javapath
C:\Program Files(x86)\Common Files\Oracle\Java\javapath
And java_home is empty: echo %java_home% got %java_home%
I'm totally confused now. What went wrong?

Eclipse: "Could not find Java SE Runtime Environment"

I have just downloaded Eclipse and tried to run it, and it gave me this error message:
Error: opening registry key 'Software\JavaSoft\Java Runtime Environment
Error: could not find java.dll
Error: Could not find Java SE Runtime Environment.
After closing the errors, it sends me to this site:
https://download.eclipse.org/oomph/jre/?vm=1_1_8_0_64_0&pn=Eclipse%20Installer&pu=http://wiki.eclipse.org/Eclipse_Installer&pi=http://download.eclipse.org/oomph/jre/128x128.png
I have already reinstalled the jdk multiple times.
After following some other posts i saw, i have also made sure that %JAVA_HOME% was included in PATH
(%JAVA_HOME% = C:\Program Files\Java\jdk-13.0.1)
to java -version i got:
java version "1.8.0_231"
Java(TM) SE Runtime Environment (build 1.8.0_231-b11)
Java HotSpot(TM) 64-Bit Server VM (build 25.231-b11, mixed mode)
Thank you in advance for the help!
Edit:
I had both jdk-13.0.1 and jre 1.8.0 installed
After reinstalling only jdk 13.0.1 (and uninstalling jre 1.8.0), java -version gave me:
java version "13.0.1" 2019-10-15
Java(TM) SE Runtime Environment (build 13.0.1+9)
Java HotSpot(TM) 64-Bit Server VM (build 13.0.1+9, mixed mode, sharing)
I'm using Windows 10 Pro
EclipseIDE 2019-12 64bit
According to this answer maybe you messed up with your registry, make sure all java removed first and reinstall JRE.
For me if I want to develop java apps, I would install JDK instead of JRE, after install pls check java & javac command exist
'Software\JavaSoft\Java Runtime Environment
Error: could not find java.dll
Error: Could not find Java SE Runtime Environment. After closing the
errors, it sends me to this site:
https://download.eclipse.org/oomph/jre/?vm=1_1_8_0_64_0&pn=Eclipse%20Installer&pu=http://wiki.eclipse.org/Eclipse_Installer&pi=http://download.eclipse.org/oomph/jre/128x128.png
I have already reinstalled the JDK multiple times. After following some other posts I saw, I have also made sure that %JAVA_HOME% was included in PATH (%JAVA_HOME% = C:\Program Files\Java\jdk-13.0.1)
to java -version I got:
java version "1.8.0_231"
Java(TM) SE Runtime Environment (build 1.8.0_231-b11)
Java HotSpot(TM) 64-Bit Server VM (build 25.231-b11, mixed mode)
Thank you in advance for the help!
Edit:
I had both jdk-13.0.1 and jre 1.8.0 installed
After reinstalling only jdk 13.0.1 (and uninstalling jre 1.8.0), java -version gave me:
java version "13.0.1" 2019-10-15
Java(TM) SE Runtime Environment (build 13.0.1+9)
Java HotSpot(TM) 64-Bit Server VM (build 13.0.1+9, mixed mode, sharing)
I'm using Windows 10 Pro
EclipseIDE 2019-12 64bit
share edit
asked
1 hour ago
Csalagovits Máté
1●11 bronze badge edited
5 secs ago
One thing I noticed is the JAVA_HOME path refers to JDK 13, while the "java -version" command points to 1.8. Specify the version of Windows and Eclipse you have used in this question. Also, make sure you restart the PC after installing Java. – Shankar P S 52 mins ago
#ShankarPS Edited the question to adress your concerns – Csalagovits Máté 2 mins ago

Failed to find Java VM

I've always used Google2SRT, a light software to download subtitles from Youtube. Now it no longer works: "Startup Error: Failed to find Java VM".
I have Java installed, I have Netbeans installed and working, I have never had any Java related issues.
I've tried reinstalling everything, I've tried creating a JAVA_HOME and JRE_HOME System variable and pointing it to "C:\Program Files\Java\jre1.8.0_191" according to this tutorial: https://confluence.atlassian.com/doc/setting-the-java_home-variable-in-windows-8895.html
It felt odd because I didn't even had this environment variable previously. I have no idea what's the issue.
I've tried uninstalling Netbeans and other programming tools as well.
I'm on Windows 7 x64.
java -debug -version > "%userprofile%\desktop\javaDebug.log" 2>&1 returns:
java version "1.8.0_191"
Java(TM) SE Runtime Environment (build 1.8.0_191-b12)
Java HotSpot(TM) 64-Bit Server VM (build 25.191-b12, mixed mode)
I have also tried setting maximum heap size in _JAVA_OPTIONS
System Variables
Just go to the install dir (e.g. C:\Program Files (x86)\Google2SRT), open a cmd.exe, cd to the above folder and type java -jar Google2SRT.jar. You don't need the .exe
This should work, provided you have java installed. Check by typing java -version in the cmd.

JAVA_HOME error when using cordova

hey i am trying to run cordova run android and got this error :
ANDROID_HOME=/home/ronin/Android
JAVA_HOME=/home/ronin/jdk1.8.0_161/
(node:7717) UnhandledPromiseRejectionWarning: CordovaError: Requirements check failed for JDK 1.8 or greater
at /home/ronin/Downloads/SyncApp/platforms/android/cordova/lib/check_reqs.js:367:19
at _fulfilled (/home/ronin/Downloads/SyncApp/platforms/android/cordova/node_modules/q/q.js:854:54)
clearly my JAVA_HOME variable is correctly set ( i get the same error without / in the end);
i am running Arch Linux and i know it uses, bu default, the openjdk versions. is that the source of the error cause this is what i get when i run java -version
openjdk version "9.0.4"
OpenJDK Runtime Environment (build 9.0.4+11)
OpenJDK 64-Bit Server VM (build 9.0.4+11, mixed mode)
help !
you need to uninstall OpenJDK 9.x.x and install Java SE Development Kit 8 for build ionic app in android or ios and then set JAVA_HOME path.

Android Studio: Could not determine Java version using executable C:\Program Files\Java\jdk-10\bin\java.exe

I wanted to use my JDK 10 in my Android Studio. I went to Files > Project Structure and specified my JDK location:
C:\Program Files\Java\jdk-10
After I clicked 'OK', it showed me a Gradle sync failed message with an error:
Could not determine Java version using executable C:\Program Files\Java\jdk-10\bin\java.exe.
I've set the JAVA_HOME variable to my jdk and jre folder, and the path variable to C:\ProgramData\Oracle\Java\javapath but the problem still occurs.
I can also find the Java version with the command:
"C:\Program Files\Java\jdk-10\bin\java.exe" -version
which gives me the correct version:
java version "10" 2018-03-20
Java(TM) SE Runtime Environment 18.3 (build 10+46)
Java HotSpot(TM) 64-Bit Server VM 18.3 (build 10+46, mixed mode)
Screenshot:
Versions:
OS: Windows 10 64-bit
Android Studio Version: 3.1.0.16
JDK Version: 10
it happen in android studio 3.2.0 when your import your project to new android studio you must use this build gradle or newer
dependencies {
classpath 'com.android.tools.build:gradle:3.2.0-alpha14'
}

Categories

Resources