jQuery in Action, 3rd edition
The moose likes Beginning Java and the fly likes Help! java.lang.No Class Def ErrorFound: cool Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » Beginning Java
Bookmark "Help! java.lang.No Class Def ErrorFound: cool" Watch "Help! java.lang.No Class Def ErrorFound: cool" New topic

Help! java.lang.No Class Def ErrorFound: cool

M. Whatke

Joined: Jul 23, 2003
Posts: 3

I'm kind of new to java and need help compiling code. Basically, I can't do it. You see I wrote this code and It won't compile. Here it is:

class cool {
public static void main (String[] args) {
System.out.println("I am so cool");
System.out.println("I am cool");
System.out.println("I Rule!");
Whats going on?
M. Whatke
Michael Morris
Ranch Hand

Joined: Jan 30, 2002
Posts: 3451
Welcome to JavaRanch Michael. It won't compile or it won't run? NoClassDefFoundError is thrown by a ClassLoader at runtime when there is a reference to a class that is not in the CLASSPATH. Give us some specifics like what operating system you are using, what version of Java you are using and so forth and maybe we can get you started on your Java programming career.

Any intelligent fool can make things bigger, more complex, and more violent. It takes a touch of genius - and a lot of courage - to move in the opposite direction. - Ernst F. Schumacher
Joel McNary

Joined: Aug 20, 2001
Posts: 1824

Judging from the statements, I'd say that you didn't first compile the class. Run "javac cool.java" first to compile the code (which will produce a "cool.class" file), then run "java cool" (note that you do not specify the .class extension)
BTW, welcome to JavaRanch! One small point of order: while your sample code is readable enough as is, sometimes posting larger or more involved segments of code can be tough to read. I'd just like to point out the "CODE" button on the message edit screen. Simply push the button and place your code between the tags that appear in the message box. (Or, you can hand-code the [ CODE] and [ /CODE] tags yourself; I find it faster to type than use the mouse...)
[ July 24, 2003: Message edited by: Joel McNary ]

Piscis Babelis est parvus, flavus, et hiridicus, et est probabiliter insolitissima raritas in toto mundo.
M. Whatke

Joined: Jul 23, 2003
Posts: 3

I figured out that the dos prompt did not reconize my command "javac" because I had not Installed the Java SDK properly and there for I was not in the right directery to use the "javac"..."

Thanks again,
M. Whatke
boolean youarecool = true;
I agree. Here's the link: http://aspose.com/file-tools
subject: Help! java.lang.No Class Def ErrorFound: cool
jQuery in Action, 3rd edition