This is the mail archive of the java@gcc.gnu.org mailing list for the Java project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]

Re: .exe



> how can i make an .exe file from .class or .java files using gcj ?
> .. i.e. compine all the classes of a certain application in one .exe
> file to run on linux and pentiumIII ..

There's some documentation on our website:

  http://gcc.gnu.org/java/gcj2.html
  http://gcc.gnu.org/java/compile.html

What is missing from there is a simple example. Say you have 2 source
file and one class file: a.java, b.java and c.class. You build objects
first, by running `gcj -c' on every files:

  gcj -c a.java
  gcj -c b.java
  gcj -c c.class

Then you link all these objects into a single executable. --main let
you tell the compiler which class contains the main entry point. Let's
say class c in our example. You would link an executable like so:

  gcj a.o b.o c.o --main=c

This produces the default `a.out' executable. Of course, once you get
tired of repeating these steps, you write a makefile, or a least a
script which is fine if you project is small.

> also , is the gcj version that comes with Linux redhat 7.1 a native
> compiler or cross compiler ?

It is a native compiler. We strongly encourage you to download and
build gcc 3.0, a much better quality compiler.
 
./A


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]