Thursday, 21 May 2015

How to set path in Java

It is necessary to point the java compiler (javac) to your programming directory where your programs are written and developed. Then only the JVM will identifies and run your code. If you already installed JDK on your system check it weather path for java compiler is set or not.

               If your saving your java programs inside JDK/BIN directory then there is no need to set the path for your programs. Because all the tool that are need to run your java program are automatically available.

        If your saving java programs on the other directories then the path for java compiler is needed. One can set the java path in Two ways.

        1. Setting java path Temporally
        2. Setting java path Permanently

  1. How to Set java path Temporally in windows 

  • Open the commend prompt 
  • Change to your java programming directory.
  • Copy the JDK/BIN path.
  • Write in the command prompt as 

          Set path = " your JDK/BIN path here";

Now check, if the path is set correctly or note by typing " javac". If it returns all java compiler options then java path for directory is successfully set. Otherwise it returns " javac is not recognized as internal or external command".

  2. How to java path Permanently in windows

               One can set java path Permanently in windows by setting up environmental variable to your JDK. It includes the following few steps.

1. Right click on the my computer and click on properties
2. Click on the Advanced tab
3. Click on the Environmental variable tab.
4.Click on the NEW tab under the user variables.
5. Under the new variable window in variable name enter " path" and in variable value " past your JDK path " and end with a semicolon.

6. Click on the OK buttons to save your setting and restart your computer.
7. Now your java path is Permanently set.


      Now you can run your java program from any directory in your system.


Post a Comment

Note: only a member of this blog may post a comment.

Find Us On Facebook

python tutorial


C Programming


Java Tutorial


Data Structures


MS Office


Database Management