javac:找不到文件:first.java用法:javac< options> < source files> [英] javac: file not found: first.java Usage: javac <options> <source files>

查看:279
本文介绍了javac:找不到文件:first.java用法:javac< options> < source files>的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我在记事本++中的桌面上保存了一个名为first.java的文件名。当我运行cmd命令javac first.java时,它给了我这个错误。

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 not found: first.java 
Usage: javac <options> <source files>

我知道您需要转到C:\Programfiles\java\jdk。

I know you are required to go to C:\Programfiles\java\jdk.

并在我的C:\Program Files \ JavaA中我有thesE文件夹

and in my C:\Program Files\Java\ I have thesE folders

jdk1 .8.0
jre6
jre8

"jdk1.8.0" "jre6" "jre8"

在C:\Program Files(x86)\ Java
I有这个文件夹

jre6

In C:\Program Files (x86)\Java I have this folder
"jre6"

环境设置如下

CLASSPATH

C:\Program Files\Java \ jre8 \ bin

变量名称:LEJOS_NXT_JAVA_HOME

变量值: C:\程序文件(x86)\ Java \ jdk1.6.0_21 \ bin

CLASSPATH
C:\Program Files\Java\jre8\bin
Variable name: LEJOS_NXT_JAVA_HOME
Variable value: C:\Program Files (x86)\Java\jdk1.6.0_21\bin

路径

变量名称:路径

变量值:C:\Program Files\Java\jdk1.8.0\bin

PATH
Variable name: PATH
Variable value: C:\Program Files\Java\jdk1.8.0\bin

请告诉我哪里出错了我已经阅读了互联网上的几篇帖子,我无法弄明白。

Please tell me where I am going wrong. I have read several posts on the Internet, and I can't figure it out.

推荐答案

as nAvEeD kHaN 已声明,您需要设置路径。

As nAvEeD kHaN has stated, you need to set your path.

但是为了让你的JDK在将来利用Maven等工具,我会指定一个 JAVA_HOME 路径指向你的JDK文件夹然后只是将%JAVA_HOME%\ bin 目录添加到 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






在Windows中:


In Windows:


  1. 右键单击我的电脑,然后从上下文菜单中选择属性。

  2. 选择左侧的高级系统设置。

  3. 在系统属性弹出窗口的高级选项卡中,c hoose环境变量

  4. 在环境变量弹出窗口的系统变量部分下,单击新建

  5. 键入< 变量名称字段中的strong> JAVA_HOME

  6. 路径粘贴到JDK文件夹 进入变量值field。

  7. 单击确定

  8. 在同一部分中,选择路径并更改文本它说:

  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

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

       to:

      to:

&NBSP;&NBSP;&NBSP;&NBSP;&NBSP;&NBSP; 等等;等等;等等; %JAVA_HOME%\bin; blah,blah; blah

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

这篇关于javac:找不到文件:first.java用法:javac&lt; options&gt; &lt; source files&gt;的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