How do I import jars into my java program?

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

    Open your Sublime

    Choose the Tools->Build System->New Build System

    Add below code to the new file

    This can tell the sublime to run the commands

    {
        "cmd": ["javac -cp /Users/yourusername/algs4/stdlib.jar:/Users/yourusername/algs4/algs4.jar:. \"$file\" && java -cp java -cp /Users/yourusername/algs4/stdlib.jar:/Users/yourusername/algs4/algs4.jar:. \"$file_base_name\""],
        "shell":true,
        "file_regex": "^(...*?):([0-9]*):?([0-9]*)",
        "selector": "source.java"
    }
    

    Hope this can help those who are following the Algorithm Course from Princeton University

提交回复
热议问题