Sublime Forum

Sublime - Can't create java package

#1

Is there any configuration in sublime so solve that ???
i am using sublime with java
my problem is :- in java to compile a java file that suppose to declare a new package we use javac -d . JavafFile.java
what i mean is say that i want to compile a java file that contains package com.deitel.jhtp.ch08; it suppose to do javac -d . JavaFile.java suppose to create so this command should create theses com.deitel.jhtp.ch08 as directories and put the JavaFile.class inside ch08 folder

while trying to compile JavaFile.java it gives me javac: invalid flag: Usage: Usage: javac
and i think this error because sublime use the normal compile which is javac JavaFile.java

0 Likes

#2

When executing builds, Sublime just executes whatever external commands the build tells it to execute. In the case of Java, the build file that comes with it just compiles the current file to a class file and does nothing else.

The file looks like thus:

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

If you’d like it to execute something different, you need to make a custom build. One way to do that would be to use Tools > Build System > New Build System, then modify the stub to look like the above but with the command or commands that you want to execute.

0 Likes