Java Environment Variables

0 votes

Can someone list the steps that are required to setup the environment variables in Windows OS?

May 28, 2018 in Java by 93.lynn
• 1,560 points
88 views

2 answers to this question.

0 votes

In order to set up the environment variables, first, you need to download and install the latest JDK version. You can download this from here: https://goo.gl/Djcyjp.

You can look for the file according to your system configurations.

image

Once you are done, you can find the Java root folder here: C:\Program Files

Now to set the environment variables:

  1. Right click on “My Computer” and go to the properties.

  2. In System properties windows, click on the Advanced tab.

  3. In this tab, click on” Environment Variables”.image

  4. Click on new to add new variable:image

  5. Now add the below variables one by one:

    1. JAVA_HOME : C:\Program Files\Java\jdk1.8.0_112

    2. JDK_HOME  : %JAVA_HOME%

    3. JRE_HOME  : %JAVA_HOME%\jre

    4. CLASSPATH : .;%JAVA_HOME%\lib;%JAVA_HOME%\jre\lib

    5. PATH      : your-unique-entries;%JAVA_HOME%\bin

  6. Once done, click on “OK” and exit.

answered May 28, 2018 by code.reaper12
• 3,450 points
0 votes

--- To set java path ---

There are two ways to set java path

A. Temporary

  1. Open cmd
  2. Write on cmd

javac

If java is not installed, then you will see message:

javac is not recognized as internal or external command, operable program or batch file.

  1. write on cmd : set path=C:\Program Files\Java\jdk1.8.0_121\bin
  2. then write on cmd : javac you will find path is set

B. Permanent

  1. Go to "my computer" properties
  2. Click on "Advanced system settings"
  3. Click on "Environment variables"
  4. Click on new tab of user variable
  5. write path in variable name
  6. copy the path of bin folder
  7. paste path of bin folder in variable value
  8. click OK button
  9. permanent path is set now.
answered Dec 3, 2018 by Sushmita
• 6,880 points

Related Questions In Java

0 votes
1 answer

How can we set environment variables from java?

For setting the environment variable, you can ...READ MORE

answered Jun 21, 2018 in Java by Akrati
• 960 points
26 views
0 votes
4 answers

How can we define global variables in java?

class G { static String globalVar ...READ MORE

answered Jan 29 in Java by zemiak
3,672 views
+1 vote
3 answers

What is the syntax to declare and initialize an array in java?

You can use this method: String[] strs = ...READ MORE

answered Jul 25, 2018 in Java by samarth295
• 2,190 points
319 views
0 votes
2 answers

How can I convert a String variable to a primitive int in Java

 Here are two ways illustrating this: Integer x ...READ MORE

answered Aug 20 in Java by Sirajul
• 25,220 points
131 views
+4 votes
3 answers

What are the steps to set Java_home on Windows?

Set Java Home JAVA_HOME = C:\Program Files\Java\jdk1.7.0 [Location ...READ MORE

answered Sep 18, 2018 in Java by Sushmita
• 6,880 points
104 views
0 votes
1 answer

What is Classpath in java?

Classpath is a parameter in the Java virtual machine or ...READ MORE

answered Jun 5, 2018 in Java by Daisy
• 8,050 points
297 views
0 votes
1 answer

Setting JAVA_HOME in linux

find /usr/lib/jvm/java-1.x.x-openjdk vim /etc/profile Prepend sudo if logged in ...READ MORE

answered May 24 in Linux Administration by DareDev
• 6,810 points
33 views
+5 votes
3 answers

How to execute a python file with few arguments in java?

You can use Java Runtime.exec() to run python script, ...READ MORE

answered Mar 27, 2018 in Java by DragonLord999
• 8,380 points

edited Nov 6, 2018 by Omkar 8,072 views
0 votes
1 answer

ThreadLocal variables usage in Java

public class Test { // ...READ MORE

answered Jun 29, 2018 in Java by code.reaper12
• 3,450 points
37 views
0 votes
1 answer

Purpose of “String args[]” in the “psvm” of Java

Let me give you the complete explanation ...READ MORE

answered May 7, 2018 in Java by code.reaper12
• 3,450 points
87 views