How to use a class from JAR in eclipse

后端 未结 4 613
温柔的废话
温柔的废话 2021-02-10 07:36

I have two jar files - jar1 and jar2. Both of them are located in C:\\Eclipse projects\\ and I have added the paths to both of them to the Environment Variable CLASSPATH as foll

4条回答
  •  感情败类
    2021-02-10 07:54

    Why don't you use these two JARs—— stdlib-package.jar and algs4-package.jar.

    And below the code page(http://algs4.cs.princeton.edu/code/)

    Q. If I use a named package to structure my code, the compiler can no longer access the libraries in stdlib.jar or algs4.jar. Why not?

    A. The libraries in stdlib.jar and algs4.jar are in the "default" package. In Java, you can't access classes in the default package from a named package. If you need to use our libraries with a named package, you can use these package versions: stdlib-package.jar and algs4-package.jar.

    Warning: if you are taking Princeton COS 226 or Coursera, Algorithms, Part I or II, you must use the default package verison of our libraries to facilitate grading.

    Showing my test success: Showing my test success

提交回复
热议问题