This week's book giveaway is in the General Computing forum.
We're giving away four copies of Arduino in Action and have Martin Evans, Joshua Noble, and Jordan Hochenbaum on-line!
See this thread for details.
The moose likes Beginning Java and the fly likes problems running code Big Moose Saloon
  Search | Java FAQ | Recent Topics
Register / Login


JavaRanch » Java Forums » Java » Beginning Java
Reply Bookmark "problems running code " Watch "problems running code " New topic
Author

problems running code

AKIN Ojo
Greenhorn

Joined: Sep 28, 2005
Posts: 1
i have just started to read the head first java i use a mac os x,
and since the sdk files are supposed to be included with
mac os x, i thought i should discover how to get my java codes
running, and so i haveused the following example in the book

public class abc {

private static void main (String[] args) {
System.out.print("i rule!");
System.out.print("the world!");

}
}

thank you all
[ September 28, 2005: Message edited by: AKIN Ojo ]
Phil Dixon
Greenhorn

Joined: Aug 13, 2005
Posts: 11
Akin,

Could you post your code as well.
Norm Radder
Ranch Hand

Joined: Aug 10, 2005
Posts: 681
Here's one way to get that message. The file asdf does not exist in the current directory
>java asdf
Exception in thread "main" java.lang.NoClassDefFoundError: asdf

Check where the class file is.

When having runtime errors, please post all the console including what you entered.
Jesper de Jong
Java Cowboy
Bartender

Joined: Aug 16, 2005
Posts: 12952
    
    3

> private static void main (String[] args) { ...

The main method should be public, not private.


Java Beginners FAQ - JavaRanch SCJP FAQ - The Java Tutorial - Java SE 7 API documentation
Scala Notes - My blog about Scala
 
I agree. Here's the link: http://ej-technologies/jprofiler - if it wasn't for jprofiler, we would need to run our stuff on 16 servers instead of 3.
 
subject: problems running code
 
Similar Threads
Class.getMethod with variable args - part 2
Behaviour of Volatile variables
Beginner's problem: Unable to find a link to download java on Mac
Compile and run java program in Macintosh
Next kitty will be ...