[英]Setting absolute ClassPath system variable
I feel like I'm losing it slightly, 我觉得我有点失去了,
I've got my JDK setup with my PATH variables so javac works fine. 我已经使用PATH变量设置了JDK,因此javac可以正常工作。
I'm trying to add environment variables under CLASSPATH so I don't have to repeatedly use -cp
flag. 我正在尝试在CLASSPATH下添加环境变量,因此不必重复使用
-cp
标志。
I'm constantly compiling my .java files in T:\\WEB-INF\\classes\\myPack\\Applications\\myApp\\
我一直在
T:\\WEB-INF\\classes\\myPack\\Applications\\myApp\\
编译我的.java文件
So at the moment I'm using the command javac -cp "..\\..\\..\\;..\\..\\lib\\*" *.java
which compiles my files fine. 因此,目前我正在使用命令
javac -cp "..\\..\\..\\;..\\..\\lib\\*" *.java
来编译我的文件。 But it's ugly and I hate typing it. 但这很丑,我讨厌打字。
T:\\WEB-INF\\classes\\myPack\\ - Contains my custom classes I need to import
T:\\ WEB-INF \\ classes \\ myPack \\-包含我需要导入的自定义类
T:\\WEB-INF\\classes\\myPack\\lib\\ (....\\lib*) - Contains my third-party .jar files
T:\\ WEB-INF \\ classes \\ myPack \\ lib \\(.... \\ lib *)-包含我的第三方.jar文件
However when I use absolute paths, it can't find the custom classes. 但是,当我使用绝对路径时,它找不到自定义类。
.;T:\WEB-INF\classes\myPack\lib\* - works fine - missing classes!
.;..\..\..\;T:\WEB-INF\classes\myPack\lib\* - works fine!
.;T:\WEB-INF\classes\myPack;T:\WEB-INF\classes\myPack\lib\* - Doesn't find the classes in the myPack folder.
I've looked it up and you don't need an asterisk if you want it to find class files so T:\\WEB-INF\\classes\\myPack\\ should be the correct path. 我查找了它,如果希望它查找类文件,则不需要星号,因此T:\\ WEB-INF \\ classes \\ myPack \\应该是正确的路径。
Am I missing something? 我想念什么吗?
Thanks, 谢谢,
First I would use "/" instead of "\\". 首先,我将使用“ /”而不是“ \\”。 You can use double-splash like so "\\\\".
您可以像这样使用双飞溅“ \\\\”。 You can specify the folders where the .class live.
您可以指定.class所在的文件夹。 Base on Oracle documentation, (class)path with wildcard /* can be specified to pickup zip and jar files within the directory.
根据Oracle文档,可以指定带有通配符/ *的(class)path来拾取目录中的zip和jar文件。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.