This week's book giveaway is in the Big Data forum.
We're giving away four copies of Elasticsearch in Action and have Radu Gheorghe & Matthew Lee Hinman on-line!
See this thread for details.
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 Elasticsearch in Action this week in the Big Data forum!
JavaRanch » Java Forums » Java » Java in General
Bookmark "java installation" Watch "java installation" New topic

java installation

Susmita Chakraborty

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

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

Joined: Jul 08, 2003
Posts: 24189

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

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,
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

Joined: Jul 08, 2003
Posts: 24189

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.
subject: java installation