Welcome to the Treehouse Community

Want to collaborate on code errors? Have bugs you need feedback on? Looking for an extra set of eyes on your latest project? Get support with fellow developers, designers, and programmers of all backgrounds and skill levels here with the Treehouse Community! While you're at it, check out some resources Treehouse students have shared here.

Looking to learn something new?

Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and join thousands of Treehouse students and alumni in the community today.

Start your free trial

Java

What the heck is a bash error, and why am I getting one?

I am getting a bash error when trying to run the following basic program in the TH workspaces console:

import java.io.Console;

public class Introductions {

    public static void main(String[] args) {
        Console console = System.console();
        // Welcome to the Introductions program!  Your code goes below here
      console.printf("Hi, A");

  }
}

To explain further, I at first ran Introductions with the .java at the end in the console, which is incorrect, and resulted in the bash error, but now it won't stop giving the bash error when I input the run correctly, java Introductions. So what the heck is a bash error, and why am I continuing to get one when I'm running the console commands correctly now?

I'm not even a big fan of getting input from Console. I find it easier to use a Scanner object from importing java.util.Scanner.

It is easier if you can do it this way:

Scanner input = new Scanner(System.in);
System.out.println("What is your name?")
String name = input.nextLine();
System.out.println("Hello, "+ name);

Hi nekilof,

Have you saved alle changes in the workspace?

Can you post the bash error ?

Grigorij