Prerequisite : You have installed Java Runtime Environment (any version jre6, jre7, or jre8)
Let's see how you can set the JAVA_HOME Environment variable for Windows Operating systems,
Step 1. Find out where JRE has been installedOnce 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 the 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 the 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/Window 10/Windows 11
- 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, and run your java code, if the code works, the 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.
- Create a Zip file using Java Code programmatically
- Eclipse : A java Runtime Environment (JRE) or Java Development kit (JDK) must be available
- How to Sort a LinkedList in Java
- Loading class com.mysql.jdbc.Driver. This is deprecated. The new driver class is com.mysql.cj.jdbc.Driver
- How to declare and initialize Array in Java Programming
- [Fix] java: integer number too large compilation error
- Java JDBC Connection with MySQL Driver in VS Code + Troubleshooting
- Reading .xls and .xlsx Excel file using Apache POI Java Library
- IntelliJ: Error: Could not find or load main class, java.lang.ClassNotFoundException
- How to get Client IP address using Java Code Example
- Truncate table using Java JDBC Example
- Struts 2 : There is no Action mapped for namespace [/] and action name [form] associated with context path [/proj]
- How to get file path in Idea IntelliJ IDE
- Java Generics explained with simple definition and examples
- Java SE 8 Update 301 available with various bug fixes and security improvements
- Java: Collect Stream as ArrayList or LinkedList
- Java JDBC Connection with PostgreSQL Driver Example
- How to check if Java main thread is alive
- How to fix Java nio NoSuchFileException wile reading a file
- Java 8+ get Day of the Week Examples with LocalDateTime, DateTime, ZonalDateTime and Instant classes
- Ways to Convert Integer or int to Long in Java
- [Java] How to throws Exception using Functional Interface and Lambda code
- [Fix] Spring Boot: mysql.cj.jdbc.exceptions.CommunicationsException: Communications link failure
- Java: The value of the local variable string is not used
- Java JDBC: Insert Java 8 LocalDate and Time using PreparedStatement
- macOS Ventura: In order to use Xcode.app you need to update to the latest version - MacOS
- JavaScript : Get current page address - JavaScript
- How to verify if java is installed on the computer and get version detail - Java
- List of all iPads till year 2020 - Apple
- How to fix Java nio NoSuchFileException wile reading a file - Java
- Location of eclipse.ini file on Mac OS X - Mac-OS-X
- Vertical align two div's in Bootstrap [HTML CSS] - Bootstrap
- ChatGPT Outage: Hmm...something seems to have gone wrong. Maybe try me again in a little bit. - HowTos