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 Java Objects Meet Objects Creating Classes

Amir Tamim
Amir Tamim
8,597 Points

Console Not Running the program

I was wondering why the console will not run my code when I type in : clear && javac Example.java && java Example So far, nothing I have written can be displayed in the console, only the Tools_Options shenanigan

Jonathan Grieve
Jonathan Grieve
Treehouse Moderator 91,252 Points

Hi Amir,

Could you post your code to the forum for us? There's likely some errors in the code we'll have to debug before your program runs :)

Jennifer Nordell
seal-mask
.a{fill-rule:evenodd;}techdegree
Jennifer Nordell
Treehouse Teacher

This will be much easier for us to help you troubleshoot if we can see your code. The easiest way to get your code to us is to post a link to a "snapshot" of your workspace. On the upper right hand side of your workspace you will find a camera icon. Clicking that will create a "snapshot" which you can link here. We can then make a copy of the workspace and take a look at what might be going on. :sparkles:

Amir Tamim
Amir Tamim
8,597 Points

This is the code

public class Example {

  public static void main(String[] args) {
    // Your amazing code goes here...
    System.out.println("We are making a new PEZ Dispenser."); 
    PezDispenser dispenser= new PezDispenser();
    dispenser.characterName="Darth Vader"; 
    System.out.printf("The dispenser is %s %n",  
                      dispenser.characterName);
  }

}

Moderator edited: Added markdown so the code renders properly in the forums.

2 Answers

I was stuck on this for around 30 mins till I realized I never saved the code. Try saving it then rerunning the code in the console and checking to see if that helps =)

Jonathan Grieve
MOD
Jonathan Grieve
Treehouse Moderator 91,252 Points

Okay it looks like you might need to pass in a String to the console to feed in the character name. Try this

clear && javac Example.java && java Example Amir

And see if it returns the sentence.

Amir Tamim
Amir Tamim
8,597 Points

It will not run it. Only says

JAVA_TOOL_OPTIONS: -Xmx128m

Picked up _JAVA_OPTIONS: -Xmx128m

Picked up JAVA_TOOL_OPTIONS: -Xmx128m

Picked up _JAVA_OPTIONS: -Xmx128m

Amir Tamim
Amir Tamim
8,597 Points

It worked! Thanks so much!