|
-
Aug 30th, 2003, 07:38 PM
#1
Thread Starter
New Member
Newbie Java Programing Problem *Resolved*
Ok im REALLY new to Java like i cant get my first 2 programs FROM a BOOK to work. Here they are:
BigDebt.java
class BigDebt {
public static void main(String[] arguments) {
int debt = 59000000;
debt = debt / 1440;
System.out.println("A Minutes Worth Of Dedt Is: $" + debt);
}
}
Root.java
class Root {
public static void main(String[] arguments) {
int number = 255;
System.out.println("The square root of"
+ number
+ " is "
+ Math.sqrt(number));
}
}
now ive compiled them error free and yet when i goto run the class file in Dos i get this message:
Exception in thread "main" Java.lang.NoClassDefFoundError: Root/class
and thats it.....can ANYONE Help? ive even been on the tutorials from Sun and copy and pasted the hello world program and i have the same error come up
Last edited by gmoney; Aug 31st, 2003 at 07:42 AM.
-
Aug 30th, 2003, 10:39 PM
#2
Frenzied Member
this works for me
Code:
'save as BigDebt.java
class BigDebt
{
public static void main(String[] arguments)
{
int debt = 59000000;
debt = debt / 1440;
System.out.println("A Minutes Worth Of Debt Is: $" + debt);
}
}
Output was: A Minutes Worth Of Debt Is: $40972
this one also worked
Code:
'Save as Root.java
class Root
{
public static void main(String[] arguments)
{
int number = 255;
System.out.println("The square root of "
+ number
+ " is "
+ Math.sqrt(number));
}
}
Output was: The square root of 255 is 15.968719422671311
Being educated does not make you intelligent.
Need a weekend getaway??? Come Visit
-
Aug 30th, 2003, 11:11 PM
#3
Thread Starter
New Member
i copied ur pasted code and then recompiled them and am still having no luck, i am running out of ideas
-
Aug 31st, 2003, 12:22 AM
#4
Frenzied Member
just curious and this may sound stupid but, are you compiling and executing them correctly???
since java is case sensitive.
Code:
javac BigDebt.java 'compile it
java BigDebt 'execute it
javac Root.java 'compile it
java Root 'execute it
if you are doing the above correctly, what is the error message you are getting?
Being educated does not make you intelligent.
Need a weekend getaway??? Come Visit
-
Aug 31st, 2003, 07:41 AM
#5
Thread Starter
New Member
ok i have figured out the problem, i was adding the file extensions in when i went to run the class files. so i would type:
java Root.class
and not
java Root
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|