package declaration

Andrew Haley aph@cambridge.redhat.com
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.
Right.
 > 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
do.
 >. 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.
z.java: -----------------------------------------------------------
package foo;
class z 
{
 public static void main (String argv[])
 {
 System.out.println ("Hello");
 }
}
------------------------------------------------------------------
Then:
 > gcj z.java --main=foo.z
 > ./a.out 
Hello
 >
Looks good to me.
Andrew.


More information about the Java mailing list

AltStyle によって変換されたページ (->オリジナル) /