Adding a folder to a project just allows you to use features like Sublime’s “Go to anywhere” panel, and adds a folder to your side bar etc.
It won’t affect the default build systems in any way.
I don’t know how compiling Java works that well, but I am assuming you are using the default JavaC build system that comes with Sublime.
These are the contents of that build system:
{
"shell_cmd": "javac \"$file\"",
"file_regex": "^(...*?):([0-9]*):?([0-9]*)",
"selector": "source.java"
}
Basically, it will only compile the current file you have open.
This seems to be the case for all of the default build systems, so if you want it to do anything useful you need to manually set up your own one.
Although, this should be expected considering the fact that Sublime is a text editor and not an IDE in the first place.
As an example, I write a lot of C and C++ in Sublime, but the default build system only compiles the current working file, just like the JavaC one above.
In order to compile entire projects easily I created a new C++CMake.sublime-build file in my “Packages/User” folder and wrote my own build system in there.
To compile my entire project I first of all just have to create the neccesary CMakeLists.txt files and tell the build system what shell command it should run.
This allows Sublime to call CMake to generate a native build system.
After that I can then use a variant in the Sublime build system to execute a shell command to build my entire project using the generated build system.
These actions are bound to some keys I set up.
So I set up the following:
ctrl+b = Run CMake for the current project to generate my Make files
ctrl+shift+b = Run Make for the current project to compile everything using the Make files generated from the previous step
ctrl+shift+r = Run the .exe file that was compiled in the previous step
ctrl+shift+m = Run "make package" for the current project to package up my compiled project into zip files etc
I also have the same commands behind the normal Sublime “ctrl+k” binding for debug builds.
You probably don’t want to build just one file, so you should set up a build system that can build all of the files you want in your current project and use that instead.
From what I have read about Java I assume it would be roughly the same and my C++ example, but perhaps you would use something like Ant or Maven (guesses from my limited knowledge of Java).
The Sublime build systems don’t do anything that fancy, they just send a command to a shell, so on windows it’s just like using cmd.exe via keyboard shortcuts
(well, they obviously can do other things, but I think that’s the main idea of it).
Because of this, as long as you know how to run all of your Java build tools from the command line, you should be able to set up a build system without too much problem.
To learn more about Sublime’s build systems you can read this page: docs.sublimetext.info/en/latest/ … stems.html
About half way down there is also a snippet of code showing how to use platform specific options.
The code snippet happens to call Ant, so perhaps that will help you in getting started.
It can take a while to set up properly for your specific needs, but once it’s done you can use that same build system in any of your projects.