wood burning stoves 2.0*
The moose likes Java in General and the fly likes java installation Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Android Security Essentials Live Lessons this week in the Android forum!
JavaRanch » Java Forums » Java » Java in General
Bookmark "java installation" Watch "java installation" New topic
Author

java installation

Susmita Chakraborty
Greenhorn

Joined: Oct 18, 2003
Posts: 1
Hi, I installed j2sdk1.4.1_05 in my computer. I saved it under C:\j2sdk1.4.1_05. I am writing some programs that is under c:\myfiles\program\java. I am using text pad to write my programs. MY program is compiling but when I try to run it , it is showing
Exceptin in thread 'main' java.lang.NoClassDefFoundError
I set my environ variables like this
this is user
classpath: C:\j2sdk1.4.1_05\lib
path: C:\j2sdk1.4.1_05\bin
and this is for the system
classpath: C:\j2sdk1.4.1_05\lib
path:%SystemRoot%\system32;%SystemRoot%;%SystemRoot%\System32\Wbem;C:\j2sdk1.4.1_05\bin

I am not getting what is the problem. Could anyone help me
Ernest Friedman-Hill
author and iconoclast
Marshal

Joined: Jul 08, 2003
Posts: 24183
    
  34

Hi,
Welcome to JavaRanch!
If the error message is as you say, then you've installed Java correctly and everything is working. But the class you're trying to run must have a method named "main" with a specific signature:
public static void main(String[] args)
If it's different, your program won't run and you'll see this error message.


[Jess in Action][AskingGoodQuestions]
Vinod Venkatasubramanian
Greenhorn

Joined: Oct 19, 2003
Posts: 13
If in case you have already defined main(), then consider adding current directory (".") to the classpath. For eg: your classpath will look like,
CLASSPATH=.;C;\jdk.......
If you send out the code you wrote it will help.
[ October 22, 2003: Message edited by: Vinod Venkatasubramanian ]
Ernest Friedman-Hill
author and iconoclast
Marshal

Joined: Jul 08, 2003
Posts: 24183
    
  34

Indeed, I must've been sleepy, because I didn't notice his CLASSPATH.
Please, beginning Java programmers: don't set the CLASSPATH environment variable at all. Java knows how to find its own class files by default. The default class path -- i.e., with no value for this environment variable -- will work perfectly, certainly long enough for you learn the Java language. By the time you know enough Java to consider changing it, any error messages you get in the process will make sense to you.
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: java installation
 
Similar Threads
Applet notinited
Environment Variables for j2sdk1.4.0 & j2re1.4.0-rc
Problem setting enviromental variables
Problem in building the application
Head First BeerSelect problems