Re: Begining to learn Java
Go back and read the part of the book that tells you how to set your path
and your classpath. If the book doesn't tell you that, then you need to get
a better book.
Alfy <j-_dias_2k@yahoo.com> wrote in message
news:39ea43b0$1@news.devx.com...
>
> Hi Everybody
>
> Am a novice to Java triyng to learn it from scratch. Am referring the Java
> How to Program by Deitel & Deitel
>
> I tried one of the examples from the book but it pops up following runtime
> error.
>
> Exception in thread "main"
java.lang.NoClassDefFoundError:Comparision.class
>
> My code is given below :
>
> import javax.swing.JOptionPane;
>
> public class Comparision {
> public static void main ( String args[] )
> {
> try
> {
> String firstNumber, secondNumber, result;
> int number1, number2;
> firstNumber = JOptionPane.showInputDialog("Enter first integer:");
> secondNumber = JOptionPane.showInputDialog("Enter second integer:");
>
> number1 = Integer.parseInt(firstNumber);
> number2 = Integer.parseInt(secondNumber);
> result = "";
>
> if(number1 == number2)
> result = result + number1 + " == " + number2;
> if(number1 != number2)
> result = result + number1 + " != " + number2;
> if(number1 < number2)
> result = result + "\n" + number1 + " < " + number2;
> if(number1 > number2)
> result = result + "\n" + number1 + " > " + number2;
> if(number1 <= number2)
> result = result + "\n" + number1 + " <= " + number2;
> if(number1 >= number2)
> result = result + "\n" + number1 + " >= " + number2;
>
>
> JOptionPane.showMessageDialog( null, result, "Comparision
Results",
> JOptionPane.INFORMATION_MESSAGE);
>
> System.exit( 0 );
> }
> catch (Error err)
> {
> System.out.println("Error Trapped");
> }
>
> }
> }
>
> I cant figure out where to look for the error. Can some body
help!!!!!!!!!!!!!!!!!!!!!
>
> Alfy
>
>
Re: Begining to learn Java
"Paul Clapham" <pclapham@core-mark.com> wrote:
>Go back and read the part of the book that tells you how to set your path
>and your classpath. If the book doesn't tell you that, then you need to
get
>a better book.
>
>Alfy <j-_dias_2k@yahoo.com> wrote in message
>news:39ea43b0$1@news.devx.com...
>>
>> Hi Everybody
>>
>> Am a novice to Java triyng to learn it from scratch. Am referring the
Java
>> How to Program by Deitel & Deitel
>>
>> I tried one of the examples from the book but it pops up following runtime
>> error.
>>
>> Exception in thread "main"
>java.lang.NoClassDefFoundError:Comparision.class
>>
>> My code is given below :
>>
>> import javax.swing.JOptionPane;
>>
>> public class Comparision {
>> public static void main ( String args[] )
>> {
>> try
>> {
>> String firstNumber, secondNumber, result;
>> int number1, number2;
>> firstNumber = JOptionPane.showInputDialog("Enter first integer:");
>> secondNumber = JOptionPane.showInputDialog("Enter second integer:");
>>
>> number1 = Integer.parseInt(firstNumber);
>> number2 = Integer.parseInt(secondNumber);
>> result = "";
>>
>> if(number1 == number2)
>> result = result + number1 + " == " + number2;
>> if(number1 != number2)
>> result = result + number1 + " != " + number2;
>> if(number1 < number2)
>> result = result + "\n" + number1 + " < " + number2;
>> if(number1 > number2)
>> result = result + "\n" + number1 + " > " + number2;
>> if(number1 <= number2)
>> result = result + "\n" + number1 + " <= " + number2;
>> if(number1 >= number2)
>> result = result + "\n" + number1 + " >= " + number2;
>>
>>
>> JOptionPane.showMessageDialog( null, result, "Comparision
>Results",
>> JOptionPane.INFORMATION_MESSAGE);
>>
>> System.exit( 0 );
>> }
>> catch (Error err)
>> {
>> System.out.println("Error Trapped");
>> }
>>
>> }
>> }
>>
>> I cant figure out where to look for the error. Can some body
>help!!!!!!!!!!!!!!!!!!!!!
>>
>> Alfy
>>
>>
>
>
Hi!
you don't SET CLASSPATH
SUCH AS: C:\>SET CLASSPATH=%CLASSPATH%;.;D:\JDK1.3.0_01\LIB\TOOLS.JAR
IT'S TEMPORARY! WHEN YOU CLOSE DOS COMMAND!
YOU CAN START>CONTROL PANEL>SYSTEM>ENVIRONMENT>CLASSPATH
SET COMMAND SUCH AS:D:\OEM21\orb\classes\yoj.jar;D:\OEM21\orb\classes\share.zip;.;D:\JDK1.3.0_01\LIB\TOOLS. JAR
CAREFUL . IT'S VERY IMPORTANT!