Using the Eclipse IDE how in the hell do you make an executable .jar file? I swear it is something simple and i am just missing it.
Not sure, but I do know that this works on the command-line:
jar cf blah.jar
Typically this is achieved using an ANT task which emits a manifest file (MANIFEST.MF) and packs it into the jar file. The manifest has the name of the class which contains a static main method which is invoked when you run "java -jar executable.jar". Rather than muck around with Eclipse, put together and ANT build.xml file and invoke that via Eclipse's ANT tool. This way you can build the same executable jar file from commandline and avoid an IDE dependency.
http://ant.apache.org/manual/CoreTasks/manifest.html
The attribute needing defined is "Main-Class".
I took a look at the reasons Ant was created in place of something like GNU/Make. However, I was still not convinced; why is it a suitable replacement for GNU/Make?
Reason I ask is that GNU/Make already runs on more platforms/architectures than Java. It's also fairly easy to make sure you write non-OS-dependent Makefiles, even though it does take some experience to do that.
Anyway, I was just curious.
The annoying syntax of a GNU/Make file is enough to drive someone bonkers. I'd rather write well-formed XML build files any day. Also, it is magnitudes easier to write a GUI build-file-maker when your target file output it XML, rather than some awkward text format.
ANT kicks GNU/make butt!
Hehe, what is annoying about it? You have targets and dependencies one line, and commands on subsequent tabbed lines.
The most complex parts of Make that I've used are inclusion of multiple files and auto-targets using string substitution. In fact, I think those are about as difficult as Make syntax and logic can be.
I bet I could write a GUI Makefile builder as easily as you could write a GUI Ant file builder :-)
Also, in vim, it's easy to make sure that tabs are enabled rather than spaces when you press the tab key in a Makefile through some use of conditional statements that are executed in the .vimrc at startup.
:smartass: