✌️ Prerequisite : You have installed Java Runtime Environment (any version jre6, jre7 or jre8)
Let's see how you can set Java_Home Environment variable for Windows Operating systems,Step 1. Find-out where JRE has been installed
Once you install JRE you need to locate where java has been installed on your system. And the folder that you need to look for is Program Files
⚡️ Note : If you have a 64-bit Windows Operating system installed then you will have 2 program files folders under C:/
- Program Files
- Program Files(x86)
If you find the Java folder under "Program Files(x86)" then the installed java version is 32-bit if you find it under "C:/Program Files/Java" means Java version is 64-bit.
Look that you can see jre6 folder under java directory, i.e. : C:/Program Files/Java/jre6 or C:/Program Files(86)/Java/jre6
Step 2. Setting-up JAVA_HOME
- Right Click on My Computer icon and select Properties option and Select Advance tab.
- Now look for Environment Variable button and Click on it.
- Now look for System Variables and click on New,
- Add Variable name => JAVA_HOME and Variable value => C:/Program Files/Java/jre7 or C:/Program Files(86)/Java/jre7
- Click OK and Apply Changes.
For Windows 7
- Go to Start menu and select Computer
- Select System Properties from the context menu
- Now click on Advanced system settings and go to Advanced tab
- Now click on Environment Variables
- Under System Variables look for PATH.
- Modify PATH by adding the location of the class to the value for PATH.
- Reopen Command prompt window, run your java code, if the code works, path is been set correctly.
Setting JAVA_HOME using Eclipse
You can set the Java environment variable in eclipse by going to,
Eclipse -> Window -> Preferences -> Java -> Installed JREs
Now here you can search for the location where the JRE is been installed and select it.
- Java -Day of the week using Java 8 DayOfWeek Enum
- Java: TimeZone List with GMT/UTC Offset
- Struts 2 Hello World Example in Eclipse
- Formatting Double in Java [Examples]
- Convert Java Array to ArrayList Code Example
- Exception in thread main java.lang.NoClassDefFoundError: package javaClass
- How to serialize-deserialize an object in java
- Maven Unsupported major.minor version 51.0
- [Fix] java.net.MalformedURLException: unknown protocol
- [Java Threads] Should we extend Thread Class or implement Runnable interface
- connection.url property value in hibernate.cfg.xml for mysql
- IntelliJ: Error: Could not find or load main class, java.lang.ClassNotFoundException
- 5+ Fibonacci number Series Java Program Examples [ 0 1 1 2 3 ..]
- [Java] NoClassDefFoundError Caused by: java.lang.ClassNotFoundException: org.apache.commons.logging.LogFactory
- Java Split String by Spaces
- Java SE 8 Update 301 available with various bug fixes and security improvements
- Java - PatternSyntaxException
- Split a String in Java with Examples
- Convert byte array to String in Java
- Run Java Code Every Second
- Difference between using Scanner Class and String args for user input in Java
- Remove Trailing zeros BigDecimal Java
- Best free Decompiler for Java
- Unsupported major.minor version 52.0 in java
- java.io.IOException: Unable to locate resource handler.properties