• 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
  • Bear Bibeault
  • Devaka Cooray
  • Liutauras Vilda
  • Jeanne Boyarsky
Sheriffs:
  • Knute Snortum
  • Junilu Lacar
  • paul wheaton
Saloon Keepers:
  • Ganesh Patekar
  • Frits Walraven
  • Tim Moores
  • Ron McLeod
  • Carey Brown
Bartenders:
  • Stephan van Hulst
  • salvin francis
  • Tim Holloway

runtime error  RSS feed

 
Ranch Hand
Posts: 35
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hello all,

i'm trying interface but the following coad make error
" Exception in thread "main" java.lang.NoclassDefFoundError: Test "
any one can help from this hurdeal

interface Bounceable {

void bounce();
void setBounceFactor(int bf);
}

class Tire implements Bounceable {

public void bounce(){

System.out.println(" defaultly this method will be abstract and public");
}

public void setBounceFactor(int p) {
System.out.println(" what ever access specifier in interface but in implement it will be public");

}
}
class Test {
public static void main (String args[]){

Bounceable oB= new Tire();
oB.bounce();
oB.setBounceFactor(8);
}
}
 
Ranch Hand
Posts: 320
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Look at the class that implements main().
What can you see about it's "visibility" that might get in the way such that the JVM can't find main() to load it?
 
Greenhorn
Posts: 19
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Java can't find your .class files. Make sure the .class files directory is in your classpath (via environment variable CLASSPATH or via adding -cp directoryname in your command line
 
Ranch Hand
Posts: 202
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
it sees where classpath is being its, in annex I placed a tutorial one in Portuguese (you can use a translator) that she teaches to configure the variaveis of environment in less than 5 minutes and to leave everything ok. This error of compilation, is why its archive class was not found.
 
It is sorta covered in the JavaRanch Style Guide.
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!