JDK Installation problems!

ok i tried the set classpath setting too.....same error again.....i guess some prob with my installer i'll try to download a fresh copy.
btw dips dude wat u mentioned bout String args[] being String[] args its a flexibility that java allows you to place the brackets anywhere we want coz it offers some advantages under some circumstances like declaring arrays...thanks anyway..
 
Adding to what people have posted already, your .class file is in the same folder as where you are executing the command? Is the class defined under a package?
 
sorry bout the delay cud'nt access the net for a whole day....
and yes the class files and java files are in the same location.......
any bright ideas anyone....
 
dipdude said:
I am not a coder - but it should be String[] args instead of String args[] i am not sure about this.
This from sun's site
Code:
/**
 * The HelloWorldApp class implements an application that
 * simply displays "Hello World!" to the standard output.
 */
class HelloWorldApp {
    public static void main([COLOR="Red"]String[] args[/COLOR]) {
        //Display "Hello World!"
        System.out.println("Hello World!");
    }
}
both of them works dipdude
@praful you still havent tried out eclipse(bright idea:no: ) i suppose
 
anyone here using Debian? i managed to install the JRE by makepkg and then executing the .deb package but it is not working for jdk so how do i go about it since everytime i have to type the PATH before using javac.
 
Praful said:
hey techies...
i've got this really werid problem with the jdk installation. After i write a program in java and then compile it using "javac" then run using the "java <Classname>" command i get this error-
'Exception in thread "main" java.lang.NoClassDefFoundError: <Classname>'
now the that i've written in 100% error free, i ran it on another machine and got the required output, got it checked by XTerminator/XTO_bhai he also said the code is fine and got the required output. So you see there's no problem in the code like the classname and filename mismatch. Now if it was a path setting problem commands like "javac"/"edit" won't work.so its not even a path setting problem. I have also changed from jdk1.4 to 1.5 and back but still same problem. Please give me some gyan on how to get over this problem i really need to code in java on THIS machine....:huh:
So please help ASAP people...
thanks
praful

First of all install the latest Sun JDK for Windows, i.e jdk 1.5.06.
Here's a batch file I use to call to set the command environment whenever I
have to do some Java coding.
Code:
SET PATH=%SystemDrive%\Program Files\Java\jdk1.5.0_06\bin;%PATH%

Here's a sample Java source file:
Code:
public class HelloWorld
{
    public static void main(String[] args)
    {
        System.out.println("Hello, World!");
    }
}

Save the file as HelloWorld.java someplace.
Fire up a command prompt and change to the directory consisting of the Java source.
Set the PATH variable as displayed above. MAKE SURE CLASSPATH IS EITHER
NOT SET* OR SET ONLY TO A DOT. Like this:
Code:
CLASSPATH=.

Code:
javac HelloWorld.java
java -cp . HelloWorld

* - To unset/reset CLASSPATH variable, type SET CLASSPATH=. at the cmd prompt.

ADDED: Post a picture of your system variables, using the SET command.
 
Back
Top