更新时间:2023-08-23 10:49:40
您应该将它们放在类路径上,喜欢
You should put them on your classpath, like
java -classpath someJar.jar YourMainClass
当然,你也可以为javac做同样的事情。
And, of course, you can do the same for javac.
如果你需要在类路径上有多个jar或目录,你需要使用您平台的默认路径分隔符 。例如,在Windows上,
If you need to have more than one jar or directory on your classpath, you'll need to use your platform's default path separator. For example, on Windows,
java -classpath someJar.jar; myJar.jar YourMainClass
在旁注中,您可能会发现使用IDE管理这类内容更容易。我个人使用了我的略微可编写脚本的编辑器并且管理得很好。但是知道如何通过命令行完成这些工作很好。
On a side note, you might find it easier to use an IDE to manage this sort of stuff. I've personally used just my slightly scriptable editor and have managed fine. But it's good to know how to do this stuff by command line.