Hi
Two remarks to begin with:
1) You shouldn't save your .java and .class files to your desktop, you'll make a complete mess. Place them in /home/username instead.
2) You don't need to be root to write and compile your java file in your home directory (that's the whole point of working in your home directory: it's the one place where a regular user can do pretty much as (s)he likes). If you work as root, you could (and probably will some day) make a mistake that destroys your system. Only become root when you need to move your files to a different directory. To make it work as a regular user, you need to edit the bash_profile in
your own home directory as I described before (not in the root directory).
Now, your problem. I don't really see why java Hello should fail this time if you did exactly what you did the first time. Let's go over the commands you used:
vi Hello.java
Vi was good for an example, but it may be easier to use another text editor, e.g. "gedit" or "leafpad". You could launch these directly by clicking their menu item instead of launching them from the command line.
javac Hello.java
If you don't receive any errors, then you're doing fine.
java Hello
NoClassDefFoundError basically means that java doesn't find the Hello.class file. That beats me. If you were able to compile in that directory, I don't see why you shouldn't be able to run the class file from there as well. Are you absolutely sure you didn't make any error (java is very sensitive to even the tiniest error: forgetting a space or writing a capital instead of a regular letter can be enough to get an exception or an error!).
As for uploading to tomcat, I wouldn't do it the way you did it. I've always placed my stuff in a war file before uploading and I wouldn't be surprised if that's the only way to make it work.
Anyway, use netbeans, that'll take care of everything (editing, paths, compilation, uploading,...)
Here's just one example. As I said, I can't possibly even begin to show you how it works because there's so much to it. and the same goes, in fact, for Java, JSP and Servlets: it took me 3000 pages to become proficient so it's an illusion that I could teach you even the basic skills in a couple of posts. I suggest you look on the internet for some good tutorials. Start by learning some java, then do jSP and servlets (I think doing servlets without knowing java is pretty impossible because you need java to write them).
Anyway, the netbeans example:
1) launch netbeans from the menu or from the desktop item
2) First check whether it is pointing towards your jdk (you need to do that only the first time):
go to /Tools/Java Platform; it should be pointing to /opt/jdk1.6.0 if that's where your jdk is
3) Next you define your server: go to Tools/Server Manager: replace the default username and password with your own (this too needs be done only once)
4) Click File/new Project
5) Select Web and Web Application; click next
6) Define the project name (for example, myfirstservlet) and specify the Project Location (/home/username); leave the rest as it is
7) Click Next
8) Click Finish
9) Right-click on the project name in the left pane so a dialog pops up; select new; select servlet
10) Assign a Class name: for example, TestingServlet (I think that's what yours was called, right?) and define a Package: for example, com.me4linux.servlets
11) Click next and change the first letter of "URL pattern" with a regular letter (not a capital letter); do not delete the / or the rest of the word! Click Finish.
12) Now write your servlet: delete all the stuff from "response.setContentType" to "out.close()" and replace it with your own stuff.
13) In the left pane, under project name, unfold the directory tree and unfold Packages; select your servlet, do a right-click and click on Compile. If you get errors, there are mistakes in your servlet, you'll have to edit it first and then try compiling again until you get it right.
14) Next right-click on the project name in the left pane and select Deploy Project (netbeans will now upload your project/servlet to its tomcat server).
15) To see the page, you launch a browser and define the location of your servlet:
http://localhost:XXXX/name of the project/url pattern of the servlet
where XXXX is the port assigned to your Tomcat (look under Tools/Server Manager for the number: it's 4 digits)
Where name of the project is the name you defined while making the project
Where url pattern is the pattern defined while making the servlet
if your port is, say, 8080 and you adopted all the values I suggested, you should use:
http://localhost:8080/myfirstservlet/testingServlet
Note: don't click on the urls above; they're just examples but this forum seems to turn them into real links no matter what I do.
Note: using localhost on Fedora is a bit inconvenient at this time; you can use 127.0.0.1 instead of localhost.