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
Allan Evans
9,501 PointsBasic question about the Java (not JavaScript) the compiler.
Hey guys, I was going to continue learning Java with Sun's tutorials, but I can't get the thing to compile, here is what I have in the command prompt:
C:\Program Files\Java\jdk1.7.0_21\bin>javac C:\Allan Evans\My Documents\HelloWorldApp.java
I thought I had the proper path ready, cause for some reason it won't let me save files in the java folder. If you see what I missed let me know please.
3 Answers
Allan Evans
9,501 PointsI'll go ahead and do that, got the file to compile by putting the file in the same folder as the javac program, but for future reference it will help. Yeah, i want to learn as much as i can about java, maybe even specialize in it.
Ernest Grzybowski
Treehouse Project ReviewerAs a note Ben Jakuben (The android instructor extraordinaire) has mentioned that he plans on a Java foundations series on treehouse that you might want to look out for.
Mike Morales
19,833 PointsJava is definitely a strict language to learn, and a beast at that. Good to know you were able to compile your file. I don't know if your using a text editor or an integrated development environment (IDE) to compile your file(s) with? But my favorite IDE is using Netbeans, I find it extremely helpful to use but can be complex to grasp at first. If your interested here are a few other IDE's: Eclipse, BlueJ, and JCreator. You can always visit youtube for tutorials on how to program with Java. Good luck, man!
Rick Rakin
6,531 PointsI believe your problem stems from the fact that you have some folder names that are more than one word. cmd doesn't like that. You need to write C:\"My Documents"\ . . . or whatever it is.
I keep a folder named C:\java
Nice and easy to type for whenever I'm compiling from the command line instead letting the IDE do it. Makes working with path names so much easier. Using the up and down arrow keys to quickly recall path names is a lifesaver too.
Mike Morales
19,833 PointsMike Morales
19,833 PointsHi Allan, Java can be quite a monster to deal with. There is a shorter way of compiling your HelloWorld.java file without having to write the long path each time you want to compile a file. The shorter way is to write javac HelloWorld.java > enter, then java HelloWorld > enter. But since, I don't remember exactly how to set it up through the Environment Variables section. Here is a link http://docs.oracle.com/javase/tutorial/getStarted/problems/index.html. Be sure to click on the Updating the PATH variable link, hope it helps.