Is it possible to have a web page aut开发者_如何学编程omatically install the JRE?
The reason for the concern is that I want to use Java for multimedia content on a web page, and not have to have the user manually download and install the JRE if they don't have it already. .
Is it possible to have a web page automatically install the JRE?
I don't think so, that would be a serious security issue if a web page can automatically install binaries upon visit.
That said, most browsers already suggest to users to follow a link to get the required plugin to view the content in question.
This could be done with javaWS (Ref: Java Web Services) where you use the JNLP architecture. Basically, you specify (as XML) what is the version of JRE you need to run your application program, what resources (jar files) the client needs to date-check and download if a newer version is available, which class contains the main() to start execution, etc. The web browser checks if the required version of Java is installed, and if not, downloads it and the execution goes on.
If I remember correctly, Sun used to distribute the Javascript for this auto-downloading to happen free of cost (script was called "deployjava.js", let me know if you want an edited version), and you could edit it for some customization (e.g., use a graphics file to use as the button to activate the download/version checking).
This worked for us through Windows XP and Vista, but Windows 7 broke it. Could be internal security issues - at the time (JDK-1.6.13-20 or so) Java wanted to start it own process but IE wouldn't allow it - and you had to go through a bunch of hoops to disable something at the JavaWS console so that a new process is not started, etc., not very practical if you have clients using your software. After a while, it became such a pain that we dumped the architecture altogether.
To answer the question, yes, it is possible but implementations could be flakey and browser/system dependent. If you want to go that route, evaluate the JNLP/JavaWS systems and good luck to you.Regards, - M.S.
精彩评论