This week's giveaway is in the Android forum.
We're giving away four copies of Android Security Essentials Live Lessons and have Godfrey Nolan on-line!
See this thread for details.
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


Win a copy of Android Security Essentials Live Lessons this week in the Android forum!
JavaRanch » Java Forums » Java » Beginning Java
Bookmark "Run a java Program" Watch "Run a java Program" New topic
Author

Run a java Program

Preety Narashimhan
Greenhorn

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
Preety,
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???
Janet
Mark Spritzler
ranger
Sheriff

Joined: Feb 05, 2001
Posts: 17249
    
    6

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.
Thanks
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.
Mark


Perfect World Programming, LLC - Two Laptop Bag - Tube Organizer
How to Ask Questions the Smart Way FAQ
Dirk Schreckmann
Sheriff

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\JavaranchCommon.zip
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]
 
jQuery in Action, 2nd edition
 
subject: Run a java Program
 
Similar Threads
compile time constants
Provide help
forward and backward tracability
Running a java Program
Making exe s