How do I set or change the PATH system variable?

+12 votes

'java' is not recognized as an internal or external command,
operable program or batch file.

This is the error I am getting can you please help me fix this?

Aug 28, 2018 in Java by eatcodesleeprepeat
• 4,670 points
78 views

3 answers to this question.

+4 votes

First make sure you have installed JDK properly and then follow these steps.

  1. Right click on My Computer
  2. Select Properties
  3. Select Advanced System Settings
  4. Select Advanced tab
  5. Select Environment Variables
  6. Select Path under System Variables
  7. Click on Edit button
  8. In Variable value editor paste this at the start of the line. Note: You have to mention the path of the version you have installed. I have installed jdk1.7.0_72 so my will be the line I add.

    C:\Program Files\Java\jdk1.7.0_72\bin;
  9. Click Ok then Ok again

  10. Restart command prompt otherwise it won't see the change to the path variable
  11. Type java -version in command prompt.
answered Aug 28, 2018 by slayer
• 29,050 points
+3 votes

First step is to copy the path

second step open system in control pannel and select advanced system settings

 

third step is in advanced tab select environment variable

fourth step is set path variable with a semi-colon and paste the path you copied.

There you are ready to go!

answered Aug 28, 2018 by bug_seeker
• 15,310 points
+2 votes

This error occurs when you haven't added the right directory to your PATH.

First find out which directory you've installed java in and try running it directly. Something like this in my case:

c:\> "c:\Program Files\java\jdk1.7.0_11\bin\java" -version

Once you've got the right version add the bin directory to the PATH environment.

answered Aug 28, 2018 by Kalgi
• 37,320 points

Related Questions In Java

0 votes
1 answer

How do I get the current date and time using Java?

To print current date and time using ...READ MORE

answered Apr 13, 2018 in Java by Akrati
• 3,150 points
55 views
0 votes
1 answer

How do I create a Java string from the contents of a file?

If you're looking for an alternative that ...READ MORE

answered Apr 19, 2018 in Java by Rishabh
• 3,540 points
72 views
0 votes
2 answers

How can I get the filenames of all files in a folder which may or may not contain duplicates

List<String> results = new ArrayList<String>(); File[] files = ...READ MORE

answered Sep 12, 2018 in Java by Sushmita
• 6,840 points
587 views
0 votes
1 answer

How can I get the current date and time in UTC or GMT in Java?

This definitely returns UTC time: as String ...READ MORE

answered Jun 7, 2018 in Java by Rishabh
• 3,540 points
4,521 views
0 votes
1 answer

How do I get the size of a java.sql.ResultSet?

Give column a name.. String querys = "SELECT ...READ MORE

answered Jul 2, 2018 in Java by samarth295
• 2,190 points
871 views
+2 votes
1 answer

How do I ask the Selenium-WebDriver to wait for few seconds in Java?

There are two ways to wait: explicit ...READ MORE

answered Dec 19, 2018 in Java by Daisy
• 8,040 points

edited Dec 19, 2018 by Daisy 42 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 6,163 views
0 votes
1 answer

How to handle drop downs using Selenium WebDriver in Java

First, find an XPath which will return ...READ MORE

answered Mar 27, 2018 in Selenium by nsv999
• 5,050 points
1,620 views
0 votes
1 answer

What are the differences between getText() and getAttribute() functions in Selenium WebDriver?

See, both are used to retrieve something ...READ MORE

answered Apr 5, 2018 in Selenium by nsv999
• 5,050 points
4,321 views
0 votes
1 answer

Selenium JARS(Java) missing from downloadable link

Nothing to worry about here. In the ...READ MORE

answered Apr 5, 2018 in Selenium by nsv999
• 5,050 points
334 views