How to set path in java

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • namdeva
    New Member
    • Jun 2017
    • 5

    How to set path in java

    Hi Guys,

    can anybody explain me how to set temporary and permanent path in java
    Last edited by Rabbit; May 10 '18, 05:03 PM. Reason: removed advertisement link
  • chaarmann
    Recognized Expert Contributor
    • Nov 2007
    • 785

    #2
    Temporary:
    If you open the command line, you can set the environment variables PATH and CLASSPATH before starting the java compiler.

    permanent:
    You can give a value to the environment vaiables in windows under advanced sytsem settings.

    Comment

    • deepsky
      New Member
      • Apr 2018
      • 1

      #3
      PATH can be set using the system utility in the Windows Control Panel or by using the Linux and Solaris shell startup file. On computers running Windows or Mac OS X, you do not normally need to make changes to PATH. If you can't configure it, you can use or read tutorial on this topic https://docs.oracle.com/javase/tutor...ent/paths.html.
      Last edited by Rabbit; May 10 '18, 05:03 PM. Reason: removed advertisement link

      Comment

      • sultanhameed
        New Member
        • Apr 2018
        • 2

        #4
        To set the temporary path of JDK, you need to follow following steps:

        1- Open command prompt
        2- Copy the path of jdk/bin directory
        3- Write in command prompt: set path=copied_pat h

        For Example:

        set path=C:\Program Files\Java\jdk1 .6.0_23\bin

        Comment

        • Inteldrour
          New Member
          • May 2018
          • 1

          #5
          I'm using Windows 8.1, and I have both JDK6 and JDK8 installed. For development purposes, I needed to get the java version "1.6.0_45" at the command java -version and javac 1.6.0_45 over javac -version. The second command worked as expected after installing JAVA_HOME as the JDK6 start folder and adding% JAVA_HOME / bin% to Path. However, the first command still returned the java version "1.8.0_71"
          Solution was necessary for my programing
          Troubleshoot problems

          I could find an entry in the Path environment variable that points to C: \ ProgramData \ Oracle \ Java. This folder actually contains a short link to java.exe JDK8.

          The Correct Solution: Remove JDK 8

          Workaround: edit the short message file so that it points to java.exe inside% JAVA_HOME% \ bin (Please replace the variable with the actual folder)
          Last edited by Rabbit; May 10 '18, 05:02 PM. Reason: removed advertisement link

          Comment

          • Ishan Shah
            New Member
            • Jan 2020
            • 47

            #6
            You should follow the following steps to set the java path:

            1) Type advanced system setting in the serach field
            2) Click on the View advanced system settings
            3) System property windows will get open, then click on Environment Variables
            4) In system variables click on the New button and enter JAVA_HOME as varible name and the path of your java JDK directory in Variable value
            5) Update System PATH by select path under System varibales
            6) Then click on Edit
            7) In the Edit Environment Variable window click on New
            8) then type in %JAVA_HOME%\bin
            9) Tests your configuration by opening a new command prompt and type in "echo %JAVA_HOME%" then type in it: "javac -version" to check the java version

            Comment

            Working...