Sublime Forum

Running java files in sublime text 3 in linux

#1

how can i run java files with input in sublime text 3 i am using linux so i cant really figure it out
i tried using this build but it says no build system out i also have installed and setup terminus package
{
“target”: “terminus_exec”,
“cancel”: “terminus_cancel_build”,
“shell_cmd”: “javac $file && java $file_base_name”
}
can someone help me out?

0 Likes

#2
  1. May require working_dir for java to find compiled class via $file_base_name.
  2. I had to quote \"$file\" due to whitespace in paths.
{
    "target": "terminus_exec",
    "cancel": "terminus_cancel_build",
    "shell_cmd": "javac \"$file\" && java $file_base_name",
    "working_dir": "${file_path:${folder}}"
}

The following simple Hello World app runs successfully then.


public class HelloWorld {

   /* This is my first java program.
    * This will print 'Hello World' as the output
    */

   public static void main(String []args) {
      System.out.println("Hello World"); // prints Hello World
   }

0 Likes

#3

thanks its working like a charm !

0 Likes