1.2 Setting classpath for Java

Setting Java Path on Windows 7/8.1/10

  • Select Computer from the Start menu

  • Choose System Properties from the context menu

  • Click Advanced system settings --> Advanced tab

  • Click on Environment Variables, under System Variables, find PATH, and click on it.

  • In the Edit windows, modify PATH by adding the location of the class to the value for PATH.

  • If you do not have the item PATH, you may select to add a new variable and add PATH as the name and the location of the class as the value.

  • Reopen Command prompt window, and run your java code.

Is Java installed properly?

You can check if you have installed Java correctly by:

• Running the command java -version from the command line.When you enter the following codes into your command line:

  • javac

  • java

  • java -version

If you receive a message that stating that ’java’ is not recognized... then you do not have Java installed properly. If you have Java installed then running the command java -version will show the version number of the Java installation.

Last updated

Was this helpful?