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
100 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,170 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,350 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
• 41,460 points

Related Questions In Java

0 votes
2 answers

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

If you require a time stamp in ...READ MORE

answered Aug 23 in Java by Sirajul
• 29,340 points
92 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
96 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,880 points
605 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
7,028 views
0 votes
2 answers

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

You could probably do rows-count. ResultSet rs = ...READ MORE

answered Aug 22 in Java by Sirajul
• 29,340 points
1,227 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,050 points

edited Dec 19, 2018 by Daisy 62 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 9,030 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,090 points
2,138 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,090 points
5,562 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,090 points
609 views