Compiling and Running Java Code in Sublime Text 2

前端 未结 19 2818
执念已碎
执念已碎 2020-11-28 01:20

I am trying to compile and run Java code in Sublime Text 2. Don\'t just tell me to do it manually in the Command Prompt. Can anyone tell me how?

Btw, I am on Windows

19条回答
  •  误落风尘
    2020-11-28 01:55

    This is how I did it with these easy steps:

    Setup a new build system:

    1. Tools > Build System > New Build System

    2. Replace the default code with the following:

      {
         "cmd": ["javac","$file_name","&&","java","$file_base_name"], 
         "path": "C:\\Program Files\\Java\\jdk1.7.0_25\\bin\\", 
         "shell": true
      }
      // locate the path of your jdk installation and replace it with 'path' 
      
    3. Save the file by giving it a name (I named mine "Java")

    Activate the build system:

    1. Tools > Build System > Java (name of the file you saved it with)
    2. Now run your program with Ctrl + B

提交回复
热议问题