I really like the way we compile and produce the executable in a nice simple way using cargo
in Rust. Just typing cargo run
takes care of building and running the program. The best part is that it is included in the Rust distribution. But in Java, is there any such batteries-included feature that allows us to achieve the same. For example, if I have a root directory named app and two sub-directories called bin and src. Inside of src, I have the standard package structure like com/company/main/java and then directories containing the code. So in the root directory, when I execute the command javac
, is there any flag or command or config file that I need to use so that I get a compiler jar in the bin directory or at least the compiled class files in the bin directory in the same structure as the code is placed in src ?
NOTE : I am not looking for a build system like Maven, Gradle, etc. I am specifically looking forward to do this using just two commands that come with the JDK, javac and java.