how to include libraries in java without using an IDE

前端 未结 6 1725
抹茶落季
抹茶落季 2020-11-27 04:35

How do I import libraries in my java program without using an IDE like Netbeans? In Netbeans I do it this way: \"enter

6条回答
  •  不知归路
    2020-11-27 05:05

    You should put them on your classpath, like

    java -classpath someJar.jar YourMainClass

    And, of course, you can do the same for javac.

    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

    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.

提交回复
热议问题