Compiling and Running Java Code in Sublime Text 2

前端 未结 19 2720
执念已碎
执念已碎 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 02:06

    I am using Windows 7. The below solution works for me!!

    **Open** the file JavaC.sublime-build and replace all the code in the file with the code below:
    
    {
     "cmd": ["javac", "$file_name","&&","java", "$file_base_name"],
     "file_regex": "^(...*?):([0-9]*):?([0-9]*)",
     **"path": "C:\\Program Files\\Java\\jdk1.6.0\\bin\\",**
     "selector": "source.java",
     "shell": true
     }
    

    Remember to replace "C:\Program Files\Java\jdk1.6.0\bin\" with the path where you put your jdk. And make sure to add the path of you java JDK to the environment variable "PATH". Refer to bunnyDrug's post to set up the environment variable. Best!!

提交回复
热议问题