开发者_JS百科
We don’t allow questions seeking recommendations for books, tools, software libraries, and more. You can edit the question so it can be answered with facts and citations.
Closed 7 years ago.
Improve this questionI'm building an NSIS installer to install my application under Windows, and it will check if a user has a JDK (>= 1.5) and download and launch the installer for it if they do not.
While I have seen URLs for use in downloading JREs, I have not seen ones for the JDK. If I copy and paste the URL I finally get after clicking through several pages to get the Windows (32-bit) (with nothing else bundled) JDK, the URL changes every time.
My users are not technically savvy and may not be able to download the JDK themselves from the starting page, so making them do so is suboptimal.
Is there a URL I can consistently use to download the JDK?
Google reports 0 results on a query:
"jdk-6u23-windows-i586.exe" site:sun.com
So, I suppose there are no such web directory at the official site.
Solution 1: You can use this stable link to the particular JDK version and update it in future versions of your installer.
Solution 2: You need a JDK, but it is not fully redistributable. If you need only a compiler from JDK then you may try to join a redistributable JRE with a redistributable javac.exe and bundle it with your application (see JRE Version 5.0 README):
The J2SE(TM) Runtime Environment (JRE) is intended for software developers and vendors to redistribute with their applications.
...
Redistributable JDK(TM) Files
The limited set of files from the JDK listed below may be included in vendor redistributions of the J2SE Runtime Environment. All paths are relative to the top-level directory of the JDK.
...
The javac bytecode compiler, consisting of the following files:
bin/javac.exe [Microsoft Windows]
lib/tools.jar [All platforms]
Solution 3: Download all JRE (pure or joined with the compiler) versions a priori to your application's web directory. You should check twice a license agreement before.
Unfortunately I think the answer is no, at least not on the sun site directly. You could however bundle the JDK in with the application directly (it'll make for a huge footprint, but if the majority of your users won't have a JDK installed and aren't "technical" enough to install it this is an acceptable route to go down in my opinion.)
It's a bit off topic, but for easily deploying java applications, you might look at java webstart.
精彩评论