简体   繁体   English

使用两个JAR解析CLASSPATH

[英]Resolve CLASSPATH with two JARs

I have a java app that needs two jar files to run. 我有一个需要两个jar文件才能运行的java应用程序。 craftbukkit.jar is the one that holds the main function, and commons-dbcp-1.4.jar is what I need to allow mysql pooling. craftbukkit.jar是保存main函数的函数,而commons-dbcp-1.4.jar是我需要允许的mysql池。 I am having issues getting the CLASSPATH to behave properly. 我在让CLASSPATH正常运行时遇到问题。

Can someone help point out what I am doing wrong here? 有人可以帮助指出我在这里做错了什么吗?

java -Xincgc -Xmx1G -cp "craftbukkit.jar;commons-dbcp-1.4.jar" org.bukkit.craftbukkit.Main nogui

Can't seem to find the Main when i do this, and without the commonds-dbcp-1.4.jar it fails to load properly. 当我这样做时似乎无法找到Main ,并且没有commonds-dbcp-1.4.jar它无法正确加载。

Add the line 添加行

Class-Path: commons-dbcp-1.4.jar

to Manifest.mf and make sure you leave an empty line at the end of the file assuming that commons-dbcp-1.4.jar is in the same directory. 到Manifest.mf并确保在文件末尾留下一个空行,假设commons-dbcp-1.4.jar位于同一目录中。

Use java -Xincgc -Xmx1G -cp craftbukkit.jar:commons-dbcp-1.4.jar org.bukkit.craftbukkit.Main nogui 使用java -Xincgc -Xmx1G -cp craftbukkit.jar:commons-dbcp-1.4.jar org.bukkit.craftbukkit.Main nogui

No quotes, and use : , not ; 没有引号,并且使用: ,不是; .

Check your "path separator". 检查“路径分隔符”。 Wich OS you are running on? 您正在运行的操作系统?

For Windows, path separator is ";". 对于Windows,路径分隔符为“;”。 On Linux you should use ":" 在Linux上你应该使用“:”

Windows: 视窗:

java -Xincgc -Xmx1G -cp "craftbukkit.jar;commons-dbcp-1.4.jar" org.bukkit.craftbukkit.Main nogui

Linux: Linux的:

java -Xincgc -Xmx1G -cp "craftbukkit.jar:commons-dbcp-1.4.jar" org.bukkit.craftbukkit.Main nogui

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM