 |
AppletTalk.com Java discussions newsgroups
|
| View previous topic :: View next topic |
| Author |
Message |
Guest
|
Posted: Sun Apr 30, 2006 1:12 am Post subject: printf doesn't work for me. |
|
|
The Java code below works under a Solaris machine I have access to, but
not Fedora Core 5. The
thing that's not working is "printf". I'm guessing I have a problem
with a library, but I'm not sure. I'm not well versed in Java, so, can
someone help me figure out how to get printf to work?
// Begin
public class PiTest
{
public static void main(String[] args)
{
double pi = Math.PI;
System.out.printf("pi = %5.3f%n", pi);
}
}
// End |
|
| Back to top |
|
 |
Mishagam Guest
|
Posted: Sun Apr 30, 2006 2:12 am Post subject: Re: printf doesn't work for me. |
|
|
potteryglazefire (AT) yahoo (DOT) com wrote:
| Quote: | The Java code below works under a Solaris machine I have access to, but
not Fedora Core 5. The
thing that's not working is "printf". I'm guessing I have a problem
with a library, but I'm not sure. I'm not well versed in Java, so, can
someone help me figure out how to get printf to work?
// Begin
public class PiTest
{
public static void main(String[] args)
{
double pi = Math.PI;
System.out.printf("pi = %5.3f%n", pi);
}
}
// End
What version of Java / JVM you use on Fedora? |
Their default Java is GCJ. printf() is recent addition of Java 1.5. I
will probably not work with GCJ and SUN Java versions < 1.5. |
|
| Back to top |
|
 |
Guest
|
Posted: Sun Apr 30, 2006 4:12 am Post subject: Re: printf doesn't work for me. |
|
|
Mishagam wrote:
| Quote: | potteryglazefire (AT) yahoo (DOT) com wrote:
The Java code below works under a Solaris machine I have access to, but
not Fedora Core 5. The
thing that's not working is "printf". I'm guessing I have a problem
with a library, but I'm not sure. I'm not well versed in Java, so, can
someone help me figure out how to get printf to work?
// Begin
public class PiTest
{
public static void main(String[] args)
{
double pi = Math.PI;
System.out.printf("pi = %5.3f%n", pi);
}
}
// End
What version of Java / JVM you use on Fedora?
Their default Java is GCJ. printf() is recent addition of Java 1.5. I
will probably not work with GCJ and SUN Java versions < 1.5.
|
On the FC5 machine...
$ java --version
java version "1.4.2"
gij (GNU libgcj) version 4.1.0 20060304 (Red Hat 4.1.0-3)
On the Soaris machine...
$ java -version
java version "1.5.0_04"
Thanks for the information! I did some quick web searches looking for
| Quote: | = 1.5 for FC5, but I came up empty... Do you know where I can find a Java RPM for FC5 that is >= 1.5? If not, do you know where I can find the source so I can build it? I'm not having much luck... (I would have thought FC5 would have the latest greatest Java code. Odd...)
|
I even went to http://gcc.gnu.org/java/ thinking for sure they would
have what I need. Maybe I overlooked something...
Thanks again... |
|
| Back to top |
|
 |
Andy Guest
|
Posted: Sun Apr 30, 2006 9:12 am Post subject: Re: printf doesn't work for me. |
|
|
potteryglazefire (AT) yahoo (DOT) com wrote:
| Quote: | On the FC5 machine...
$ java --version
java version "1.4.2"
gij (GNU libgcj) version 4.1.0 20060304 (Red Hat 4.1.0-3)
On the Soaris machine...
$ java -version
java version "1.5.0_04"
Thanks again...
|
As Mishagam wrote, printf is a new in Java 1.5. As far as I can see, gcj
does not support it yet, which is why your solaris box is happy with the
code, but your linux (fedora) box is not.
However, the sun java release is very easy to install and set up, so for
1.5 features, I think your're best installing that. Go to java.sun.com
and get the latest 1.5 release, install it into somewhere like /opt, set
your path to include the new version's bin directory, that should be it.
Hope that helps
Andy |
|
| Back to top |
|
 |
|
|
You cannot post new topics in this forum You cannot reply to topics in this forum You cannot edit your posts in this forum You cannot delete your posts in this forum You cannot vote in polls in this forum
|
|