File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
The moose likes Beginning Java and the fly likes Run a java Program Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » Beginning Java
Bookmark "Run a java Program" Watch "Run a java Program" New topic

Run a java Program

Preety Narashimhan

Joined: Aug 19, 2002
Posts: 28
I am working on Win2000 Professional.I cud compile a simple java prg but was unable to run it.But the same worked on Win98!! What cud b the probable reasons??
I have set the path variable to point to the bin directory.Do i need to set the classpath?
Janet Wilson
Ranch Hand

Joined: Jul 16, 2002
Posts: 98
You might want to take a look at this message thread because it might give you some clues for diagnosing your problem:
j2sdk-1_4_0_01- windows-i586.exe = java version 1.3 and classpath question???
Mark Spritzler

Joined: Feb 05, 2001
Posts: 17276

Preety, I deleted your post in the SJCD Forum, since it was in the wrong forum. I deleted it rather than moving it becaus I saw that you had posted a duplicate post here in the Java In Genereal Forum.
Please do not post the same question in multiple forums. There is usually one forum that will fit your question specifically.
In Windows 2000 there are environment variables like path to BIN, and also the "." so that it runs in the same directory as your compiled code.
Windows 98 does not have environment variables like this. To say that you set path etc usually in your autoexec.bat, whereas in Windows 2000 there is a control panel for environment variables.

Perfect World Programming, LLC - iOS Apps
How to Ask Questions the Smart Way FAQ
Dirk Schreckmann

Joined: Dec 10, 2001
Posts: 7023
Originally posted by Peter Gragert in a different thread:
If you want to set your CLASSPATH 'forever'
depending on wich version of winows you use you
should set the 'environment'.
Window NT or 2000:
right click 'My computer' choose: properties
and a 'tab page' Environment should be visible
then look if there is already a CLASSPATH you may add more where a ";" (semicolon) is the seperator.
Otherwise create it. In other version there should be something else (Winodws 95 in the autoecec.bat e.g.)
[or] In a batch file e.g. (should work in a DOS window too) (one line command
set CLASSPATH=.;g:\java\javaranch\
for example .

Also, I recommend surrounding classpath specifications with double-quotation marks. This helps resolves issues some systems have with spaces.

[How To Ask Good Questions] [JavaRanch FAQ Wiki] [JavaRanch Radio]
I agree. Here's the link:
subject: Run a java Program
It's not a secret anymore!