Textmate System.out throws error

103 views Asked by At

I've been using Textmate 2.0 for Java. I get no error when I use JOptionPane class. However, when I use System.out and System.in, I get the following error (see screenshot below).

What is interesting is that the program compiles and run correctly when I do it from the terminal. So, something is wrong with Textmate 2.0's output. Any ideas? Thanks for your time.

Here's the code if you wish to run it:

    /* Sample Program: Compute Area and Circumference using standard
input and output
*/ 

import java.io.*; 
import java.text.*; 

class Ch3Circle2 {
    public static void main(String[] args) throws IOException {
        final double PI = 3.14159; 
        String radiusStr; 
        double radius, area, circumference; 
        BufferedReader     bufReader; 

        DecimalFormat df = new DecimalFormat("0.000");
        bufReader = new BufferedReader(new InputStreamReader(System.in));

        //Get Input
        System.out.print("Enter radius: ");
        radiusStr = bufReader.readLine();

        radius = Double.parseDouble(radiusStr);

        //Compute area and circumference 
        area            = PI * radius * radius; 
        circumference   = 2.0 * PI * radius; 

        //Display the results 
        System.out.println("");
        System.out.println("Given Radius: " + radius);
        System.out.println("Area: " + df.format(area));
        System.out.println("Circumference: " + df.format(circumference));

    }
}

enter image description here

0

There are 0 answers