X
wikiHow is a “wiki,” similar to Wikipedia, which means that many of our articles are co-written by multiple authors. To create this article, 9 people, some anonymous, worked to edit and improve it over time.
This article has been viewed 50,315 times.
Learn more...
Most of the time as java developer, one of the first thing you do to set up on you new computer is java environment. This is basically telling your cmd (windows) terminal (mac or Linux) where to find the java.
java / javac (the compiler) is all under your java installation directory.
We assume that you have successfully downloaded and installed the JDK or JRE. If you are a developer we suggest you to download the latest JDK (Java Developer Kit).
Steps
Method 1
Method 1 of 2:
On Windows
-
1Click Start then right Click on "Computer" and choose "Properties."
-
2On the new window click "Advance system settings."Advertisement
-
3Choose "Environment Variables."
-
4Create variable with the following properties: name: JAVA_HOME , value: your path to jdk
-
5Update the PATH variable by appending %JAVA_HOME%\bin at the end
-
6Click the Save button
-
7Click Start > new > cmd
-
8When you type following you should see the newly installed java version
- java -version
Advertisement
Method 2
Method 2 of 2:
Linux
-
1in your .bashrc or .bash_profile file append following
- export JAVA_HOME=<your-java-dir>
- export PATH=$PATH:$JAVA_HOME/bin
-
2save the file
-
3in terminal type:
- . .bash_profile or . .bashrc (note that you have a space) this tells your terminal to load the updated file in current terminal so you get the newly created java in your path
-
4You should see java version printed when you type following:
- java -version
Advertisement
About This Article
Advertisement