且构网

分享程序员开发的那些事...
且构网 - 分享程序员编程开发的那些事

如何在类路径中运行带有jar的java类?

更新时间:2023-01-10 11:36:54

可能:))

# On Unix
java -cp utilities.jar:. mypackage.MyClass

# On Windows
java -cp utilities.jar;. mypackage.MyClass

基本上只包括类路径上的(当前目录)以及jar文件。

Basically that's just including . (the current directory) on the classpath as well as the jar file.