#872 Small tool to create a standalone Java Jar from a Fantom app (pods)

tcolar Wed 16 Dec 2009

I wrote a small tool (in Fantom) that will take some Fan code(pods) and build a standalone jar from it that can be run in a regular JVM.

It's nothing too fancy, but I figure I'll share it in case it's of use to somebody else:

Anyway, it's documented & available here:

http://wiki.colar.net/fantom_to_standalone_jar_tool

Eventually I'd like to also add a target to build a JNLP (Java webstart, where you can run the app/jar straight from a website).

I'd also like to be able to do it for a webapp (war) though the process here would be a little different (proably shared Fantom runtime), but I'm not sure it's much use until there is a Servlet API Fantom implementation (which I think cheeser is working on).

andy Wed 16 Dec 2009

Looks cool tcolar - nice work.

brian Wed 16 Dec 2009

this is definitely interesting

I'd hear more about how people would like to deploy Fantom. Seems people would prefer to have a single jar or jars they could drop in - but the problem is that platform level things (module resolution, etc config) don't work so hot.

tcolar Wed 16 Dec 2009

Java is still the main language out there(with c++) and one of the ones people are most likely to be looking for an alternative to (groovy, scala, fantom) ... so there is big value to be able to operate with java.

To me Fantom looks a like like an improved Java without the pains (+ other nice things)

Also there are tons of tools for java that can deal with jars, for example i was reading a cool article on using junit with groovy to unit test in java (writing unit test in java is painful), but i'd rather use Fantom than groovy, so if you can have Fantom in a jar that opens some possibilities to use tools that know how to deal with jars (many).

Note, It's possible(and sometimes necessary) to have a classloader "inside" the jar and that would allow having a fan runtime inside the jar, however I don't believe you can "write" inside the jar so things like the typedb might not work - do you need to write files for runtime to work ?

freddy33 Wed 16 Dec 2009

The JNLP deploy is also on my mind. I wanted to do like what we did for JavaFX JavaFX WebStart and Maven Deploy Screencast so using thibault tool looks like it's going to be straight forward.

Great job tcolar.

jodastephen Thu 17 Dec 2009

The reason why deployment as a jar matters is that it means that far less effort is involved in some operations departments to convince them of running Fantom in production. After all, its "just another jar".

brian Thu 17 Dec 2009

Some point when I have some free time I will take a look at moving key files like timezone and unit database into sys.jar - that will free up the need for etc directory.

katox Wed 26 May 2010

I'm just pinging the topic. It seems that many potential Fantom newcomers are willing to "try out" fantom somewhere in their existing java codebase.

I suspect it is usually inside a webapp in tomcat or jetty. I can point them to some examples how to do java FFI in fantom so they can call their existing java code but I don't expect them to be willing to switch to Wisp (even if it was 100 times easier). I know of some people picking Groovy after a brief look at Fantom, I guess this is why.

Is there a topic what has been done / needs to be done / roadmap possibilities?

brian Wed 26 May 2010

You use the JarDist build task, see:

Login or Signup to reply.