Java Queries Here..

Faun

Wahahaha~!
Staff member
^^Because what you have done can't be undone now without getting the original path string.
Do this and check if it works:

set PATH = %PATH%;%SystemRoot%\system32;%SystemRoot%
 

prateek007391

In the zone
Also I would like to know, is there any difference when I create JAVA files in NETBEANS or simple notepad. What is better for me.

^^Because what you have done can't be undone now without getting the original path string.
Do this and check if it works:

Should I add the java environment variable path here too, this thing is functioning fine

Now the path environment variable has been sorted out quiet well, now please tell me how to remove this error

Exception in thread "main" java.lang.NoClassDefFoundError:
 
Last edited:

Liverpool_fan

Sami Hyypiä, LFC legend
Use a text editor and not an IDE if you are beginning. I can gather you are using Windows, I suggest Notepad++, stay away from the crappy notepad bundled in Windows.
 

prateek007391

In the zone
Code:
set PATH = %PATH%;"C:\Program Files\Java\jdk1.6.0_20\bin"[B];.[/B]

I think, I am wrong from Starting,
It would be very kind If You can assist me from setting all this up from Starting
The book I am reading just dont provide any good about it, what ever it says is just not working.
 

Liverpool_fan

Sami Hyypiä, LFC legend
Right click, My Computer, then
*img4.imageshack.us/img4/8531/path3.png
*img12.imageshack.us/img12/1399/path4.png
*img11.imageshack.us/img11/6822/path5.png
*img18.imageshack.us/img18/1511/path6.png
in the Variable Value entry, add entries for your Java directory, C:\Program Files\Java\jdk1.6.0_20\bin, the delimiter is ;. Do not delete the previous entry, just add the new try.

And oh while executing, use java program not java program.class
 

prateek007391

In the zone
Right click, My Computer, then
*img4.imageshack.us/img4/8531/path3.png
*img12.imageshack.us/img12/1399/path4.png
*img11.imageshack.us/img11/6822/path5.png
*img18.imageshack.us/img18/1511/path6.png
in the Variable Value entry, add entries for your Java directory, C:\Program Files\Java\jdk1.6.0_20\bin, the delimiter is ;. Do not delete the previous entry, just add the new try.

And oh while executing, use java program not java program.class

Electricity out here, but I will try this one soon.
also as I have messed around too much in environment variable, can I know what are its default values. I am running win xp sp3.




*************
Posted via HTC

Right click, My Computer, then
*img4.imageshack.us/img4/8531/path3.png
*img12.imageshack.us/img12/1399/path4.png
*img11.imageshack.us/img11/6822/path5.png
*img18.imageshack.us/img18/1511/path6.png
in the Variable Value entry, add entries for your Java directory, C:\Program Files\Java\jdk1.6.0_20\bin, the delimiter is ;. Do not delete the previous entry, just add the new try.

And oh while executing, use java program not java program.class

Electricity out here, but I will try this one soon.
also as I have messed around too much in environment variable, can I know what are its default values. I am running win xp sp3.




*************
Posted via HTC
 
Last edited:

prateek007391

In the zone
Right click, My Computer, then
*img4.imageshack.us/img4/8531/path3.png
*img12.imageshack.us/img12/1399/path4.png
*img11.imageshack.us/img11/6822/path5.png
*img18.imageshack.us/img18/1511/path6.png
in the Variable Value entry, add entries for your Java directory, C:\Program Files\Java\jdk1.6.0_20\bin, the delimiter is ;. Do not delete the previous entry, just add the new try.

And oh while executing, use java program not java program.class

This is the error I am getting.

I have also Attached the way I am writting in Environment Variable Path.
 

Liverpool_fan

Sami Hyypiä, LFC legend
Er you don't write %PATH% , in that dialog box :/
Try to search and get the default path used in Windows and append your java directory.
Paste this: %systemroot%\system32;%systemroot%;%systemroot%\system32\wbem;%PROGRAMFILES%\Java\jdk1.6.0_20\bin

Also Post the source code of the program to know the context of the error.
 

prateek007391

In the zone
Er you don't write %PATH% , in that dialog box :/
Try to search and get the default path used in Windows and append your java directory.
Paste this: %systemroot%\system32;%systemroot%;%systemroot%\system32\wbem;%PROGRAMFILES%\Java\jdk1.6.0_20\bin

Also Post the source code of the program to know the context of the error.

Code:
class HelloWorldApp{
	public static void main(String[] arg) {
		System.out.println("Hello World");
	}
}

still not working. Here Is what I am trying to run.
 
OP
furious_gamer

furious_gamer

Excessive happiness
is it necessary for one to have a thorough knowledge in C and C++ before jumping onto java?

Nope. If you know OOPS concept, it is easy to start with Java. But one must know procedural language before they start any language. So C is a basic, but it is not mandatory to start with.
 

prateek007391

In the zone
I have been working for a few Weeks with Python, Python is a good Language for Non Programmer to get through with concepts. But I was keenly intrested in Java, so I skipped Python after Basics and Started reading JAVA, but I am unable to run the most basic program, though I tired running the program in Netbeans IDE and there most of programs works so easily.


I tried renaming my file, but its still not working giving out the same error.
 
Last edited:
OP
furious_gamer

furious_gamer

Excessive happiness
I have been working for a few Weeks with Python, Python is a good Language for Non Programmer to get through with concepts. But I was keenly intrested in Java, so I skipped Python after Basics and Started reading JAVA, but I am unable to run the most basic program, though I tired running the program in Netbeans IDE and there most of programs works so easily.

You still not able to execute a java program? With Netbeans you can?
 
OP
furious_gamer

furious_gamer

Excessive happiness
Yes Just write the program codes in NETBEANS IDE and Press Run Button, and It gives me the right output.

As it always. But for a beginner, using IDE is not a good practice. Then you might possibly loose the chance to know, how to setup classpath etc. So just d/l the latest jdk , install it, use Edit Plus or Notepad++ to write code, run it in command prompt.

And after u get a grip in Java, go for Eclipse IDE.
 

prateek007391

In the zone
As it always. But for a beginner, using IDE is not a good practice. Then you might possibly loose the chance to know, how to setup classpath etc. So just d/l the latest jdk , install it, use Edit Plus or Notepad++ to write code, run it in command prompt.

And after u get a grip in Java, go for Eclipse IDE.

Okay, as Instructed,

I am removing NetBeans IDE

Also I upgraded my Java SDK from 20 to 23

But the problem is still there, after searching the web I found this link which shows exactly what the problem is, however on following the steps, The problem is still not resolved.

Exception in thread "main" java.lang.NoClassDefFoundError

Finally


I Got It


As said in above given Link

I tried java -classpath . HelloWorld

and the program worked.

Thanks everyone for support.
 
Last edited:
Top Bottom