javac命令提示符参数
我的机器上安装了java,我想编译这组源代码。但是当我打开命令提示符并输入javac时,命令提示符说这是一个未知参数。当我想用 ant 构建一些东西时,也发生了同样的事情(如果你想知道的话,我有 build.xml)并且发生了同样的事情。如何设置 javac 和 ant 命令在任何目录中使用?
I installed java on my machine and I wanted to compile this group of source code. But when I opened up the command prompt and typed in javac, the command prompt said it was an unknown parameter. The same thing happened when I wanted to build something with ant (I had the build.xml if you are wondering) and the same thing happened. How can I set the javac and ant command to be used in any directory?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(3)
首先,您必须确保安装了JDK,而不仅仅是JRE
其次,这取决于您的操作系统:
然后您需要设置两件事:
注意一点:在 OSX 上,也许 Linux 上也是如此必须用双冒号“:”而不是分号“;”来分割 PATH 变量中的路径
First of all you have to be sure you installed JDK and not only JRE
Secondly it depends on your operating system:
Then you need to set two things:
One note: on OSX, and maybe Linux too you have to split paths in PATH variable with double colon ':' instead that semicolon ';'
将可执行文件所在的目录添加到
PATH
环境变量中。Add the directory the executable is in to the
PATH
environment variable.猜测您使用的是 Windows。右键单击
我的电脑
,然后单击管理
。然后,在高级
选项卡中,选择环境变量
。在新窗口中的系统变量
下,找到Path
并将完整路径附加到二进制文件(javac
和ant
>) 最后,用分号分隔。Guessing that you are using Windows. Right click
My Computer
and clickManage
. Then, in theAdvanced
tab, selectEnvironment Variables
. In the new window, underSystem variables
, findPath
and append the full path to the binaries (javac
andant
) at the end, separated by semicolons.