Persistent React Native problem: JAVA_HOME is not set - java

I'm trying to create a React Native app for Android on Windows 10, but every time I use react-native run-android I get the same Error: ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH.
I've already set up this variable via the Control Panel
And I've set up the Path variable to both the JDK and JRE
I've uninstalled and reinstalled the JDK and Android Studio, I have tried removing and adding "\bin" to both the Path and JAVA_HOME variables, and I've been browsing similar questions (including this one and this one) to no avail.
What can I do?

When I set the environment for react native, I usually use these settings.
Add the variable JAVA_HOME to the path C:\Program Files\Java\jdk1.8.0_231
And I add to the system path:
%JAVA_HOME%\bin
%ANDROID_HOME%\emulator
%ANDROID_HOME%\tools
%ANDROID_HOME%\tools\bin
%ANDROID_HOME%\platform-tools
I hope it helps.

this works for me to
Add the variable JAVA_HOME to the path C:\Program Files\Java\jdk1.8.0_231
And I add to the system path: %JAVA_HOME%\bin%ANDROID_HOME%\emulator%ANDROID_HOME%\tools%ANDROID_HOME%\tools\bin%ANDROID_HOME%\platform-tools

Related

Ionic failed to build for Android, JAVA_HOME invalid, failed to run java -version

I already tried to set my JAVA_HOME to C:\Program Files\Java\jdk1.8.0_73
and the path is C:\Program Files\Java\jdk1.8.0_73\bin.
The goal of what you are asking to do is to install java and let some other program find java by setting two Windows variables JAVA_HOME and path to point to the java directory and the java executable/program file directory respectively. I assume you are using windows because of some of the clues you gave. You first need to download java, get the JDK and not the JRE version. Download from herejava then set the two variables, find mycomputer icon or maybe its called this pc and right click find properties click advanced system settings, environment variables there you go, put in the variable and value for both JAVA_HOME and path
I had the same problem and had solved it.
The cause of problem changing the path when installing jdk. Changed jre path to
../jdk1.8.0/jre
the right is for example:
../java/jdk1.8.0
../java/jre8
or change nothing.
So, if you are sure that JAVA_HOME path is right, try to reinstall jdk and change nothing before complete.

Android Studio - JAVA_HOME doesn't point to a valid JVM installation

