im right at the beginning following a tutorial from a book.......when i type in javac MyFirstApp.java it comes up with a cannot be read error 1 message. I tried using textwrangler but the message still comes up. Am i supposed to save the file somewhere in particular because it is just on my desktop at the moment? I think it is a plain text document as well. I know someone had this problem before.....any suggestions? Thanks people.
When you open Terminal, type cd (for "change directory") followed by a space and the path of the directory that contains your .java file, then hit return.
For example, I dump a lot of stuff under java/tests, so when Terminal opens, I type: cd java/tests
"We're kind of on the level of crossword puzzle writers... And no one ever goes to them and gives them an award." ~Joe Strummer sscce.org
Joined: May 31, 2006
do i need to create a directory like java/tests to dump the stuff in? if so how do i do that? Thanks again for the advice guys.....i did warn you im right at the beginning haha and desperate to get started, take care
In Finder, navigate to where you want the new folder, then select "New Folder" from the File menu. Or instead of the File menu, you can use the "gear" action button at the top of Finder.
(Tip: At the top of Finder are also 3 view selection buttons: icons, list, and columns. To make sure the directory goes where you expect it to, avoid using the list view.)
As an alternative to using Finder, there's also a geek approach: The Unix command to make a directory in Terminal is mkdir followed by a space and the name of the directory (folder) you want to create.
Joined: May 31, 2006
ok so at first it wouldnt recognise that id made a new directory in my documents folder....but then i tried the mkdir command in terminal and that seemed to work because my terminal prompt now has /java at the end.
but still when i type javac MyFirstApp.java i get this
error: cannot read: MyFirstApp.java 1 error
and when i tried typing cat MyFirstApp.java i get this
cat: MyFirstApp.java: No such file or directory
is there somewhere in particular i need to put my directory? This is so frutrating as i really dont know what im doing wrong and im so close to getting started! Thanks again for your help guys.
Good move! Without a working knowledge of using the command line, you'll find yourself struggling with simple issues that will just get in the way of trying to actually program.
I know it probably seems frustrating and you want to just dive into the programming aspect -- after all, that's the fun part! -- but learning your way around the command line will serve you well on all levels.
And by the way, recommending the book was not a way to say "go away and RTFM"! We're all still here to answer your questions and help you along.