How to add/reference .jar files in your project when you don't have an IDE

后端 未结 2 1616
甜味超标
甜味超标 2021-01-18 04:23

I am new to Java (basically a LAMP developer). I got this JAVA API to parse .pst files and show all the inbox messages.

I tried executing a given

相关标签:
2条回答
  • 2021-01-18 04:25
    javac -cp yourjar.jar YourClass.java
    

    &

    java -cp yourjar.jar YourClass
    

    You need to make all required jar available in classpath , this is how you can do it

    0 讨论(0)
  • 2021-01-18 04:30

    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.

    0 讨论(0)
提交回复
热议问题