How do I import jars into my java program?

前端 未结 13 1592
自闭症患者
自闭症患者 2021-01-04 12:52

I\'ve downloaded two jars. I want to import some of their contained classes. How do I do this?

It\'s for my algorithms class. I\'ve tried following the instructions

13条回答
  •  误落风尘
    2021-01-04 13:35

    You probably have the classpath stuff right. The class you're trying to import may not be called java.stdlib though. You need to import the fully qualified package name ... probably something like org.somecompany.ourlibrary.stdlib. Thus you would need

    import org.somecompany.ourlibrary.stdlib
    

    at the top of your Percolations.java file with the rest of the import statements.

提交回复
热议问题