How to solve this java path error from android Studio? - java

ERROR: JAVA_HOME is set to an invalid directory: /Library/Java/JavaVirtualMachines/jdk1.8.0_301.jdk/Contents/Home
Please set the JAVA_HOME variable in your environment to match the
location of your Java installation.
After updating I got this type of error. I have reinstall jdk but same error.Please help

JAVA_HOME typically the path to the java installation directory.
In your case, it should be upto Library/Java/JavaVirtualMachines/jdk1.8.0_301.jdk
I assume .jdk is within name of the folder.

Related

Persistent React Native problem: JAVA_HOME is not set

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

JAVA_HOME does not point to the JDK.(Spring Tool Suite)

JAVA_HOME does not point to the JDK.(Spring Tool Suite)
I am getting an error while running Spring Tool Suite(3.9.5.RELEASE) as
org.apache.tools.ant.BuildException: Unable to find a javac compiler;
com.sun.tools.javac.Main is not on the classpath.
Perhaps JAVA_HOME does not point to the JDK.
It is currently set to "C:\Program Files\Java\jre1.8.0_181"
As i already set the java path in Environmental Variable-->System variables as
Variable Name : JAVA_HOME and
Variable Value : C:\Program Files\Java\jdk1.8.0_131
and in Environmental Variable-->user variables as
Variable Name : path and
Variable Value : C:\Program Files\Java\jdk1.8.0_131
and in my C:\Program Files\Java\ drive there is jdk1.8.0_131 and jre1.8.0_181.
I set the path properly to JDK, also I restarted the application too, even restarted the Computer too, still I am getting the same error again.
Is there any other solution to avoid such error?
Check your project build path if it is pointing to JRE instead of JDK.
Else Check,
The path for the tools.jar, if it is wrong? or,
Is it pointing to an older version of Java? or,
If tools.jar is missing?
If all the above options do not work try reinstalling JDK.
I installed STS in eclipse Python instead of using separate STS tool and problem got solved..Still wonder why the path shows in STS tool point to jre even after setting to JdK...but i install and run STS in eclipse and it worked properly, wasted my 2 days on this error.
Thanks for your time , learned a lot about settings from you guys

Error Launching IntelliJ--does not point to a valid JVM

I have declared JAVA_HOME in environment variables and I have the following value in PATH: C:\Java\jre1.8.0_45\bin;%JAVA_HOME%;
But still while launching IntelliJ I am getting below error.
The values from command prompt:
PS: This is a different problem. But the one I am facing does not have any such issue.
I have JRE in my path variable and JDK in JAVA_HOME.(attached the screenshots)
Your %JAVA_HOME% variable should point to the directory of Java installation. Here's what you can do to fix it.
Set %JAVA_HOME% to C:\Java\jre1.8.0_45\
Add %JAVA_HOME%\bin to your %PATH% variable
you can also add JDK to your system variables and point it to the JRE folder (do not point it to BIN folder)

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

I have installed Android Studio and JDK. I have set my variable to the JDK folder. Now, when launching the program I receive an error message stating, "The environment variable JAVA_HOME (with the value of C:\ProgramFiles\Java\jdk1.8.0) does not point to a valid JVM Installation.
Can you please assist with this?
Thanks!
That path to jdk1.8.0 is likely wrong. Are you sure its ProgramFiles and not "Program Files" and that the rest of your path is correct?
hi guys i to occurred with same problem but i resolved as if your JAVA_HOME JDK is referring with another IDE then this problem will occur , so first delete existing java_home and take a location of ur jdk/bin and paste into PATH field in environment> system variables after setting into that path field save it then start your ADK it will work,.

Categories

Resources