简体   繁体   中英

Check JRE if installed on different OS's?

I am trying to deploy a JNLP for different users from my website. The user enters his username and I generate a JNLP with the specific jars for that user and give him a jnlp file with the proper configuration.

The problem if the user doesn't have a JRE installed on his Machine(Windows/Mac/Ubuntu) he will cannot run the jnlp.

My main 2 Questions are:

  1. How to know if the JRE is installed on certain machine (I don't care if a java plugin exist or not on the browser that the user is using) all what I need a JRE on the system to run the JNLP (on all OS's)?

  2. How to install (if I knew that there is NO jre on the machine) any JRE and preferred to be v.1.6.* from my website (or to redirect to java.com site then to get back to my page)?

To take in consideration I already took a look on the following:

I took a look on the deployJava.js and I have integrated it with my website. But it doesn't work fine on all browsers/OS's.

Were I used the versionCheck("1.5+") and isWebStartInstalled() to detect that the user has a jre installed on his machine but unfortunatly it failed to detect that on FF (upon ubunto OS) for Windows XP the FF, IE and Chrome it worked fine !!!

* So what I need from this is to know if the user have a JRE installed on his machine or not.
Reminder:I don't care if the browser have a java plugin or not!

on Windows XP if I called installJRE("1.6.0_29") in JS it will behaves like the following: Chrome it will redirect me to java and tell me to install 1.6.0_30 ! (Thats fine for me). FF and IE will not redirect me anywhere and nothing happens.(it seems that the script try to use the the installed plugin on the browser to update it,but at the same time the jre in uninstalled from the machine but some how the IE and FF still see that there is a java PLUGIN !)

if I used installLatestJRE() it will work on IE but it will redirect me to install JRE v.1.7.0_2 which still not stable as I think. and it have a problems with my application. (My application works fine on JREs of v.1.6.* but have problems on v.1.7.*) and this is not a problem because if the user have a JRE I already have in the jnlp the required jre I use:

    <java version="1.6.*" href="http://java.sun.com/products/autodl/j2se" />

and this will install for me the latest 1.6.* JRE if it doesn't exist. on chrome it works fine and redirects me to install v.1.6.0.30. on FF it will not work.
(FF version all over is 8)
I tried this on 3 diffrent machines and I have check the code many time but unfortunatly it didn't work in a stable way on those diffrent machines and browsers.

BTW No one of the browsers tested redirected me back to my website (even they have in the query string returnPage=www.mywebsite.com ) I already read that on java documents but they said it will work some times but not on all browsers!

Sorry for this long explanation for the case but I hope to get a new solution except the ones I have tried.

PS: I read on some question here where some body answered just give a link to your JNLP and a note below that we it is essential to have java intalled on you machine with a link to java sun. But I didn't like this solution I prefer to decide when to redirect the user to go to java or not because the users are newbiews.

The short version: You can't.

The longer version: You are looking for launching with Java WebStart and explicitly mention that you are not interested in the browser plugin. This mean that you cannot do the checking inside the browser, since the Java WebStart that the user want to use on the machine may be completely uncorrelated with anything inside the browser.

The only option available to you is to go the way the user would otherwise invoke a JNLP script. In other words provide a test JNLP file, and allow the user to launch it. Put instructions around the "CLICK HERE" link explaining why things may not work, and a link to http://java.com/en/download/installed.jsp to let Oracle help them.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM