Frequently Asked Questions     (11. February 2007)

Licensing
      What's the license for my final native binary?
General
      What's the state of Java support?
Compiling
      How is JNC usually used?
      How to compile resources (property files, images, ...) into a binary?
      Why do I get "multiple definitions of ..." errors when excluding the GUI or JCE?
      How to automatically compile projects (e.g. using it in an ANT script)?
      Why are the binaries so big?
Miscellaneous
      Are there any other Java native (ahead of time) compilers?
      Are there any other Java application deployment solutions?

You might also be interested in these FAQs:
- GCJ
- GNU Classpath



What's the license for my final native binary?
There are four different programs/libraries involved when using JNC:
  1. JNC (the GUI frontend and classlibrary partial-exclusion facility)
    All applications compiled for windows display an "demo" alert unless you bought a license. There are no other restrictions for your application when using this program.
  2. GCJ (including GNU classpath)
    The license for GCJ.
  3. UPX
    The license for UPX.
  4. Awt/Swing
    AWT/Swing is taken from a Sun JRE. Altought Sun will release their codebase under the same license as GCJ in the middle of 2007, this library is still under the old license. So you have to comply to it as if you would use a Sun JRE.
Summary (without any warranty!): If you only use the first 3 programs, your application doesn't fall under any license terms from them. Please contact a lawyer if you have to be really sure or need further informations.

What's the state of Java support?
Java 1.5 language features are completely and the API nearly completely implemented. The only exception is AWT/Swing, it is at the state of Java 1.4.

How is JNC usually used?
The basic idea is to develop applications with a usual JVM. You might use GCJ/GIJ which are included in JNC or any JVM (Sun JVM, Kaffee, Jikes, ...) you like. Then compile the application to native when ready.
Of course this is only the basic idea behind JNC. Feel free to use it in any way you like...

How to compile resources (property files, images, ...) into a binary?
Put the resources into a jar and add that jar to the compilation project.
Please note that you have to compile the complete jar. Otherwise, the resources won't be compiled into your binary because they are not referenced by your code.

Why do I get "multiple definitions of ..." errors when excluding the GUI or JCE?
That means that your code is using and thus pulling AWT/Swing or JCE into the binary. You have to either uncheck the "exclude GUI/JCE" box or change/delete your classes that need the libraries.

How to automatically compile projects (e.g. using it in an ANT script)?
Use the provided "AutoCompiler" application. Create and save the projects with JNC and then run "AutoCompiler /path/to/theSavedProjectFile.njp".
Please note that AutoCompiler (as well as JNC) need to be run from the directory they are in.

Why are the binaries so big?
As JNC evolves, it supports more and more classes of the Java API. The problem now is, that the Java API classes are heavily interconnected; a simple "Hello World" application uses the security manager which uses AWT which uses... Because of this, you will always have a big part of the classlibrary in your binaries.
For Java, this is not a problem. Endusers require to have the JVM, thus having all classes anyway. For native compilation, this is a bigger problem because it's not just a bug that can be fixed. The design of Java doesn't fit into the concept of native compilation (concerning the size of binaries).
Since JNC 0.9, you can exclude parts of the class library if you don't need them and thus drastically reduce the size of your binaries.

Are there any other Java native (ahead of time) compilers?
As far as I know, there are only two usable Java native compilers out there:
- GCJ
- Excelsior JET

GCJ is used by JNC. Excelsior Jet has the advantage that it is completely Java 1.5 certified. The single big disadvantage is that it costs $1,000 to $5,000. This makes it somehow useless for real mortal (non-huge-company) developers. Maybe someone reading this might be interested in it anyway.

Are there any other Java application deployment solutions?
These are - IMHO - the problems of Java deployment:
1. The depency of a JRE. Most end-users don't know what they have installed...
2. The problem of creating an executable file out of a JAR or class file.
3. The problem that Java can easily be decompiled.

There are different approaches to solve these Problems. I prefer native compilation because it really solves all 3 altogether. All the other approaches only solve partial problems, create new ones or are just not as clean as native compilation. Lets take a look at them anyway:
1: The cleanest solution for this is, to bundle a JRE to the own application. It has the disadvantage that the installer will be huge. Applications: Advanced Installer, ...
2: There are a lot of applications that help with this problem. Mostly they're not platform independent and of course they still need a JRE. Applications: launch4j, JSmooth, NativeJ, ...
3: The only way to avoid this is to obfuscate the code. But even by doing so, the source can still easily be obtained and analyzed. Applications: ProGuard, ...