Boy, that was a lot of questions. there's nothing wrong with that at all, but maybe break things into paragraphs when you change thoughts. It's sort of hard to read. Let's see:
do I always have to type "javac" with the class, and right after javac, type in java with the class, just to get my program running?
javac is the java compiler. You will use it to build the .class files for any .java file you write. The rule in java is one class per file (you can have classes nested inside of one another, but that's much later on). Right now you will probably only be using one class for each program, but eventually you'll be branching out and writing your own classes and each will need it's own file. The compiler changes your source code, which is just a bunch of meaningless text to the computer (or JVM, the machine that runs java bytecode), and turns it into machine code (bytecode in the case of java, which is the machine code of the JVM).
I've mentioned the JVM a few times so far, so that might bear some explanation. The JVM (Java virtual machine) is a software implementation of a computer that can be run on many different types of actual hardware. This is why you can (in general) run java code on windows, the mac, unix, linux, etc. without changes. There are of course exceptions, but in general by using the JVM Sun allows programmers to target
that machine instead of one specific type of hardware and OS.
Back to your question(s)... java is the program which will actually interpret and run your .class files. When you give it the name of the class, it searches for a .class files that contains that class, then searches for the main method with the signature that was detailed earlier. Once it finds this, it starts running the code (that is now compiled to bytecode).
So, in essence, each time you change a .java file, you have to compile that to a .class file with javac so it can be run by java.
Plus, what if I save stuff in a folder IN documents. Then what? How would I get inside the folder that's inside documents? Lets say the folder's name is Chapter 1. So would I somehow type in "cd Documents Chapter 1" or something like that?
http://www.uic.edu/depts/accc/software/unixgeneral/unix101.html
This is a brief UNIX tutorial that should answer your questions about directory navigation and file manipulation in UNIX. When you're using the terminal, this is basically your portal to the UNIX underpinnings of OS X. If you had directories set up like:
/Users/javahelp7/Documents/Chapter 1/
then when you open the terminal, you will be in your home directory (check where you are with the pwd command), so to get into the Chapter 1 directory, you'd type:
cd Documents<return>
cd "Chapter 1"<return>
The quotes are necessary for directories with spaces. Otherwise you have to type a \ before the space. You can also start typing filenames or directory names in the terminal and press <tab> and the shell will autocomplete names for you, which can be helpful with long directory names with a lot of spaces, etc.
And also, this time I didn't have any mistakes or anything, but if I do get an error, then what? Will it tell me if it's a spelling error, or if I forgot something, or what?
The compiler isn't human, so it won't be able to tell you everything, but it is quite good at telling you at least where, if not exactly what, you've done wrong.
https://forums.macrumors.com/members/170727/
This member is just starting out with Java as well, and has run into a lot of compiler errors. From their profile you can access threads they have started and see some examples. Some things are a little trickier, like forgetting a ; at the end of a line. The error will be on the next line because the compiler thinks you are continuing the statement from the line above. Some errors will be cryptic at first, but you will learn what the compiler is complaining about pretty quickly.
Oh, and I also have questions about future IDEs. Right now I have Smultron, and then I go over to the terminal. But if I ever get NetBeans, or Eclipse, or whatever else there is, first, which one is the most user-friendly or common? And also, for example, on NetBeans, there's like 6 different types you choose from to download. Which one? What's the difference between "Java" and "Web and Java EE"?
I like NetBeans the most, but for my purposes I have to use Eclipse (I thought being the architect for this product would mean i got to choose these sorts of things. Web services are sticky.). NetBeans is pretty straight-forward for basic kinds of things. However, once you start with an IDE getting your code/project OUT is pretty tough. The Java SE version of NetBeans should be fine, but I always get "All" just in case. =)
Also, if I do get NetBeans, Eclipse, etc., do I ever have to use the terminal anymore? Is there a place where I can type it in, click a button, have it compiled, click another button, have it run, etc.? Or do I always have to type in "javac" and "java" for it to compile and run?
The commandline builds character, dagnabbit! Yes, with IDEs they are the whole package in one program (hence the (I)ntegrated part of the acronym). They generally include an editor, compiler (and linker for languages that need it...), a means to run programs, and a debugger. Some have more than this, but this is generally what people have come to expect from an IDE. So you will not
get to use the commandline anymore (it's not a matter of
having to). =)
Sorry if I'm asking sooo many questions!
We all start somewhere. Just take a breathe between them and hit enter a few times.
Oh, and we have a few good folks around here who know how to nudge you in the right direction ... *hint hint* *cough*
Lee1210 *cough*
I try =).
-Lee