Search code examples
javabuild

How can I change the path to Java in Sublime?


I am using an office laptop and I do not have administrative rights to it therefore I cannot edit the environment variables.

Recently, my laptop auto updated to Java 8 but something got goofed up and when ever I try to build a java program I get an error. In the meantime, I would like to build and run Java programs on Sublime text using my functioning Java 7.

How can I change the path in Sublime Text to Java 7 instead of it defaulting to Java 8 when I press CTRL-B?


Solution

  • You could try to make a special build system JavaC7 or something like that:

    {
        "shell_cmd": "/absolute/path/to/javac \"$file\"",
        "file_regex": "^(...*?):([0-9]*):?([0-9]*)",
        "selector": "source.java"
    }