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

Bug#489478: java-gcj-compat-dev: missing output with formatted string



Package: java-gcj-compat-dev
Version: 1.0.78-1
Severity: important

Hi.

I am trying to learn the Java Programming Language and, trying to get
formatted string to work (which I miss severely, as I am familiar with
them with C), I get nothing in the output of my program.

Here is what I have:

- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
rbrito@chagas:/media/STORAGE/programming/java$ javac -source 1.5 Build.java
rbrito@chagas:/media/STORAGE/programming/java$ cat Build.java
import java.util.Locale;
import java.util.Formatter;
public class Build {
  public static void main(String args[]) {
   StringBuilder sb = new StringBuilder();
   Formatter formatter = new Formatter(sb, Locale.US);
   formatter.format("PI = %12.10f", Math.PI);
   System.out.println(formatter);
  }
}
rbrito@chagas:/media/STORAGE/programming/java$ java Build 
PI = 
rbrito@chagas:/media/STORAGE/programming/java$ 
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -

The result here is not exactly what I expected, as it would be expected
to print pi to 10 decimal places. I took the example code above from
IBM's site developerworks, from an article entitled "Taming T iger:
Formatted output", from 02 Apr 2004.

If this code is wrong, then, please let me know and I will inform IBM.
Otherwise, it would be a good thing to include in the regression suite
of the Free Java implementations (actually, I only started considering
using Java once I knew that it was reasonably feature complete with a
Free implementation).

BTW, if I, OTOH, choose to install the non-free Sun Java JDK (and then
choosing it with update-alternatives), the very same bytecodes give me
the expected result (without any need to recompile, which means that the
Eclipse compiler seems to be generating correct/acceptable code):

- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
rbrito@chagas:/media/STORAGE/programming/java$ java -version
java version "1.6.0_06"
Java(TM) SE Runtime Environment (build 1.6.0_06-b02)
Java HotSpot(TM) 64-Bit Server VM (build 10.0-b22, mixed mode)
rbrito@chagas:/media/STORAGE/programming/java$ java Build
PI = 3.1415926536
rbrito@chagas:/media/STORAGE/programming/java$ 
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -

Please, help, as I want to get rid from non-free software.


Thanks in advance, Rogério Brito.

-- System Information:
Debian Release: lenny/sid
  APT prefers unstable
  APT policy: (500, 'unstable')
Architecture: amd64 (x86_64)

Kernel: Linux 2.6.25.4-1 (SMP w/2 CPU cores; PREEMPT)
Locale: LANG=C, LC_CTYPE=pt_BR (charmap=ISO-8859-1)
Shell: /bin/sh linked to /bin/dash

Versions of packages java-gcj-compat-dev depends on:
ii  ecj-gcj                     3.3.0+0728-9 standalone version of the Eclipse 
ii  gappletviewer-4.3           4.3.1-4      Standalone application to execute 
ii  gcj-4.3                     4.3.1-4      The GNU compiler for Java(TM)
ii  gjdoc                       0.7.9-1      documentation generation framework
ii  java-gcj-compat             1.0.78-1     Java runtime environment using GIJ
ii  python                      2.5.2-1      An interactive high-level object-o
ii  python-central              0.6.7        register and build utility for Pyt

Versions of packages java-gcj-compat-dev recommends:
pn  libgcj9-src                   <none>     (no description available)

-- no debconf information

-- 
Rogério Brito : rbrito@{mackenzie,ime.usp}.br : GPG key 1024D/7C2CAEB8
http://www.ime.usp.br/~rbrito : http://meusite.mackenzie.com.br/rbrito
Projects: algorithms.berlios.de : lame.sf.net : vrms.alioth.debian.org



Reply to: