How should i use a jar file?
问题 I have a jar file which contains some classes those which i want to use in my project. I am working in command line and not in eclipse. Please tell me how i should use those classes in the jar file for my project. 回答1: Use the -classpath command line option: javac -classpath library.jar MyProgram.java And then to run it, specify the classpath again - including where your actual code is: java -classpath library.jar;. MyProgram (That's assuming you're using Windows. On Unix use : instead of ;