Change Java Runtime
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).
Contents
Steps
On Windows
- Click Start then right Click on "Computer" and choose "Properties."
- On the new window click "Advance system settings."
- Choose "Environment Variables."
- Create variable with the following properties: name: JAVA_HOME , value: your path to jdk
- Update the PATH variable by appending %JAVA_HOME%\bin at the end
- Click the Save button
- Click Start > new > cmd
- When you type following you should see the newly installed java version
- java -version
Linux
- in your .bashrc or .bash_profile file append following
- export JAVA_HOME=<your-java-dir>
- export PATH=$PATH:$JAVA_HOME/bin
- save the file
- in 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
- You should see java version printed when you type following:
- java -version
Related Articles
- Increase Java Memory in Windows 7
- Run a .Jar Java File</your-java-dir>