Re: Java hello world link error
Hallo Mauro, One last thing. I noticed that the resulting Test.exe attempts to access the internet. Is this expected ? Its trying to access 24.25.4.107 which my getHost tool tells me is rlghnc-dns-cac-02-dmfe1.nc.rr.com. Please discuss this on the java list (and start a new thread), it is not a Cygwin issue. Gerrit -- =^..^= -- Unsubscribe info: http://cygwin.com/ml/#unsubscribe-simple Problem reports: http://cygwin.com/problems.html Documentation: http://cygwin.com/docs.html FAQ: http://cygwin.com/faq/
Re: Java hello world link error
-BEGIN PGP SIGNED MESSAGE- Hash: SHA1 Shankar Unni wrote: | It's not unexpected or incorrect, but may be suboptimal. | | The Java runtime insists that InetAddress.getLocalHost() return your | true IP address, not 127.0.0.1. Unfortunately, in a dialup setup with | automatic connection, such a lookup will trigger your dialer. Anyway my ZoneAlarm says that also bash.exe, hostname.exe and a bunch other standard cygwin binaries contact the DNS, also... - -- L a p o L u c h i n i l a p o @ l a p o . i t w w w . l a p o . i t / http://www.megatokyo.it -BEGIN PGP SIGNATURE- Version: GnuPG v1.2.2 (Cygwin) Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org iEYEARECAAYFAj/oOWYACgkQaJiCLMjyUvvSJgCeLWBG7O4Vo8zneMvcl6yqwh9O BwsAn01lk4aSYJrEIT0pe3SdVwD7Qb9M =sQJ0 -END PGP SIGNATURE- -- Unsubscribe info: http://cygwin.com/ml/#unsubscribe-simple Problem reports: http://cygwin.com/problems.html Documentation: http://cygwin.com/docs.html FAQ: http://cygwin.com/faq/
Re: Java hello world link error
mauro zallocco wrote: I noticed that the resulting Test.exe attempts to access the internet. Is this expected ? Its trying to access 24.25.4.107 which my getHost tool tells me is rlghnc-dns-cac-02-dmfe1.nc.rr.com. It's not unexpected or incorrect, but may be suboptimal. This host is obviously your DNS host, and the GCJ runtime is apparently attempting to resolve your true host name from the DNS server using your IP address. The Java runtime insists that InetAddress.getLocalHost() return your true IP address, not 127.0.0.1. Unfortunately, in a dialup setup with automatic connection, such a lookup will trigger your dialer. The real Java runtime has put in some workarounds to prevent such a lookup unless it's really needed (i.e. you use a networking class of some sort, or some other class that needs the real hostname and IP address). Perhaps the Gnu java runtime doesn't have such tweaks in it.. -- Unsubscribe info: http://cygwin.com/ml/#unsubscribe-simple Problem reports: http://cygwin.com/problems.html Documentation: http://cygwin.com/docs.html FAQ: http://cygwin.com/faq/
Re: Java hello world link error
mauro zallocco wrote: with the following command: g++ Test.java gcj --main=Test Test.java See also: http://gcc.gnu.org/java/ -- J. Lambert -- Unsubscribe info: http://cygwin.com/ml/#unsubscribe-simple Problem reports: http://cygwin.com/problems.html Documentation: http://cygwin.com/docs.html FAQ: http://cygwin.com/faq/
Re: Java hello world link error
At 08:04 PM 12/20/2003, mauro zallocco wrote: Folks, I installed gcc-java on Windows XP, and am attempting to compile: class Test { public static void main(String argv[]) { System.out.println(Hello World); } } with the following command: g++ Test.java This produces a gazillion link errors, a sample follows: /cygdrive/c/DOCUME~1/mzallocc/LOCALS~1/Temp/ccywNFar.o(.text+0x2d):Test.java : undefined reference to `__Jv_InitClass' /cygdrive/c/DOCUME~1/mzallocc/LOCALS~1/Temp/ccywNFar.o(.text+0x37):Test.java : undefined reference to `java::lang::System::out' /cygdrive/c/DOCUME~1/mzallocc/LOCALS~1/Temp/ccywNFar.o(.text+0x5f):Test.java : undefined reference to `java::lang::Object::Object[in-charge]()' /cygdrive/c/DOCUME~1/mzallocc/LOCALS~1/Temp/ccywNFar.o(.text+0xc8):Test.java : undefined reference to `__Jv_RegisterClass' Why not start out by linking it as a java program, with gcj, rather than as C++ ? Tim Prince -- Unsubscribe info: http://cygwin.com/ml/#unsubscribe-simple Problem reports: http://cygwin.com/problems.html Documentation: http://cygwin.com/docs.html FAQ: http://cygwin.com/faq/
RE: Java hello world link error
Thank you for the suggestion. Here is what I get. $ gcj Test.java /usr/lib/gcc-lib/i686-pc-cygwin/3.3.1/../../../../i686-pc-cygwin/bin/ld: cannot find -liconv collect2: ld returned 1 exit status Mauro -Original Message- From: Tim Prince [mailto:[EMAIL PROTECTED] Sent: Sunday, December 21, 2003 10:39 AM To: [EMAIL PROTECTED]; [EMAIL PROTECTED] Subject: Re: Java hello world link error At 08:04 PM 12/20/2003, mauro zallocco wrote: Folks, I installed gcc-java on Windows XP, and am attempting to compile: class Test { public static void main(String argv[]) { System.out.println(Hello World); } } with the following command: g++ Test.java This produces a gazillion link errors, a sample follows: /cygdrive/c/DOCUME~1/mzallocc/LOCALS~1/Temp/ccywNFar.o(.text+ 0x2d):Test.java : undefined reference to `__Jv_InitClass' /cygdrive/c/DOCUME~1/mzallocc/LOCALS~1/Temp/ccywNFar.o(.text+ 0x37):Test.java : undefined reference to `java::lang::System::out' /cygdrive/c/DOCUME~1/mzallocc/LOCALS~1/Temp/ccywNFar.o(.text+ 0x5f):Test.java : undefined reference to `java::lang::Object::Object[in-charge]()' /cygdrive/c/DOCUME~1/mzallocc/LOCALS~1/Temp/ccywNFar.o(.text+ 0xc8):Test.java : undefined reference to `__Jv_RegisterClass' Why not start out by linking it as a java program, with gcj, rather than as C++ ? Tim Prince -- Unsubscribe info: http://cygwin.com/ml/#unsubscribe-simple Problem reports: http://cygwin.com/problems.html Documentation: http://cygwin.com/docs.html FAQ: http://cygwin.com/faq/
Re: Java hello world link error
mauro zallocco wrote: $ gcj Test.java /usr/lib/gcc-lib/i686-pc-cygwin/3.3.1/../../../../i686-pc-cygwin/bin/ld: cannot find -liconv collect2: ld returned 1 exit status You probably need to install one or both of these: $ cygcheck -c | grep iconv libiconv1.9.1-3OK libiconv2 1.9.1-3OK -- J. Lambert -- Unsubscribe info: http://cygwin.com/ml/#unsubscribe-simple Problem reports: http://cygwin.com/problems.html Documentation: http://cygwin.com/docs.html FAQ: http://cygwin.com/faq/
Re: Java hello world link error
Jon, installing libiconv and using --main=Test did the trick. Thanks. I looked at http://gcc.gnu.org/java/ and found http://www.linuxjournal.com/article.php?sid=4860 which discusses compiling java. One last thing. I noticed that the resulting Test.exe attempts to access the internet. Is this expected ? Its trying to access 24.25.4.107 which my getHost tool tells me is rlghnc-dns-cac-02-dmfe1.nc.rr.com. Mauro mauro zallocco wrote: $ gcj Test.java /usr/lib/gcc-lib/i686-pc-cygwin/3.3.1/../../../../i686-pc-cygwin/bin/ld: cannot find -liconv collect2: ld returned 1 exit status Jon A. Lambert at alltel dot net You probably need to install one or both of these: $ cygcheck -c | grep iconv libiconv1.9.1-3OK libiconv2 1.9.1-3OK Test.java class Test { public static void main(String argv[]) { System.out.println(Hello World); } } /Mauro -- Unsubscribe info: http://cygwin.com/ml/#unsubscribe-simple Problem reports: http://cygwin.com/problems.html Documentation: http://cygwin.com/docs.html FAQ: http://cygwin.com/faq/