Java Java Basics Getting Started with Java Introduction to Your Tools

It's not printing my name!

I have copied Craig's text and written my code as follows:


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("Hello, my name is Emma");

} }

I then compiled it to create the Introductions.class

But when I type java Introductions into the bottom box, it just shows this:

treehouse:~/workspace$ javac
Picked up JAVA_TOOL_OPTIONS: -Xmx128m
Picked up _JAVA_OPTIONS: -Xmx128m
treehouse:~/workspace$ ls
index.html Introductions.class
treehouse:~/workspace$ java Introductions
Picked up JAVA_TOOL_OPTIONS: -Xmx128m
Picked up _JAVA_OPTIONS: -Xmx128m

What have I missed?

Fabian Pijpers
Fabian Pijpers
Courses Plus Student 40,640 Points

Maybe you forgot that } at the end to close it up. And as i recall from java it a go it was System.console.printline("Hello, my name is Emma"); Look at that.

1 Answer

Steven Parker
Steven Parker
207,999 Points

Did you perhaps forget to save your editing changes (with the menu or Ctrl-S shortcut) before recompiling?

If that's not it, make a snapshot of your workspace and post the link to it here and we can investigate further.

Yes! I forgot to save! Thanks so much. I remembered and went back to save, but I didn't compile again so it still wasn't working! So I started again and saved BEFORE compiling and it worked a treat - thanks so much!