Setup problem

Hello everyone, I am just trying run a java program and I'm getting the error:Exception in thread "main" java.lang.NoClassDefFoundError: convertthe program name is convert.I don't know if anyone can help me, but any suggestions would greatly be
[300 byte] By [mrsnoddya] at [2007-9-28 15:52:15]
# 1
and is your class called convert? Java is case sensitive and if file has name convert, the class has to be called convert too.ie:public class convert {public static void main(String[] args) {System.out.println("hello");}}
jungia at 2007-7-12 12:50:37 > top of Java-index,Developer Tools,Debugging and Profiling Tool APIs...
# 2

Ok I looked at the code again and ran it. the error message was actually:

Exception in thread "main" java.lang.NoClassDefFoundError: Convert

(Capital 'C' in convert this time)

Here is the code, I made sure all Convert had capital 'C' too:

import TerminalIO.*;

public class Convert {

KeyboardReader reader = new KeyboardReader();

ScreenWriter writer = new ScreenWriter();

double fahrenheit;

double celsius;

public void run() {

writer.print ("Enter degrees Fahrenheit: ");

fahrenheit = reader.readDouble();

celsius = (fahrenheit - 32.0) * 5.0 / 9.0;

writer.print ("The equivalent in Celsius is ");

writer.println (celsius);

reader.pause();

}

}

public static void main (String [] args) {

Convert tpo = new Convert();

tpo.run();

}

}

mrsnoddya at 2007-7-12 12:50:37 > top of Java-index,Developer Tools,Debugging and Profiling Tool APIs...
# 3
try to add constructor to your code:public Convert() {}
jungia at 2007-7-12 12:50:37 > top of Java-index,Developer Tools,Debugging and Profiling Tool APIs...
# 4
Where in my code do I add this?
mrsnoddya at 2007-7-12 12:50:37 > top of Java-index,Developer Tools,Debugging and Profiling Tool APIs...
# 5
where you want, but outside of methods, usually between fields and methods
jungia at 2007-7-12 12:50:37 > top of Java-index,Developer Tools,Debugging and Profiling Tool APIs...
# 6
Hmmm, I added it to the code but I still get the same error
mrsnoddya at 2007-7-12 12:50:37 > top of Java-index,Developer Tools,Debugging and Profiling Tool APIs...
# 7

import TerminalIO.*;

public class Convert {

KeyboardReader reader = new KeyboardReader();

ScreenWriter writer = new ScreenWriter();

double fahrenheit;

double celsius;

public void run() {

writer.print ("Enter degrees Fahrenheit: ");

fahrenheit = reader.readDouble();

celsius = (fahrenheit - 32.0) * 5.0 / 9.0;

writer.print ("The equivalent in Celsius is ");

writer.println (celsius);

reader.pause();

}

} <-- this is a mistake, del this bracket

public static void main (String [] args) {

Convert tpo = new Convert();

tpo.run();

}

}

jungia at 2007-7-12 12:50:37 > top of Java-index,Developer Tools,Debugging and Profiling Tool APIs...
# 8
Ok I copied your code and deleted the bracket...but yet again I received the same error.
mrsnoddya at 2007-7-12 12:50:37 > top of Java-index,Developer Tools,Debugging and Profiling Tool APIs...
# 9

i used this code, 'cause I havn't got package TerminalIO.* and all works fine:

public class Convert {

//KeyboardReader reader = new KeyboardReader();

//ScreenWriter writer = new ScreenWriter();

double fahrenheit = 40;

double celsius;

public void run() {

//writer.print ("Enter degrees Fahrenheit: ");

//fahrenheit = reader.readDouble();

celsius = (fahrenheit - 32.0) * 5.0 / 9.0;

System.out.print ("The equivalent in Celsius is ");

System.out.println (celsius);

//reader.pause();

}

public static void main (String [] args) {

Convert tpo = new Convert();

tpo.run();

}

}

commands i've used were:

javac Convert.java

java Convert

jungia at 2007-7-12 12:50:37 > top of Java-index,Developer Tools,Debugging and Profiling Tool APIs...