Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations gkittelson on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

need help in resolving an error in runing my program 2

Status
Not open for further replies.

cal555

Programmer
May 5, 2006
71
US
Hi, I am a contractor an dth earea that I am in i sgoing Java, so I am trying to learn Java. I got a book and am trying to run a basic first program. But when I run the program I get this message:
Exception in thread "main" java.lang.NoClassDefFoundError: Saluton/Java
and the prrogram in the book that is being used is:
class Saluton {
public static void main (String[] arguments){
String greeting = "Salutation mondo!";
System.out.println(greeting);
}
}
I am using the jdk1.5.0_08 for the development program
If anyone has any ideas as to what I ma doing wrong I would really appreciate it.
Thank You

 
My development environment produces almost the same stub for the main routine.
Code:
public class NameOfMyClass 
{
    
    public static void main(String[] args) 
    {
        // do stuff here      
        
    }
}

Yes, you need to compile it:
Code:
javac Saluton.java

and run it with the correct parameters:
Code:
java Saluton

I repeated this to show the correct order of operations.
 
Hi, Thanks
I did not know that you had compile it one way and run it another, so this was a big help, bUt now I get the following when I compile it:
error: cannot read: Saluton.java
What does this mean. I worte the code as it is in the book.

 
Here you have a complete explanation :
It's strange a Java book does not mention you need to compile a program or how to do it. I'd have a look at the first chapter to check it's not here and if it isn't, I'd throw away that book and swith to an online tutorial.

Cheers,
Dian
 
No they do mention compiling it but they were not clear as you were about it, and I thought that the way I was doing it compiled and ran it at the same time. Anyway thanks ereyin for all you r help and the foum information this really helped.
Thank You
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top