Public bug reported:
The results produced by Scanner on a desktop verion of Ubuntu 10.0
differ from those produced on a laptop version. The laptop version
produces results which render the program quirky to use.
This sample program demonstrates the difference in behavior:
import java.util.Scanner;
public class BadScanner
{
public static void main(String args[])
{
System.out.println("About to create Scanner");
Scanner in = new Scanner(System.in);
System.out.println("Created Scanner, type
something...");
String str = in.nextLine();
System.out.println("You typed: " + str + " ...now type
something else");
str = in.nextLine();
System.out.println("And then you typed: " + str);
}
}
*************************************************************************************************
Desktop environment is:
Ubuntu 10.04 LTS - the Lucid Lynx
ch...@linux-desktop:~/pierce/cs552/test$ javac -version
javac 1.6.0_18
ch...@linux-desktop:~/pierce/cs552/test$ java -version
java version "1.6.0_18"
OpenJDK Runtime Environment (IcedTea6 1.8.2) (6b18-1.8.2-4ubuntu2)
OpenJDK Client VM (build 16.0-b13, mixed mode, sharing)
Results of running program on desktop are exactly as expected.
ch...@linux-desktop:~/pierce/cs552/test$ java BadScanner
About to create Scanner
Created Scanner, type something...
Hello
You typed: Hello ...now type something else
World
And then you typed: World
ch...@linux-desktop:~/pierce/cs552/test$
*************************************************************************************************
Results of running program on laptop are NOT as expected. This is from
execution of the class file created on the desktop. (Note also that
according to Update Manager laptop system is up to date.)
ch...@chuck-laptop:~/pierce/cs552/test$ java BadScanner
About to create Scanner
Hello
Created Scanner, type something...
World
You typed: Hello ...now type something else
Goodbye
And then you typed: World
ch...@chuck-laptop:~/pierce/cs552/test$
Laptop environment is:
Ubuntu 10.04 LTS - the Lucid Lynx
ch...@chuck-laptop:~/pierce/cs552/test$ javac -version
gcj-4.4 (Ubuntu 4.4.3-1ubuntu2) 4.4.3
Copyright (C) 2010 Free Software Foundation, Inc.
This is free software; see the source for copying conditions. There is NO
warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
ch...@chuck-laptop:~/pierce/cs552/test$ java -version
java version "1.5.0"
gij (GNU libgcj) version 4.4.3
Copyright (C) 2007 Free Software Foundation, Inc.
This is free software; see the source for copying conditions. There is NO
warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
*************************************************************************************************
ProblemType: Bug
DistroRelease: Ubuntu 10.04
Package: gcj-4.4-jre-headless 4.4.3-1ubuntu2
ProcVersionSignature: Ubuntu 2.6.32-25.45-generic 2.6.32.21+drm33.7
Uname: Linux 2.6.32-25-generic i686
NonfreeKernelModules: nvidia
Architecture: i386
Date: Mon Nov 15 13:25:05 2010
ExecutablePath: /usr/bin/gij-4.4
InstallationMedia: Ubuntu 9.10 "Karmic Koala" - Release i386 (20091028.5)
ProcEnviron:
SHELL=/bin/bash
LANG=en_US.utf8
SourcePackage: gcj-4.4
** Affects: gcj-4.4 (Ubuntu)
Importance: Undecided
Status: New
** Tags: apport-bug i386 lucid
--
Scanner/System.in Bad Behavior on Laptop
https://bugs.launchpad.net/bugs/675759
You received this bug notification because you are a member of Ubuntu
Bugs, which is subscribed to Ubuntu.
--
ubuntu-bugs mailing list
[email protected]
https://lists.ubuntu.com/mailman/listinfo/ubuntu-bugs