I have been trying to go through the exercise in Head First Java, and I did the first exercise, but when I go to the command prompt to move to the directory where java is, the computer tells me that c:\program (It's in the program files) is not a recognizable command, or batch file, etc. What am I missing?
you shouldn't be going to where java is installed, but to where you have saved your .java file. and that should be somewhere OTHER than where java is installed. I have a c:\slop directory, but many folks don't like that name.
In any case, to change directories, you need to type "cd path/to/files".
if you are trying to change to a directory with a space in it (like 'program files'), enclose it in double-quotes:
cd "c:\program files"
Note that in windows, once you have 'enough' of the directory typed, you can hit the tab key and it will auto-finish. I think if you have NOT typed enough, it will put in the first match, and you can continue tabbing until you get the dir you want.
There are only two hard things in computer science: cache invalidation, naming things, and off-by-one errors
Thank you for all the help For the record, I did set the path for java, found the directory where the java file was living, and it won't let me change to that directory either. It says it cannot find the path specified. I'm using Windows 7, btw. Am I missing something? And Sheriff, thank you for the warm welcome.
Joined: Jul 26, 2011
Okay, I finally got the compiler working. But when trying the example, the book says the last line of code is } //more code...
when I run javac, it says that there is an error in that statement, and I've tried taking it apart piece by piece, and there's still an error. Any suggestions?
Joined: Oct 13, 2005
I suggest you open a command prompt and write these two lines
Next time you need to get to your "java" folder, you only need the second line. Obviously you can choose a different name for the folder.
You should avoid putting your own work inside the Java™ installation folders in Program Files. If you create your own folder (which would be inside "My Documents" if you follow my suggestion), you will have access to it because the OS wont' think it is a system folder.
As for the compiler error, please show us more code.
post all your code. use the 'code' button the same way you'd do italics or bold. clicking the button gives you a [ code] and a [ /code] (only without the spaces). paste what you have between them, and it will preserve your formatting, making it easier to read.
and don't just say 'the compiler gave me an error'. The text it gives is often very specific, telling you exactly what the error is. So please post the entire text of the error as well (if there is more than one, the first one or two are enough).
If you do those two things, it is orders of magnitude easier to help you with your problem.
I’ve looked at a lot of different solutions, and in my humble opinion Aspose is the way to go. Here’s the link: http://aspose.com