如何在 javac/java 类路径中添加多个 .jar 文件 - 适用于 Debian Linux

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/10056895/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me): StackOverFlow

提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-08-06 05:39:34  来源:igfitidea点击:

How to add multiple .jar files in the javac/java class path - for Debian Linux

javalinuxdebian

提问by alessandro

How to add multiple .jar files in the javac/java class path - for Debian Linux.

如何在 javac/java 类路径中添加多个 .jar 文件 - 适用于 Debian Linux。

Iam using,

我在用,

javac -cp a.jar folder1\folder2\b.jar Test.java

javac -cp a.jar folder1\folder2\b.jar Test.java

But, it is giving Invalid flag error. Can anybody help me how to compile and run it ?

但是,它给出了无效标志错误。任何人都可以帮助我如何编译和运行它?

采纳答案by Louis Wasserman

Separate the class path entries by :colons, not spaces.

:冒号而不是空格分隔类路径条目。

回答by Filipp

Also you should use '/' instead of '\' as directory separator.

此外,您应该使用 '/' 而不是 '\' 作为目录分隔符。

回答by dzmanto

Also use quotation marks " to specify a classpath when using Powershell:

在使用 Powershell 时,还要使用引号 " 来指定类路径:

 javac -cp ".;folder1\folder2\b.jar" Test.java