Welcome to the Treehouse Community

The Treehouse Community is a meeting place for developers, designers, and programmers of all backgrounds and skill levels to get support. Collaborate here on code errors or bugs that you need feedback on, or asking for an extra set of eyes on your latest project. Join thousands of Treehouse students and alumni in the community today. (Note: Only Treehouse students can comment or ask questions, but non-students are welcome to browse our conversations.)

Looking to learn something new?

Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and a supportive community. Start your free trial today.


Travis Bentz
Travis Bentz
640 Points

How do I get the java compiler program to work?

I am in Java Basics. This program:

treehouse:~/workspace$ clear && javac TreeStory.java && java TreeStory

has not worked for me since I used it, thus I've not seen the results of my inputs. What am I not doing or missing? Below are my codes.

        //__name __is a __adjective __noun_. __They are always __adverb __verb_.
        String ageAsString = console.readline("How old are you?  ");
        int age = Integer.parseInt(ageAsString);
        if (age < 13) {
        //Insert exit code
        int age = 12
        if (age < 13) {
          //Insert exit code
          console.printf("Sorry, you must be at least 13 to this program.\n");
        String name = console.readLine("Enter a name:  ");
        String adjective = console.readLine(Enter an adjective:  ");
        String noun = console.readLine("Enter a noun:  ");
        String adverb = console.readLine("Enter an adverb:  ");
        String verb = console.readLine("Enter a verb ending in -ing:  ");

        console.printf("Your TreeStory:\n----------------\n");
        console.printf("%s is a %s.  ", name, adjective, noun);
        console.printf("They are always %s %s.\n", adverb, verb);



2 Answers

Around your 4th line of code you are missing a semi-colon. It should read like this:

int age = 12;

Your first "if" statement should also be removed.

Hope this is helpful!

Travis Bentz
Travis Bentz
640 Points

Thank you. However, the program never worked from the start. That is the issue:
clear javac TreeHouse && java.TreeHouse && java TreeHouse I have migrated over to another class now, but I am not sure it was a bug or I missed something. I also put that code in by memory, so it may or may not be correct. It is correct in the sessions. Thanks!