Having trouble firing up android studio. Get the following message: The environment variable JAVA_HOME (with the value of ?C:\Program Files\Java\jdk1.8.0_31) does not point to a valid JVM installation. The problem is that as far as I can tell, the environment variable I set up IS pointing to a valid install.
I've tried everything from renaming it to JDK_HOME, to pointing it to all the sub directories in the jdk folder, to uninstalling and reinstalling java and android studio about 3 time. I have triple checked that I have 64 bit JAVA installed (and that my computer is 64 bit). Pretty much at the end of my rope here. Help would be appreciated big time.
Here's a screen cap of my windows, you might spot something obvious I haven't:
You can try this
Android Studio error: "Environment variable does not point to a valid JVM instalation"
this works for me.
If you start 64bit Android Studio, you have to add JAVA_HOME as
"C:\Program Files\Java\jdk..."
If 32bit
"C:\Program Files(x86)\Java\jdk..."
and dont put "\bin" end of the path.
As you told you have 64 bit system then copy this path C:\Program Files\Java\jdk1.8.0_31
Step 1 :- Create JAVA_HOME variable by clicking new and past ( C:\Program Files\Java\jdk1.8.0_31) this path.
Step 2 Then click path variable and edit then past it your path after add semicolon (;) C:\Program Files\Java\jdk1.8.0_31
I am using windows 10 so this windows look like this
Note :- If above dialog not open then
, select path variable and click on Edit…. Locate the end of the current variable value
append the path of jdk, using a semicolon And click ok
To fix it, just remove "\bin" from my JAVA_HOME variable.
NOTE: be sure to put the JAVA_HOME path variable in the System variables rather than the user variables. If the path variable is in User the Android Studio will not find the path.
If you are sure that the variable is pointing to the right place, then:
Acess "C:\Program Files\Android\Android Studio\bin"
Choice the .exe for your machine.
Faced same problem for many weeks.
What worked for me:
uninstalled all java from laptop
then installed jdk 7 64 bit,
deleted JAVA_HOME and added JDK_HOME.
To fix Android Studio - JAVA_HOME doesn't point to a valid JVM installation Problem, follow the below steps:
Step 1: Open the command window by typing ‘cmd‘ in the Start menu search box.
Step 2: Now change the directory to the Android studio installation :
cd "c:\Program Files (x86)\Android\android-studio\bin"
Step 3: Type ‘studio.bat‘ and hit enter. If the JAVA environment variables are not set properly, then you should get an error message as below.
Step 4: So, it is clear that Android studio is not able to read the JDK location. All you need to do is, set the JAVA_HOME and JDK_HOME environment variables by following the steps mentioned in this guide.
Step 5: Close the existing command window. This step is very important, as the newly set variable will not reflect otherwise.
Step 6: Re-launch the command window and type the below command to ensure that the environment variables are set properly.
echo %JAVA_HOME%
echo %JDK_HOME%
Step 7: Now change the directory to the Android studio installation.
cd "c:\Program Files (x86)\Android\android-studio\bin"
Step 8: Type ‘studio.bat‘ and hit enter. Now the Android studio will launch normally.
Based on these link : Google Android Studio is not launching?
I use Windows 8.
2 steps:
Download jdk-7u80-windows-x64.exe
1.1 It's a requirement # https://developer.android.com/sdk/index.html#Requirements
Set JAVA_HOME to C:\Program Files\Java\jdk1.7.0_80
NOTE: not in Program Files (x86)
Remember that you have to set the JAVA_HOME variable to C:\Program Files\Java\jdk1.8.0_31, just like you set the variable JDK_HOME. :)
See this post for reference:
Android Studio installation on Windows 7 fails, no JDK found
Also, you could try installing an older version of java, as the newest ones might not be compatible with your IDE. Reference: Android Studio error: "Environment variable does not point to a valid JVM installation"
Ensure JAVA_HOME is in the "System Variables" and points to the JDK short path. For example if the JDK is C:\Program Files\Java\jdk1.7.0_79 set JAVA_HOME to C:\PROGRA~1\Java\JDK17~1.0_7 .
I was getting the above error message initially upon install but it started working when I made this change, and it was not necessary to reboot.
make JAVA_HOME a system variable under environment variables and set it to C:\Program Files\Java\jdk1.8.0_31.
After that logout and login back. This should eliminate the error message that you are getting. Then launch the Android Studio.
JAVA_HOME path : C:\Program Files\Java\jdk1.8.0_102\ //Copied from PATH variable.
Remove quotes if any.
If your system is 32 bit then execute studio.exe
If your system is 64 bit then simply execute studio64.exe
It solved my issue
I tried installing all the versions of JDK and changing the user environment variable. Only the following worked. Install the same versions and you are good to go.
Android studio version is 2.1.2
Install Java jdk1.8.0_91
Add the following user environment variable JAVA_HOME C:\Program Files\Java\jdk1.8.0_91
in your system Variable ( path ) append this wilset the C:\Program Files\Java\jdk1.8.0_31
In your case you just have to do the following:
`Go to Control Panel> Advanced System Settings> Environment Variables
> System Variables> New> Variable name: JDK_HOME
Variable value: C:\Program Files\Java\jdk1.8.0_31\
and then click on android studio..It will start working.`
I am using windows 7 32-bit and this worked for me:
Added new system variable: JDK_HOME with correct location of my JDK:
C:\Program Files\Java\jdk1.8.0_151
For this issue, I download the jdk oracle version 11 on the official java website, I then set the JAVA_HOME in the environment variable to the jdk path for both the user and system. It is important that it is jdk and not type jre. Hopefully this helps. Run the Android studio 64-bit type, if does not work try the 32-bit.
I found there is some issue if you download the wrong version of 32 or 64 bit version so be careful on that.
For me it got fixed when I removed the leading and trailing double quotes in the JAVA_HOME system environment variable (Windows 7 x64):
Did NOT work: "C:\path\to\jdk\without\bin"
Did work: C:\path\to\jdk\without\bin
Note:
I do not have any spaces in the path to the JDK (custom location)!
Step 1) Download your version of jdk exe file and run it. http://www.oracle.com/technetwork/java/javase/downloads/jdk8-downloads-2133151.html
Step 2) Once installation is complete, you will see the jdk directory in Java folder in Program files under C Drive
Step 3) Right click on my computer, then click on advance settings, then click on environment settings.
Step 4) add a new variable called JAVA_HOME and set its path to PATH = C:\Program Files\Java\jdk1.8.0_31\
Step 5) Run Android Studio :)
FOR JAVA RELATED INSTALLATION THIS IS THE PATH SETTING ARE MATCHED N RUNS YOUR INSTALLATIONS SUCCESSFUL.
Step 1 :- Create JAVA_HOME variable by clicking new and past ( C:\Program Files\Java\jdk1.8.0_31) this path.
Step 2 Then click path variable and edit then past it your path after add semicolon (;) C:\Program Files\Java\jdk1.8.0_31
MY COMPUTER
|
RIGHT CLICK
|
PROPERTIES
|
ADVANCED SYSTEM SETTINGS
|
ADVANCED TAB
|
ENVIRONMENT VARIABLES
|
USER VARIABLES
|
NEW
|
VARIABLE NAME = JAVA_HOME
VARIABLE VALUE = "C:\Program Files\Java\jdk1.8.0_131"
REMOVE BIN, IF YOU ADDED ALREADY...
Hi! It works for me...
We can also resolve this issue by using jdk 8
to install jdk 8 click here http://www.oracle.com/technetwork/java/javase/downloads/jdk8-downloads-2133151.htmli
and download jdk setup install it
to copy the path go to c drive select programme file folder then choose java
then choose jdk and you will see the version go to that folder and copy the path and right click on my computer go to properties then choose advance settings then you will see one pop pup in that you have to choose variables.and click on new tab and give the name of variable JAVA_HOME and in the path you need to past the path that you have copy for jdk 8
enter image description here
after that you have to click ok ok two times
now start your android studio error will be resolved
Delete your all user variable paths from Environments Variable, and keep only two (TEMP & TMP) variables, it will work.

