如何设置javac的PATH变量,所以我可以手动编译我的.java工程? [英] How can I set the PATH variable for javac so I can manually compile my .java works?

查看:159
本文介绍了如何设置javac的PATH变量,所以我可以手动编译我的.java工程?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

这是我的驱动器上的地址:

Here's the address on my drive:


C:\Program Files\Java\jdk1.6.0_18\bin

C:\Program Files\Java\jdk1.6.0_18\bin

我如何设置路径变量,所以我可以在命令窗口(windowskey + rcmd),键入以下内容:

How would I go about setting the path variable so I can go in command window (windowskey+r "cmd") and be able to type things like:

javac TestApp.java

我使用的是Windows 7专业版。

I'm using Windows 7 Professional.

推荐答案

$ c> SET PATH 命令到命令shell中每次你启动它可以很快老你。三种备选方案:

Typing the SET PATH command into the command shell every time you fire it up could get old for you pretty fast. Three alternatives:


  1. 从批处理( .CMD )文件运行javac。然后,您可以在执行 javac 之前将 SET PATH 放入该文件。或者你可以不使用 SET PATH ,如果你简单地编写显式路径到 javac.exe

  2. 在系统的环境变量配置中设置增强的,改进的 PATH 。这里有一个关于Windows XP的文档: http://vlaurie.com/computers2/Articles/ environment.htm

    和...找到了!这是一个更好看的Windows 7:
    http://www.itechtalk.com/ thread3595.html

  3. 从长远来看,您希望使用 Ant 。但是,这将需要再次扩展到 PATH ,这将使我们回到(1)和(2)。

  1. Run javac from a batch (.CMD) file. Then you can just put the SET PATH into that file before your javac execution. Or you could do without the SET PATH if you simply code the explicit path to javac.exe
  2. Set your enhanced, improved PATH in the "environment variables" configuration of your system. Here's a document all about this for Windows XP: http://vlaurie.com/computers2/Articles/environment.htm
    and... found it! Here's an even nicer looking one for Windows 7: http://www.itechtalk.com/thread3595.html
  3. In the long run you'll want to automate your Java compiling with Ant. But that will require yet another extension to PATH first, which brings us back to (1) and (2).

这篇关于如何设置javac的PATH变量,所以我可以手动编译我的.java工程?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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