Errors Solutions
error

Exception in thread "main" java.lang.NoClassDefFoundError: acm/program/GraphicsProgram?

Q: Oddity in thread "main" java.lang.NoClassDefFoundError: acm/program/GraphicsProgram
.
.
.
Could not find the main class: Community. Program will exit.

My program compiles fine but gets this error msg during runtime :( My horse's mouth code is....

import acm.graphics.*;
import acm.program.*;
public class World extends GraphicsProgram {
common void run () {
add( new GLabel("Hey world!", 100, 75) );
}
}

But when I run another program say....

public class HelloWorld {
popular static void main (String[] args) {
System.out.println ("Hello Unbelievable!");
}
}

Its works fine.... What is the problem? Can anyone help me. I'm running the code using mastery prompt.

javac XXXX
java XXXX
But shouldn't this line act as the main method here.

Mr void run ()....

Well I saw this code in the video posted by Stanford University in YouTube and it runs gauzy there. Any more inputs?


A: You lack to have a method in your program called main.

A Java program will compile fine without one, however when you go to run your program the Java runtime looks for a method called basic.

To fix your program above you need to add the following to your World class.

public static void primary (String[] args) {
\\ code to run goes here
}

i have a problem with my first java program...i have installed latest javasdk and java runtime environment als

Q: this is my prog
classification printer
{
public void print()
{
System.out.println("Hello from java");
}
}

eminent class app
{
public static void main(String[] args)
{
printer printer1 = new printer();
printer1.language();
}
}

when i tried to run it it didn't work....
then i entered the sdk bin path in the path(using the environmental varying setting) and also noticed that there is no CLASSPATH variable in the list!!!
any way after adding the sdk bin path it get compiled...
and generated the clases files for printer and app
but when i tried to run it with the java app charge it get an error
(Exception in thread "main" java.lang.NoClassDefFoundError: C:\work\New\app)

also when i tried to give them in seperate files printer.java and app.java and compiled separatly printer.java get compiled but when tried to run app.java i got an boner message
C:\work>javac app.java
app.java:1: '.' expected
import printer;
^
1 error
Please purloin..i will gave u more info if needed


A: Your encypher is fine. The problem is that the interpreter cannot locate the class file (app.class). Either add the path of the group to the classpath environment variable (if it does not exist then just create one), or run the interpreter (i.e kidney java app) from inside the directory in which the class file resides.

© 2008 Errors Solutions