Android SDK error

After running android.bat both with and without administrator powers I get the following error:
Environment Values set as:
C:\Program Files\Java\jdk1.7.0_71\bin set for JAVA_HOME, JDK_HOME, and JAVA_PATH
C:\Program Files\Java\jdk1.7.0_71\bin;%SystemRoot%\system32; set for PATH
C:\Users\elija_000\AppData\Local\Android\Sdk\tools\lib\x86_64\swt.jar set for ANDROID_SWT
You have redundant environmental variables !! only PATH and JAVA_HOME are required.. JDK_HOME, JAVA_PATH are not required.. further more if you have eclipse and ADT, open eclipse go to 'window' then select 'android sdk manager'.. see if that opens or not to test.
Try to reinstall the java
maybe it will work

Android SDK not working issues with 'find_java.exe'

Android SDK Manager is not working I tried opening it from the eclipse
and even tried using sdkmanager.exe but its not opening up
I tried all the possibilities and also reinstalled SDK
console log:
"F:\Android\sdk\tools\lib\find_java.exe" -s' is not recognized as an internal or external command,
can anyone please solve my problem
It seems that you have not set your java home path in your machine properly.
set your JAVA_HOME AND JRE_HOME variables to the appropriate paths.
Add the environment variable JAVA_HOME which points to your java installation directory and then try running eclipse.
Refer this link to set environmental variables. :)

Android SDK r20 - Windows 7 - Install Java JDK Not Found

Android SDK installation doesn't find JDK is not the same release as this, and the solution "back" then "next" doesn't work.
I have tried installing various versions of Java and nothing seems to be working. I've been trying to get this installed for the last 3 days. Solutions I have tried that do NOT work:
Pushing the back button then the next button.
Adding an Environment Variable for JAVA_HOME that points to the System32 path and the actual java install directory.
Installing various versions of Java. (Java 6 and Java 7)
The install file is called installer_r20.0.3-windows and is the current exe available at http://developer.android.com/sdk/index.html
Ok, looking at to your JAVA_HOME path which is C:\Program Files\Java\jdk1.6.0_34\bin I suggest you to change it as C:\Program Files\Java\jdk1.6.0_34\. There is no need to add bin folder's path in the JAVA_HOME Path.
On my Win7 Ultimate 64 bits/ i need multiple things
Set SystemEnvironment Variable JAVA_HOME = C:\Program Files\Java\jdk1.7.0_07
Add the same value to SystemEnvironment Variable PATH, but make sure to put it before system32 path
PATH = C:/Program Files/Java/jdk1.7.0_07;C:\Windows\system32; ....... (... = current value)
and most important , i guessed. Rename c:\windows\system32\java.exe -> c:\windows\system32\java.exe.old
Restart the installer (my case = installer_r20.0.3-windows.exe )
Voila!
This might help safe other's time
Setting JAVA_HOME environment variable in System variable to C:\Program Files\Java\jdk1.7.0_07\ did solve my problem.
A couple of points to note.
No need to specify bin or jre folder name.
You will need to cancel and restart the Android SDK installation. Previous/Next may not work.
I just copied the folder name from Windows explorer address bar. No need to replace the \ with /.

Categories

Resources