JAVA_HOME error when using cordova - java

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.

Related

How would I update my ANDROID_SDK_ROOT / JAVA_HOME / PATH environment variables on a MAC to build Android

I'm building an Ionic Cordova cross platform app. When i run ionic cordova build android I get the following error.
cordova-android-support-gradle-release: Android platform: V7+
cordova-plugin-androidx-adapter: Processed 65 source files in 1452ms
Checking Java JDK and Android SDK versions
ANDROID_SDK_ROOT=undefined (recommended setting)
ANDROID_HOME=/Users/anonymous/Library/Android/sdk (DEPRECATED)
Requirements check failed for JDK 8 ('1.8.*')! Detected version: 15.0.1
Check your ANDROID_SDK_ROOT / JAVA_HOME / PATH environment variables.
[ERROR] An error occurred while running subprocess cordova.
Here is my java version:
java version "15.0.1" 2020-10-20
Java(TM) SE Runtime Environment (build 15.0.1+9-18)
Java HotSpot(TM) 64-Bit Server VM (build 15.0.1+9-18, mixed mode, sharing)
Everything was working until I downloaded the latest Java SDK, now I can't build Android.
I read in another Stack post that this is bad:
java version "15.0.1" 2020-10-20
Java(TM) SE Runtime Environment (build 15.0.1+9-18)
Java HotSpot(TM) 64-Bit Server VM (build 15.0.1+9-18, mixed mode, sharing)
I'm not really sure how to resolve this and why the Java SDK doesn't appear when I check Java -version.
I set this in my .bash_profile
ANDROID_HOME=/Users/anonymous/Library/Android/sdk
ANDROID_SDK_ROOT=~/Library/Android/sdk
Android fully supports java 7 and a subset of java 8 and 9 features. So, yes, the JDK 15 you downloaded is not compatible with the Android development platform.
AdoptOpenJDK 1.8 is the preferred JDK for Android development (don't quote me on this, there may be disagreements)
Then, from the build log you can see ANDROID_SDK_ROOT=undefined (recommended setting). That's fine, ANDROID_SDK_ROOT can be undefined.
After you've downloaded the correct JDK, the only two environment you need to set are:
export JAVA_HOME=/Library/Java/JavaVirtualMachines/adoptopenjdk-8.jdk/Contents/Home
export ANDROID_HOME=/Users/$USER/Library/Android/sdk

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

JAVA_HOME is set to an invalid directory - ionic

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!

Trying to run an Android project in IntelliJ: Error:Abnormal build process termination: Error: This Java instance does not support a 32-bit JVM.

Error:Abnormal build process termination:
Error: This Java instance does not support a 32-bit JVM.
Please install the desired version.
How to fix it?
Java version:
$ java -version
java version "1.6.0_65"
Java(TM) SE Runtime Environment (build 1.6.0_65-b14-466.1-11M4716)
Java HotSpot(TM) 64-Bit Server VM (build 20.65-b04-466.1, mixed mode)
JAVA_HOME:
$ echo $JAVA_HOME
/System/Library/Java/JavaVirtualMachines/1.6.0.jdk/Contents/Home
I also have JDK 1.8 installed...
In the general settings for your project, you need to specify the right SDK. You need to download the required java version, and then find the path to its home and then point to it in General Settings > Project > Project SDK. Likely, you need to upgrade to a newer version.

Sencha Cmd installation on Mac: Java not found

Trying to install Sencha Command 3.1.1 on my iMac (10.8.3). The installer is saying:
The installer could not find a valid Java(tm) on this machine.
Supported versions: Vendor : Any min. 1.6.0 max. any
Following another Stack Overflow thread, I tried linking /usr/bin/java to /Library/Internet Plugins/JavaAppletPlugin.plugin/Contents/Home/bin/java. Now, I get this on the command line:
~ 🍔 java -version
java version "1.7.0_21"
Java(TM) SE Runtime Environment (build 1.7.0_21-b12)
Java HotSpot(TM) 64-Bit Server VM (build 23.21-b01, mixed mode)
So that looks good, but the installer still complains that it cannot find Java. Why can't it?
What eventually fixed this for me, after consulting with Sencha support, was installing the full JDK rather than just the JRE. I don't know exactly why this fixed it, or what the root cause was, but now Command installed successfully and is working fine.
I had JDK installed, but one thing worked for me was exporting $java_home/bin:
export PATH=$JAVA_HOME/bin:$PATH

Categories

Resources