How do I import jars into my java program?

前端 未结 13 1425
自闭症患者
自闭症患者 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:56

    I faced the same problem during work on this course, but for windows. I'll leave this comment here in case it will help somebody.

    If you use DrJava you don't need any import statements in code. If you followed installation steps described in course, everything is configured for you.

    But here can be a problem - it puts jar files in your current user directory, path to which can contain inappropriate symbols(russian letters in my case). You need to check it in Edit -> Preferences menu. You can see there algs4.jar and stdlib.jar paths. Make sure that this path are correct and point to real existing files.

    I just moved all necessary files to another dir and changed paths in this menu. It solved this problem for me.

提交回复
热议问题