File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
Win a copy of Clojure in Action this week in the Clojure forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

java installation

 
Susmita Chakraborty
Greenhorn
Posts: 1
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Pie
Posts: 24204
34
Chrome Eclipse IDE Mac OS X
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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.
 
Vinod Venkatasubramanian
Greenhorn
Posts: 13
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Pie
Posts: 24204
34
Chrome Eclipse IDE Mac OS X
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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.
 
It is sorta covered in the JavaRanch Style Guide.
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic