package declaration

Andrew Haley
Mon Jul 9 10:23:00 GMT 2001

Mohammad O'mara writes:

 > I wanted to generate an executable file for my application , so I
 > generated the object files successfully.


 > But when linking them it gave me strange errors moving me to 2
 > files under /temp and I didn't find these files !

What strange errors where these?

 > .. I tried many things to debug my source code

Compiling with `-g' and then using gdb is usally the Right Thing to

 >. and by accident I doubted the package declaration , which is very
 >normal for example when dealing with JDK .. package packagename;
 >... and I deleted this line from my source code .. and it worked
 >like that generating the exe file !

Well, let me try. -----------------------------------------------------------
package foo;

class z 
  public static void main (String argv[])
    System.out.println ("Hello");


 > gcj --main=foo.z
 > ./a.out 

Looks good to me.


More information about the Java mailing list