How do I import jars into my java program?

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

    I had this same problem. Renfei Wang's solution worked for me (I don't have enough points yet to comment directly on his response).

    In Sublime, navigate to Preferences: Browse Packages>JavaC.sublime_build.

    Here's what mine looks like:

    {
        "cmd": ["javac", "-cp", "/Users/jason/Documents/lib/*:./","$file"],
        "file_regex": "^(...*?):([0-9]*):?([0-9]*)",
        "selector": "source.java"
    }
    

    /Users/jason/Documents/lib/*:/ lets Sublime know the location of the directory that holds my packages, so that now when I build, it loads those packages first.

提交回复
热议问题