This is the mail archive of the cygwin@cygwin.com mailing list for the Cygwin project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Java (1 of 3): Gcj - Hello world exe (again)


Hi,
   This ought to be in the FAQ but I couldn't find it.  I can't seem to get
a hello world program to work as an executable though it works fine with the
JVM.  I've seen this asked before but not the answer.  See code below. 

Hello.java    (note: case is important in this filename)
==========

class Hello {
    public Hello() {};

    public static void main(String args[]) {
        int returnCode = 0;
        System.out.println("hello world\r\n");
        System.exit(returnCode);
    }
}

Makefile
========

JAVAC = gcj
JFLAGS = -gstabs


all: Hello.class Hello.exe test

test:
        java Hello
        .\Hello

%.class: %.java
				$(JAVAC) $(JFLAGS) -C $<

# note: this will not link unless you install libiconv 
#       using the standard cygwin installer
%.exe: %.java
        $(JAVAC) --main=Hello $(JFLAGS) $< -o $@


Output
======

C:\BruceA\java>make
gcj -gstabs -C Hello.java
gcj --main=Hello -gstabs Hello.java -o Hello.exe
java Hello
hello world

.\Hello
      7 [main] Hello 284 handle_exceptions: Exception:
STATUS_ACCESS_VIOLATION
  33835 [main] Hello 284 open_stackdumpfile: Dumping stack trace to
Hello.exe.st
Ackdump

What have I done wrong?
				Regards,
					  Bruce A.


============================================================================
 Any opinions expressed in this e-mail are those of the individual and not
 necessarily those of Tyco Electronic Product Group.

 Any prices for the supply of goods or services are only valid if supported
 by a formal written quotation.

 This e-mail and any files transmitted with it, including replies and
 forwarded copies (which may contain alterations) subsequently transmitted
 from Tyco Electronic Product Group are confidential and solely for the use
 of the intended recipient.

 If you are not the intended recipient or the person responsible for
 delivery to the intended recipient, be advised that you have received this
 e-mail in error and that any use is strictly prohibited.  In this event,
 please notify us via e-mail at 'helpdesk.tepg@tycoint.com' or telephone on 
 0121 255 6499 and then delete the e-mail and any copies of it.
============================================================================






--
Unsubscribe info:      http://cygwin.com/ml/#unsubscribe-simple
Bug reporting:         http://cygwin.com/bugs.html
Documentation:         http://cygwin.com/docs.html
FAQ:                   http://cygwin.com/faq/


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