Sublime Forum

New build system error

#1

Hy there!

First of all, I’m very new at Sublime Text!
and i have an error while i try to compile java file.

I found a solution somewhere which basicly if i understand correctly creates a new build system so when i press ctrl + B it “compiles” the code and show it to me at the bottom.

Here is the code what I found.

{ “cmd”: [“javac”, “$file_name”,"&&",“start”,“cmd”,"/k",“java”, “$file_base_name”], “path”:“C:\Program Files\Java\jdk-11.0.2\bin”, “shell”: true }

And whenever I press ctrl+B it gives me two errors

FIrst:

error: invalid flag:Usage: javac use --help for a list of possible options[Finished in 1.0s]

and the second:

error: invalid flag:
Usage: javac
use --help for a list of possible options
[Finished in 3.2s with exit code 2]
[cmd: [‘javac’, ‘’, ‘&&’, ‘start’, ‘cmd’, ‘/k’, ‘java’, ‘’]]
[dir: C:\Program Files\Sublime Text 3]
[path: C:\Program Files (x86)\Common Files\Oracle\Java\javapath;C:\Windows\system32;C:\Windows;C:\Windows\System32\Wbem;C:\Windows\System32\WindowsPowerShell\v1.0;C:\Program Files (x86)\NVIDIA Corporation\PhysX\Common;C:\WINDOWS\system32;C:\WINDOWS;C:\WINDOWS\System32\Wbem;C:\WINDOWS\System32\WindowsPowerShell\v1.0;C:\Program Files (x86)\QuickTime\QTSystem;C:\Users\galan\AppData\Local\Microsoft\WindowsApps;]

any help?

0 Likes

#2

If you compare what cmd looks like in your build system versus what cmd looks like in the error message, you can see that where the build system says $file_name (which represents the current file), the output at the bottom says ''.

This is an indication that you created a brand new file but you didn’t save it first and give it a name on disk. So, when Sublime expands $file_name into the file name, the file doesn’t have one. The error message is essentially javac complaining that you didn’t give it a file.

If you save the file first manually once to give it a name, your problem should go away. You can turn on the option Tools > Save All on Build to have your changes saved automatically when you build; this option doesn’t try to save newly created files though, which is why you need to save manually first once.

1 Like

Getting this error: Can't find '__main__' module in ''
File not found?; Trackback?