Haxe Target-Specific Getting-Started Tutorials

Using Java jars in a Haxe project

You have a Haxe project and would like to use an existing Java jar file in it.

To do that, you’ll be using haxe to compile your Haxe code to Java, then running it all on the JVM.

Your Haxe project:


The java_stuff.jar contains compiled classes Foo and Bar in the j_stuff package.

In your Main.hx:

To build that:

haxe -jar-file jars/java_stuff.jar -main Main -java out

TODO: finish