[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]

[K12OSN] Re: Gcj vs javac



I'm preparing for an eventual programming class in Java.  I had a few
semesters of Java in college.  I tried the very simple  "Hello World" using
gcj, only to have it tell me it didn't know what main was ("undefined
reference to main").


Apparently with gcj you need to tell the compiler which class
has the main function.


So if this is your hello.java file:

class hello_java
{
       public static void main(String args[])
       {
          System.out.println("Hello World!");
       }
}



You could compile it with:

gcj --main=hello_java hello.java


And run it with:

./a.out

_________________________________________________________________
Express yourself instantly with MSN Messenger! Download today it's FREE! http://messenger.msn.click-url.com/go/onm00200471ave/direct/01/



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]