3

I have a java program consists of a jar for the "real program" and a sub-folder containing 20 jar library files (also have dependencies between them). I tried but without success ... I'm missing with the many options that gcj to compile :(. Does anyone know how to compile to native code so that a java program? Thanks

Update: I have used the plugin for Eclipse (I'm using the 3.6 version of Eclipse and the plugin works well) http://gcjbuilder.sourceforge.net/ to generate a Makefile for the compilation. But now I have an another problem :( Some libraries are not compiled (exit for error). The error is that GCJ considers all .class files inside .jar file, that have dependencies with other libraries do not exist. But for the purposes of my program, these classes are not used (that is, the java program it works properly). There is thus a way to force gcj to consider only the classes actually used in my java program?

Alan
  • 31
  • 3

2 Answers2

3

I can only recommend that you don't use GCJ. It isn't Java. The compatiblity matrix on their web page is far from encouraging. It doesn't implement Java 1.2 completely yet, let alone all of 1.3, 1.4, 1.5, 1.6. The project appears to be falling further and further behind, and it never had 100% Java compatibility as a stated goal in the first place.

user207421
  • 305,947
  • 44
  • 307
  • 483
  • Do you know an alternative to transform a java program into native code? Not the usual JET ... (= not free ...) – Alan Jan 11 '11 at 00:18
  • @Alan: sorry, can't help with that question. – user207421 Jan 11 '11 at 02:44
  • 1
    why try to make a native executable at all? Best to do would likely be to create an installer that simply unpacks the dependencies to a lib directory under the directory containing your main (executable) jar, and have a batch script (or equivalent for your operating system of choice) set up the runtime environment correctly and execute that jar. I've used the built-in native "compilers" in JBuilder and IntelliJ, and while they work the result is underwhelming. – jwenting Jan 13 '11 at 10:35
0

You may want to look at tools like autojar and firends to help resolve your dependencies and to make a single jar.

Ingo
  • 36,037
  • 5
  • 53
  • 100