Can't work this out now

  • Thread starter Finbar Saunders
  • Start date
F

Finbar Saunders

Hello, I'm getting back into java, last used when jdk 1.02 was around. I'm
having a NoClassDefFoundError prob;

public class TestDriver
{
public static void main (String args[]){
Test t = new Test();
t.run();
{
{

I've tried saving this is TestDriver.java as well as in the Test.java
program;

public class Test
{
public Test(){};

public run() {
System.out.println("Test");
}
}

I'm saving this in Test.java.

I'm running this with java -cp c:\test c:\TestDriver but am getting the -
Exception in thread "main" java.lang.NoClassDefFoundError: error. I guess my
classpath is allright? I've tested this in jbuilderx and get the same issue.

any help appreciated,
thanks,
Fin.
 
J

Joona I Palaste

Finbar Saunders said:
Hello, I'm getting back into java, last used when jdk 1.02 was around. I'm
having a NoClassDefFoundError prob;
public class TestDriver
{
public static void main (String args[]){
Test t = new Test();
t.run();
{
{

These should be:
}
}
I've tried saving this is TestDriver.java as well as in the Test.java
program;
public class Test
{
public Test(){};

This won't compile. Lose the semicolon.
public run() {

This won't compile. You need a return type. Try:
public void run() {
System.out.println("Test");
}
}
I'm saving this in Test.java.
I'm running this with java -cp c:\test c:\TestDriver but am getting the -
Exception in thread "main" java.lang.NoClassDefFoundError: error. I guess my
classpath is allright? I've tested this in jbuilderx and get the same issue.

Try running it with java -cp c:\test TestDriver. The class name argument
should be a *class* name, not a *file* name.
 
G

Gregory A. Swarthout

Finbar Saunders said:
Hello, I'm getting back into java, last used when jdk 1.02 was around. I'm
having a NoClassDefFoundError prob;

public class TestDriver
{
public static void main (String args[]){
Test t = new Test();
t.run();
{
{

I've tried saving this is TestDriver.java as well as in the Test.java
program;

public class Test
{
public Test(){};

public run() {
System.out.println("Test");
}
}

I'm saving this in Test.java.

I'm running this with java -cp c:\test c:\TestDriver but am getting the -
Exception in thread "main" java.lang.NoClassDefFoundError: error. I guess my
classpath is allright? I've tested this in jbuilderx and get the same issue.

any help appreciated,
thanks,
Fin.


You don't indicate that you have compiled the .java file into a .class
file using javac.
 
W

Wolfgang Groiss

won't compile, run() method needs to have a return value declared, as in:

public void run() {
//...
}
 
T

Tony Morris

This solution might help:

http://www.bash.org/?42678

--
Tony Morris
(BInfTech, Cert 3 I.T.)
Software Engineer
(2003 VTR1000F)
Sun Certified Programmer for the Java 2 Platform (1.4)
Sun Certified Developer for the Java 2 Platform
 
T

Tris Orendorff

Hello, I'm getting back into java, last used when jdk 1.02 was around.
I'm having a NoClassDefFoundError prob;

Hey! How are your double entendres?


--
-----BEGIN GEEK CODE BLOCK-----
Version: 3.12
GCS d++ s+:- a+ C+ UL++++ P+ L+ E- W+ N++ o- K++ w+ O+ M !V PS+ PE Y+ PGP t+ !5 X- R- tv--- b++
DI++ D+ G++ e++ h---- r+++ y+++
------END GEEK CODE BLOCK------
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,995
Messages
2,570,228
Members
46,818
Latest member
SapanaCarpetStudio

Latest Threads

Top