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.

Timothy Flanagan
713 PointsWhy do I keep getting an invalid flag error?
When I try to compile and run I get this message:
javac: invalid flag: %%
Usage: javac [options] [source files]
use -help for a list of possible options
But with arrow brackets instead of regular brackets. Sorry, I don't know how to input it here so it shows up properly!
My code is the exact same, as far as I can see, as the code in the video :(
5 Answers

Timothy Flanagan
713 Pointspublic 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();
System.out.printf("The dispenser character is %s\n",
dispenser.mCharacterName);
}
}

Timothy Flanagan
713 PointsOy. I figured it out. It's so dumb, I'm afraid to say it. I put %% instead of && when I was running the command. Noob apologies.

Benjamin Keller
20,763 PointsHaha. It happens. Good luck with future programming!

Benjamin Keller
20,763 PointsIt would help if you posted your code between three ticks.
code here
the ` is located just below the escape key, at least on windows.

Benjamin Keller
20,763 PointsI did some research, and an invalid flag error is based on the command you are putting into the console. Make sure there are no spaces in the file and the file name is spelled correctly.

Timothy Flanagan
713 PointsNone that I can find :/ Everything seems to be spelled correctly.