javac: file not found: first.java Usage: javac

前端 未结 14 1177
醉梦人生
醉梦人生 2020-12-10 06:42

I have a filename named \"first.java\" saved on my desktop in notepad++. When I run the cmd command \"javac first.java\" it gives me this error.

javac: file          


        
14条回答
  •  忘掉有多难
    2020-12-10 06:46

    As KhAn SaAb has stated, you need to set your path.

    But in order for your JDK to take advantage of tools such as Maven in the future, I would assign a JAVA_HOME path to point to your JDK folder and then just add the %JAVA_HOME%\bin directory to your PATH.

    JAVA_HOME = "C:\Program Files\Java\jdk1.8.0"
    PATH = %PATH%\%JAVA_HOME%\bin
    

    In Windows:

    1. right-click "My Computer" and choose "properties" from the context menu.
    2. Choose "Advanced system settings" on the left.
    3. In the "System Properties" popup, in the "Advanced" tab, choose "Environment Variables"
    4. In the "Environment Variables" popup, under the "System variables" section, click "New"
    5. Type "JAVA_HOME" in the "Variable name" field
    6. Paste the path to your JDK folder into the "Variable value" field.
    7. Click OK
    8. In the same section, choose "Path" and change the text where it says:

          blah;blah;blah;C:\Program Files\Java\jdk1.8.0\bin;blah,blah;blah

          to:

          blah;blah;blah;%JAVA_HOME%\bin;blah,blah;blah

提交回复
热议问题