Why do JAVA_HOME environment variable values point to the SDK directory instead of bin?
Usually to run Java applications, we set the JAVA_HOME value to the java sdk directory/bin
But when I try to open Android Studio, it gives an error stating that the JVM is not configured in your machine and cannot be opened.
If we reconfigure JAVA_HOME to only the java sdk directory path, it will work. But I wonder why this is so??
If it is reconfigured as an sdk path, then my other java applications will not work. Please let me know what you think about this.
Update: When JAVA_HOME var is configured to the correct JDK directory, look at the image below, javac does not execute at the command prompt
Thank you
Navigation
Solution
Generally inorder to run Java applications we set JAVA_HOME value to java sdk directory/bin
No. Traditionally, JAVA_HOME is set to the JRE or SDK home directory. However, the bin/ subdirectory may be in your PATH.
I have changed the values, AndroidStudio works fine but when I enter javac in command prompt it gives me error as Not Recoginzed
That’s because your PATH
isn’t right. Your PATH
needs to point to the bin/
directory in the Java SDK. My guess is that your PATH
references JAVA_HOME, but assume (incorrectly)
JAVA_HOME
point to that bin/
directory. Just change your PATH
to make sure it selects the bin/
directory.