• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Liutauras Vilda
  • Tim Cooke
  • Jeanne Boyarsky
  • Bear Bibeault
Sheriffs:
  • Knute Snortum
  • paul wheaton
  • Devaka Cooray
Saloon Keepers:
  • Tim Moores
  • Stephan van Hulst
  • Ron McLeod
  • Piet Souris
  • Ganesh Patekar
Bartenders:
  • Tim Holloway
  • Carey Brown
  • salvin francis

problems running code

 
Greenhorn
Posts: 1
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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 ]
 
Greenhorn
Posts: 11
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Akin,

Could you post your code as well.
 
Rancher
Posts: 3413
33
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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.
 
Java Cowboy
Posts: 16084
88
Android Scala IntelliJ IDE Spring Java
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
> private static void main (String[] args) { ...

The main method should be public, not private.
 
What's wrong? Where are you going? Stop! Read this tiny ad:
create, convert, edit or print DOC and DOCX in Java
https://products.aspose.com/words/java
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!