Setting up enviromental variables in Windows 10 to use java and javac

后端 未结 7 1317
再見小時候
再見小時候 2020-11-30 23:36

I got a new laptop with Windows 10 and I want to set it up so I can use java and javac from the command line.

I have searched online but al

相关标签:
7条回答
  • 2020-11-30 23:57
    • Right click Computer
    • Click the properties
    • On the left pane select Advanced System Settings
    • Select Environment Variables
    • Under the System Variables, Select PATH and click edit,
      and then click new and add path as C:\Program
      Files\Java\jdk1.8.0_131\bin
      (depending on your installation path)
      and finally click ok
    • Next restart your command prompt and open it and try javac
    0 讨论(0)
  • 2020-12-01 00:00

    Adding Environment Variable simplified with screenshot. Check the below URL and you should be able to do without any trouble.

    https://itsforlavanya.blogspot.com/2020/08/environment-variable-simple-7-steps-to.html

    0 讨论(0)
  • 2020-12-01 00:11

    Just set the path variable to JDK bin in environment variables.

    Variable Name : PATH 
    Variable Value : C:\Program Files\Java\jdk1.8.0_31\bin
    

    But the best practice is to set JAVA_HOME and PATH as follow.

    Variable Name : JAVA_HOME
    Variable Value : C:\Program Files\Java\jdk1.8.0_31
    
    Variable Name : PATH 
    Variable Value : %JAVA_HOME%\bin
    
    0 讨论(0)
  • 2020-12-01 00:12

    To find the env vars dialog in Windows 10:

    Right Click Start
    >>  Click Control Panel  (Or you may have System in the list)
    >>  Click System
    >>  Click Advanced system settings
    >>  Go to the Advanced Tab
    >>  Click the "Environment Variables..." button at the bottom of that dialog page.
    
    0 讨论(0)
  • 2020-12-01 00:13

    Its still the same concept, you'll need to setup path variable so that windows is aware of the java executable and u can run it from command prompt conveniently

    Details from the java's own page: https://java.com/en/download/help/path.xml That article applies to: •Platform(s): Solaris SPARC, Solaris x86, Red Hat Linux, SUSE Linux, Windows 8, Windows 7, Vista, Windows XP, Windows 10

    0 讨论(0)
  • 2020-12-01 00:18

    if you have any version problems (javac -version=15.0.1, java -version=1.8.0)
    then delete these in your system variable path
    C:\Program Files (x86)\Common Files\Oracle\Java\javapath
    C:\Program Files\Common Files\Oracle\Java\javapath

    then if you're using java 15
    path = C:\Program Files\Java\jdk-15.0.1\bin
    is enough

    if you're using java 8
    JAVA_HOME = C:\Program Files\Java\jdk1.8.0_271
    path = %JAVA_HOME%\bin

    0 讨论(0)
提交回复
热议问题