garzajd
asked on
Is there a way to auto detect java version and upgrade if under version 1.4.x?? Reason is....
Ok I'm sure this has been an issue in the past but I havent found anything on it.
I have a simple java file that I want to run on my pc. I have created the simple installer
and everything. One problem the java file requires Java version 1.4 or greater to be installed in order to run. So is there some way or command that I can check a) that java is installed on the pc and b)check to see if below version 1.4 (and if so install/update).
Sounds simple enough but I'm alittle lost.
I have a simple java file that I want to run on my pc. I have created the simple installer
and everything. One problem the java file requires Java version 1.4 or greater to be installed in order to run. So is there some way or command that I can check a) that java is installed on the pc and b)check to see if below version 1.4 (and if so install/update).
Sounds simple enough but I'm alittle lost.
Running "java -version" will print out the version. You can use this text in any script you write. Upgrading or installing a new JRE or JDK on behalf of the user may be a problem, considering they have to agree to the EULA, and that Sun requires EULA agreement on their site before downloading begins. Therefore, you could always just detect the version, and then open up http://java.sun.com/j2se/1.4.2/download.html (or some deeper link) in their default browser if the version is too low for your liking.
ASKER
I know that "java -version" prints out the version,build, and everything else.
However for example I'm trying to make this into a batch file (for now)
that will read the "java -version" output and strip everything but the
1.x.x.. however I have not been able to get the output of "java -version" into
a variable or a file. I've even gone as basic to do
java -version >test.txt
but this does not work test.txt is left empty
All I really need help with is determining what version ,if any, is currently installed
on the compter - and then I can compare that to what I am looking for and
have the batch file either do routine A or B
did I make any sence?
However for example I'm trying to make this into a batch file (for now)
that will read the "java -version" output and strip everything but the
1.x.x.. however I have not been able to get the output of "java -version" into
a variable or a file. I've even gone as basic to do
java -version >test.txt
but this does not work test.txt is left empty
All I really need help with is determining what version ,if any, is currently installed
on the compter - and then I can compare that to what I am looking for and
have the batch file either do routine A or B
did I make any sence?
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER
Think of when you are installing a new game.
After the install or during it will check for a vesrion of DirectX
If the local installed version is below 8 or isnt installed at all
it will prompt you and ask if you want to update.
Thats what I'm going for