Search code examples
javaeclipsemavenmakefilejavac

Looking for Makefile and Build System solutions for Java


I am trying to veer away from writing most of my Java code in Eclipse and I'm coming up with small projects for myself to work on in order to a. become a better Java programmer and b. learn how to organize my applications (in both terms of code and directory structure).

I noticed that I make plenty of small, incremental changes to classes then to recompile and run my whole application. I'm slightly familiar with Makefiles from a course I took in C++, and I'm less familiar with Build Systems (Maven, Ant). Regarding this mater, here are a few things I'd appreciate help with:

  • First of all, is there a way that I can write a little file that separates where my .class files are saved during javac *.java?
    • Say I want to put all my .class files in a /bin folder
  • In that file, is there a command I can write to simplify the javac *.java and java [class name here...] process?

    • I know that this process is relatively simple already, but what I want to know is can I write something that will allow me to run commands along the lines of myExec build (compile and save all my java files) myExec run (run my application)
  • Finally, is there a simple Build System that I can/should learn to use that will allow me to accomplish this? Or am I confusing the point of a Build System.


Solution

  • Look at Maven or Gradle, it automatically separates the source file and class files.

    Manual build script writing is waist of time really.