How can I set the PATH variable for javac so I can manually compile my .java works?(如何为 javac 设置 PATH 变量,以便手动编译我的 .java 作品?)
问题描述
这是我驱动器上的地址:
Here's the address on my drive:
C:Program FilesJavajdk1.6.0_18in
C:Program FilesJavajdk1.6.0_18in
我将如何设置路径变量,以便我可以进入命令窗口 (windowskey+r "cmd") 并能够输入如下内容:
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.
推荐答案
每次启动时在命令 shell 中键入 SET PATH 命令可能会让你很快变老.三种选择:
Typing the SET PATH command into the command shell every time you fire it up could get old for you pretty fast. Three alternatives:
- 从批处理 (
.CMD) 文件运行 javac.然后,您可以在执行javac之前将SET PATH放入该文件中.或者,如果您只是编写javac.exe 的显式路径,则可以不使用 - 在系统的环境变量"配置中设置增强的、改进的
PATH. - 从长远来看,您会希望使用 Ant 自动编译 Java.但这需要首先对
PATH进行另一个扩展,这使我们回到 (1) 和 (2).
SET PATH- Run javac from a batch (
.CMD) file. Then you can just put theSET PATHinto that file before yourjavacexecution. Or you could do without theSET PATHif you simply code the explicit path tojavac.exe - Set your enhanced, improved
PATHin the "environment variables" configuration of your system. - In the long run you'll want to automate your Java compiling with Ant. But that will require yet another extension to
PATHfirst, which brings us back to (1) and (2).
这篇关于如何为 javac 设置 PATH 变量,以便手动编译我的 .java 作品?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持编程学习网!
本文标题为:如何为 javac 设置 PATH 变量,以便手动编译我的 .java 作品?
基础教程推荐
- 使用堆栈算法进行括号/括号匹配 2022-01-01
- REST Web 服务返回 415 - 不支持的媒体类型 2022-01-01
- 问题http://apache.org/xml/features/xinclude测试日志4j 2 2022-01-01
- RabbitMQ:消息保持“未确认"; 2022-01-01
- Spring AOP错误无法懒惰地为此建议构建thisJoinPoin 2022-09-13
- Struts2 URL 无法访问 2022-01-01
- 如何对 Java Hashmap 中的值求和 2022-01-01
- 存储 20 位数字的数据类型 2022-01-01
- 无法复制:“比较方法违反了它的一般约定!" 2022-01-01
- 修改 void 函数的输入参数,然后读取 2022-01-01
