This week's book giveaway is in the Java 8 forum.
We're giving away four copies of Java 8 in Action and have Raoul-Gabriel Urma, Mario Fusco, and Alan Mycroft on-line!
See this thread for details.
The moose likes Cattle Drive and the fly likes Errors getting set up - New Guy Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Java 8 in Action this week in the Java 8 forum!
JavaRanch » Java Forums » This Site » Cattle Drive
Bookmark "Errors getting set up - New Guy" Watch "Errors getting set up - New Guy" New topic
Author

Errors getting set up - New Guy

John Kirchner
Greenhorn

Joined: Dec 05, 2008
Posts: 3
Hello all! I decided to learn Java and, being new, I installed NetBeans (WindowsXP system) first and, then, as part of reading more about Java I found this site. I found the College and began working on the main page to make sure all worked.

I had path issues when I tried to compile the code on the page (the HelloWorld app) but corrected that. My problem now is running the app. I get this error: exception in thread "main" java.lang.NoClassDefFoundError. I have searched the web and have determined it seems to be related to the CLASSPATH. I have tried various approaches I found to solve this but have had little luck.

Does the classpath go to the folder the apps I make are in (in this case that would be the C:\java folder I made, following the ideas on the Cattle Drive page)? Or does it got to where the jdk is set up?

Or am I better off to uninstall NetBeans? Everything works beautifully through NetBeans. I typed the code in Notepad, saved it, opened it in NetBeans and everything works. I just want to do it right

Oh, is it OK for a newbie to Java to start this course? I do have some programming experience but not in Java.

[ December 05, 2008: Message edited by: John Kirchner ]
[ December 05, 2008: Message edited by: John Kirchner ]
Marilyn de Queiroz
Sheriff

Joined: Jul 22, 2000
Posts: 9043
    
  10
Originally posted by John Kirchner:
Does the classpath go to the folder the apps I make are in (in this case that would be the C:\java folder I made, following the ideas on the Cattle Drive page)? Or does it got to where the jdk is set up?


The classpath needs to point to where your apps are ... The jdk classes are automatically included when you type
java HelloWorld
(Note that is is not
java HelloWorld.java or java HelloWorld.class)

Also, remember to put the dot at the beginning of the classpath.

Or am I better off to uninstall NetBeans? Everything works beautifully through NetBeans. I typed the code in Notepad, saved it, opened it in NetBeans and everything works. I just want to do it right

I think you don't need to uninstall NetBeans, however, I would ignore it at least until you get it working without NetBeans so that you understand what is happening and you don't need to depend on the IDE to handle all that for you... you'll need to know it sooner or later and, in my opinion, sooner (and with simpler apps) is better.

Oh, is it OK for a newbie to Java to start this course?

Absolutely!!


JavaBeginnersFaq
"Yesterday is history, tomorrow is a mystery, and today is a gift; that's why they call it the present." Eleanor Roosevelt
John Kirchner
Greenhorn

Joined: Dec 05, 2008
Posts: 3
Thank you very much for your help! I actually found the problem. The devil is in the details I guess. I carefully reread the Cattle Drive page and realized that, though I had updated my path to include the sdk, I never included the path to the JRE. I added this little bit in "C:\Program Files\Java\jdk1.6.0_11\jre\bin" and it runs like it should.

I did uninstall NetBeans though. I really just like a text editor. I always use VI on my Linux box...just old school I guess.

So, off to read the chapters and get the rest set up. I am really looking forward to learning Java.
Carol Murphy
village idiot
Bartender

Joined: Mar 15, 2001
Posts: 1190
Welcome, John! You'll be glad you found the ranch and decided to do the drive. When you get your first assignment submitted for nit-picking, post it in the assignment log thread, and when I get back home I'll add you to the student list. (I'll be home on the 17th!) I could try to add you manually from here, but I'd probably screw something up........
Katrina Owen
Sheriff

Joined: Nov 03, 2006
Posts: 1347
    
  13
Welcome!

I work as a developer, and am still using vi as my editor. I just never got into any IDE.

Works for me
John Kirchner
Greenhorn

Joined: Dec 05, 2008
Posts: 3
Thanks for the welcomes, I appreciate it.

Carol, I have not fully signed up yet. I have gotten the book and have started reading/practising but I have to get Christmas sorted and such before I can get the tuition together.

As a side note, I really appreciate the forums here. I had problems with my work laptop and getting java to work correctly. After some hunting here, I found it was the java files that oracle installs. Their paths were conflicting. I found the solutions and hints to the source of the problem here.
Katrina Owen
Sheriff

Joined: Nov 03, 2006
Posts: 1347
    
  13
Eh, I hear you... These forums have been a life saver for me!
Carol Murphy
village idiot
Bartender

Joined: Mar 15, 2001
Posts: 1190
This site is a gold mine, imho.
 
 
subject: Errors getting set up - New Guy
 
Similar Threads
Classpath problem - VERY URGENT
Doubt regarding Classpath
Create Executable Jar File With User Library
CLASSPATH question in Linux SuSE
Netbeans Ant Error