Sudhir Srinivasan wrote:which i don't think is the right way, as I'm doing manually - for every program - what should be done by the O.S globally, through setting the classpath, for all programs.
Rob Spoor wrote:However, it isn't the CLASSPATH variable you need to set but the PATH variable.
Rob Spoor wrote:This FAQ entry explains how to set the CLASSPATH variable globally. The same instructions work for the PATH variable, with one caveat - you should not remove the existing PATH contents, but add to them (using ; to separate paths).
Rob Spoor wrote:By adding the JDK folder to the start you will make sure that no other JDK (or JRE) will be preferred.
Brian Burress wrote:Some options which can help you avoid this include setting up a directory of batch files in your path that you can use to set up the path for the command window you have opened. The batch files will add the jdk to the path for your command window session only - when closed they go away. For example you could have batch files for "JDK6", "JDK7", "IBMJDK", etc depending on with what JDK you want to work.
Brian Burress wrote:Sudhir,
You are welcome. I'll elaborate here, let me know if something remains unclear.
Sudhir Srinivasan wrote:Can the code,lines 5 to 7 shown above, in the batch file be modified to
Brian Burress wrote:I would advise you avoid getting to fancy with the bat file unless you know bat well otherwise you are going to find yourself debugging windows scripting instead of working with the java which I think the latter is your intended focus right now.
Brian Burress wrote:Be careful with line 8 from your copied example as it appends the java bin directory to the PATH variable instead of pre-pending it. If you happen to have another java bin on the path variable already then the one you are adding will not be used.
Brian Burress wrote:You should be able to update the bat file to help orchestrate pretty much whatever is done from a command line.