Search code examples
javajarbuildbuild-processexecutable-jar

Building a Java Application


I am a newbie interested in becoming a software engineer. I recently applied to an entry level position and was asked to do a coding assignment. This is why I am asking this question.

The feedback I got was that I should learn to use Java deployment tools so that other developers with built jars can to run my code, rather than just sending the raw code.

My question is assuming I have a simple java program HelloWorld.java and want to send this code to someone, what is an example of a java deployment tool (And steps to use it) to use so I can provide other developers with built jars to run the code, rather than just sending the raw code.

Thanks in advance for any feedback


Solution

  • You need to read up on the JAR file format and how to pack JARs. Pay close attention on how to make your JARs runnable.

    http://docs.oracle.com/javase/tutorial/deployment/jar/

    Making a JAR runnable is detailed in "Working with Manifest Files: The Basics" / "Setting an Application's Entry Point". Really, read the entire site on JAR files. You will probably never read it twice, but if you at least read it once you'll have a strong grasp on what you can (and can't do) in the packaging and distribution of your code.

    For example, I still encounter people who don't know that JARs can be sealed, have various tamper-proofing capabilities, can contain class-paths, can embed version numbers, etc.