How do you use a Java Library?

前端 未结 5 1949
逝去的感伤
逝去的感伤 2020-12-08 14:18

I\'m trying to use an open source java library to visualize nodes and edges in a graph, but I\'m completely lost.

I have a bunch of jar files in a folder. Clicking o

5条回答
  •  醉酒成梦
    2020-12-08 14:22

    In Eclipse, you need to add libraries to the project build path.

    In general, you need to provide dependencies via the classpath mechanisms at compile time and runtime. The precise mechanisms vary, but, for example, if you used the javac compiler, you would provide your libraries on the command line:

    javac -classpath C:\dir\lib1.jar;C:\dir\lib2.jar foo/MyClass.java
    

    These dependencies would also be required to invoke the app:

    java -classpath C:\dir\lib1.jar;C:\dir\lib2.jar;. foo.MyClass
    

    This page gives some good info, though googling for the term "classpath" should provide alternative sources.

提交回复
热议问题