importing external jar files

谁说胖子不能爱 提交于 2019-12-30 00:41:31

问题


I have written a Java code which imports an external jar file. How can I compile and run it on the command-line?

Thanks in advance!


回答1:


Compiling from the command-line:

javac -cp path_to_jar1.jar:path_to_jar2.jar Example.java

Running:

java -cp .:path_to_jar1.jar:path_to_jar2.jar Example

For Windows, use ; as a path-separator (instead of :).



来源:https://stackoverflow.com/questions/4421730/importing-external-jar-files

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!