Drawing Hands by M.C. Escher (1948)

Jeff Mesnil


“All I wanted was to build my jar and I got a web site”

On July 2nd, 2004 in java

Via Dion, my quote of the week :

All I wanted was to build my jar and I got a web site.

Jonas Boner, AspectWerkz/BEA

I see more and more projects which use Maven as their build process also use Maven to run their applications…
Maven is a build process with (some) advantages and (lots of) inconveniences but it’s not made to run applications. Yes, it is possible to do it but I find insane to have to download Maven, set it up just to run another application which has all its dependencies already downloaded… Maybe (crazy thought!) Maven and Ant could be used in a complementary way:

  1. Maven for the build process (but IMHO Ant 1.6 is a better choice)
  2. Ant to run the application

Or maybe, even better, we could improve java -jar and use scripting (Jython, Groovy,…) to get rid of Ant or Maven to run the applications (cf. Jetty or Eclipse).

2 Responses to ““All I wanted was to build my jar and I got a web site””

  1. Anonymous Says:

    Why does java -jar need fixing, it works exactly as it is supposed to right now.

  2. jmesnil Says:

    java -jar is great and I used it to run JOTM as a standalone transaction manager. The only problem I got with java -jar is that you can’t use it to configure you JVM environment, it’s too late: you’re in.
    One of the trouble I had with JOTM was for the inclusion of Stubs in the classpath: either the RMI/JRMP or the RMI/IIOP were to be included but both had the same class name and couldn’t be present at runtime. So it was up to the user to set the classpath manually. What I’d like was to use “java -jar jotm.jar -stub iiop” and that the jotmstubsiiop.jar was added to the classpath.
    So, as I see it, you’re left with two choices:
    o have ugly long java command lines (the solution I took with JOTM)
    o use scripts to configure your environment (Ant, Groovy, Jython,…)
    o use “java -jar” to start a Java program which will setup the environment and starts the real Java application (I think Eclipse is working like that).

    How do you do to configure your environment before running java -jar?

    jeff