這是歷史版本頁面 — 看 Java Development Kit (32-bit) 最新版本

舊電腦想寫Java程式,JDK 32位元版夠用嗎

Java Development Kit (32-bit) 軟體圖示 Java Development Kit (32-bit) 121 (32-bit) 資料更新 2017-01-18 閱讀約 7 分鐘

你手上有一台比較舊的 Windows 電腦,可能是七、八年前的機器,系統還停在 Windows 7 或 Windows 8。最近想開始學寫 Java,或是有個舊專案需要重新編譯,於是上網找開發工具,結果發現 Java 的開發套件有分 32 位元和 64 位元,下載頁面全是英文,一時間不知道該選哪一個。裝錯版本怕跑不動,不裝又沒辦法繼續下一步,就這樣卡在下載頁面半小時。

一般人的直覺是「直接抓最新版、最大的那個檔案就對了」,但舊電腦的作業系統和處理器不一定支援 64 位元,硬裝上去可能連安裝程式都打不開。就算安裝成功,也可能因為記憶體不足或系統不相容而頻頻出錯。這類開發工具套件的切入點,其實是讓你在「寫程式」和「執行程式」之間有一整套工具可以用——編譯、打包、除錯、產生說明文件,而不是只給你一個能跑 Java 的環境。搞清楚自己到底需要「開發」還是只要「執行」,才不會裝了一堆用不到的東西。

01JDK 32位元版到底能拿來做什麼?

它是一整套 Java 開發工具,包含編譯器 javac,可以把寫好的 .java 原始碼編譯成 .class 位元碼;jar 工具負責把多個 class 檔打包成一個 JAR 檔案;javadoc 可以從程式碼註解自動產生 API 說明文件;jdb 是除錯器,讓你可以逐步執行程式、檢查變數值。另外它也內建一個完整的 Java 執行環境(JRE),所以開發完的程式可以直接在本機跑。

02它跟 JRE 有什麼不同?我是不是裝 JRE 就夠了?

JRE 只有 Java 虛擬機(JVM)和執行時需要的類別庫,讓你可以「執行」已經編譯好的 Java 程式,但不能自己寫程式碼再編譯。JDK 除了包含完整的 JRE,還多了編譯器、除錯器、打包工具等開發用的程式。如果你只是要跑別人寫好的 Java 應用程式或遊戲,裝 JRE 就夠;如果你要自己寫程式、編譯、打包,才需要 JDK。

03用這套軟體寫 Java 程式,需要另外裝 IDE 嗎?

不需要,但建議裝。JDK 本身是命令列工具,你可以在記事本寫好程式碼,然後打開命令提示字元,用 javac 編譯、用 java 執行,全部靠打字完成。但這樣寫程式很沒效率,官方說明中也提到,開發者通常會搭配 Eclipse、IntelliJ IDEA 或 NetBeans 這類整合開發環境使用,IDE 提供程式碼編輯器、專案管理、一鍵編譯和除錯介面,會比純命令列順手很多。

04安裝完之後怎麼確認有沒有裝好?

安裝完成後,打開命令提示字元(在 Windows 搜尋列輸入 cmd),輸入 java -version 再按 Enter。如果安裝正確,畫面上會顯示 JDK 的版本資訊;如果出現「無法辨識」或「不是內部或外部指令」的訊息,代表安裝路徑沒有正確設定,或是安裝過程有問題。官方安裝說明也特別提到用這個指令來驗證,這是第一個該做的檢查。

05它能不能編譯其他語言寫的程式?

不行。這套軟體是專門給 Java 用的,編譯器 javac 只接受 Java 原始碼,jar 打包的也是 Java 的類別檔。官方功能說明中提到的工具,包含 javac、jar、javadoc、jdb、jshell,全部都是圍繞 Java 生態系設計的。如果你要寫 C、Python 或 JavaScript,需要另外找對應的編譯器或直譯器,這套軟體幫不上忙。

06我的電腦是 32 位元的 Windows,裝這套軟體跑得動嗎?

這套軟體就是設計給 32 位元系統用的,支援 Windows 7、Windows 8 和 Windows 10,所以只要你的系統是這幾個版本之一,理論上可以安裝。不過官方資料沒有提到最低硬體需求,如果你的電腦記憶體低於 2GB,編譯大型專案時可能會比較慢。建議先安裝,用 java -version 確認能跑,再實際編譯一個小程式測試看看。

07初學者用這套軟體學 Java 會不會太難?

官方說明提到 JDK 適合從初學者到專業開發者各種程度的人使用,因為它提供完整的文件、教學和範例程式碼。但它的操作介面是命令列,沒有圖形化按鈕,對完全沒碰過程式的人來說,第一步會比較辛苦。如果你是完全新手,建議搭配一個 IDE(例如 NetBeans)一起用,IDE 會幫你處理很多指令細節,你只要專注在寫程式邏輯就好。

08只是要執行 Java 遊戲或軟體,需要裝這個嗎?

不需要。JDK 是開發工具,裡面雖然包含執行環境,但體積比較大,安裝也比較複雜。如果你只是要跑別人寫好的 Java 程式,安裝 Java Runtime Environment(JRE)就夠了,它只有虛擬機和執行所需的類別庫,輕量很多。官方資料中 JRE 的使用者評分人數有 3861 人,比 JDK 的 1110 人多,也反映多數人其實只需要執行環境。

09我的電腦是 64 位元,裝 32 位元版會有問題嗎?

官方資料沒有提到 64 位元系統安裝 32 位元版會發生什麼事,這部分需要你自己確認。一般來說,64 位元 Windows 可以執行 32 位元應用程式,但效能上可能不如原生 64 位元版本。如果你的系統是 64 位元,建議先到 Oracle 官方下載頁面看看有沒有提供 64 位元版本,有的話優先選那個,記憶體使用效率會比較好。

10公司要拿來開發商用 Java 專案,用這套軟體授權上要注意什麼?

官方說明明確寫著 JDK 可以免費下載和使用,但「商業使用」必須遵守 Oracle 的授權條款。官方文件也提到,商業使用的授權條款可能比較複雜,甚至可能需要付費。如果你的公司要用在商業產品上,建議直接到 Oracle 官方網站查閱最新的 Oracle Technology Network License Agreement,或諮詢法務人員,不要假設免費下載就等於可以任意商用。

11介面只有英文,看不懂操作選項怎麼辦?

這套軟體的介面語系確實只有英文,官方文件、安裝程式和工具輸出都是英文。不過它的核心工具都是命令列指令,常用的只有 javac、java、jar 這幾個,指令參數不多,上網搜尋都有中文教學。安裝過程也只有幾個下一步按鈕,不太會卡住。如果你連安裝程式的英文都覺得吃力,可以找網路上中文的 JDK 安裝教學,照著步驟點就可以了。

12這套軟體跟 OpenJDK 比起來哪個比較好?

官方資料中沒有提到 OpenJDK,所以無法直接比較。JDK 是 Oracle 發行的版本,OpenJDK 是開源社群維護的版本,兩者功能上很接近,但授權條款不同。如果你在意的是商業使用授權,OpenJDK 的授權通常比較寬鬆;如果你想要 Oracle 官方支援和文件,就選 JDK。建議根據你的用途(個人學習還是商業開發)和授權需求,分別到官方網站查閱條款後再決定。

下載與官方連結

前往官方網站 下載 Java Development Kit (32-bit)

jdk-8u121-windows-i586.exe · 189.36 MB · 連結指向軟體原廠

版本紀錄

再看 5 筆

看完整版本清單

這一版改了什麼

What's new in this version:

- Improved protection for JNDI remote class loading

Remote class loading via JNDI object factories stored in naming and directory services is disabled by default. To enable remote class loading by the RMI Registry or COS Naming service provider, set the following system property to the string "true", as appropriate:
- com.sun.jndi.rmi.object.trustURLCodebase
- com.sun.jndi.cosnaming.object.trustURLCodebase

jarsigner -verbose -verify should print the algorithms used to sign the jar:
- The jarsigner tool has been enhanced to show details of the algorithms and keys used to generate a signed JAR file and will also provide an indication if any of them are considered weak.
- Specifically, when "jarsigner -verify -verbose filename.jar" is called, a separate section is printed out showing information of the signature and timestamp (if it exists) inside the signed JAR file, even if it is treated as unsigned for various reasons. If any algorithm or key used is considered weak, as specified in the Security property, jdk.jar.disabledAlgorithms, it will be labeled with "(weak)".

NEW FEATURES:
RMI Better constraint checking:
- RMI Registry and Distributed Garbage Collection use the mechanisms of JEP 290 Serialization Filtering to improve service robustness
- RMI Registry and DGC implement built-in white-list filters for the typical classes expected to be used with each service
- Additional filter patterns can be configured using either a system property or a security property. The "sun.rmi.registry.registryFilter" and "sun.rmi.transport.dgcFilter" property pattern syntax is described in JEP 290 and in <JRE>/lib/security/java.security
- JDK-8156802 (not public)

Add mechanism to allow non-default root CAs to not be subject to algorithm restrictions:
- New certpath constraint: jdkCA*
- In the java.security file, an additional constraint named "jdkCA" is added to the jdk.certpath.disabledAlgorithms property. This constraint prohibits the specified algorithm only if the algorithm is used in a certificate chain that terminates at a marked trust anchor in the lib/security/cacerts keystore. If the jdkCA constraint is not set, then all chains using the specified algorithm are restricted. jdkCA may only be used once in a DisabledAlgorithm expression.
- Example: To apply this constraint to SHA-1 certificates, include the following: SHA1 jdkC

Changes:
- The secure validation mode of the XML Signature implementation has been enhanced to restrict RSA and DSA keys less than 1024 bits by default as they are no longer secure enough for digital signatures. Additionally, a new security property named jdk.xml.dsig.SecureValidationPolicy has been added to the java.security file and can be used to control the different restrictions enforced when the secure validation mode is enabled.
- The secure validation mode is enabled either by setting the xml signature property org.jcp.xml.dsig.secureValidation to true with the javax.xml.crypto.XMLCryptoContext.setProperty method, or by running the code with a SecurityManager.
- If an XML Signature is generated or validated with a weak RSA or DSA key, an XMLSignatureException will be thrown with the message, "RSA keys less than 1024 bits are forbidden when secure validation is enabled" or "DSA keys less than 1024 bits are forbidden when secure validation is enabled."
- Restrict certificates with DSA keys less than 1024 bits:
- DSA keys less than 1024 bits are not strong enough and should be restricted in certification path building and validation. Accordingly, DSA keys less than 1024 bits have been deactivated by default by adding "DSA keySize < 1024" to the "jdk.certpath.disabledAlgorithms" security property. Applications can update this restriction in the security property ("jdk.certpath.disabledAlgorithms") and permit smaller key sizes if really needed (for example, "DSA keySize < 768").

More checks added to DER encoding parsing code:
- More checks are added to the DER encoding parsing code to catch various encoding errors. In addition, signatures which contain constructed indefinite length encoding will now lead to IOException during parsing. Note that signatures generated using JDK default providers are not affected by this change.

Additional access restrictions for URLClassLoader.newInstance:
- Class loaders created by the java.net.URLClassLoader.newInstance methods can be used to load classes from a list of given URLs. If the calling code does not have access to one or more of the URLs and the URL artifacts that can be accessed do not contain the required class, then a ClassNotFoundException, or similar, will be thrown. Previously, a SecurityException would have been thrown when access to a URL was denied. If required to revert to the old behavior, this change can be disabled by setting the jdk.net.URLClassPath.disableRestrictedPermissions system property.

A new configurable property in logging.properties java.util.logging.FileHandler.maxLocks:
- A new "java.util.logging.FileHandler.maxLocks" configurable property is added to java.util.logging.FileHandler.
- This new logging property can be defined in the logging configuration file and makes it possible to configure the maximum number of concurrent log file locks a FileHandler can handle. The default value is 100.
- In a highly concurrent environment where multiple (more than 101) standalone client applications are using the JDK Logging API with FileHandler simultaneously, it may happen that the default limit of 100 is reached, resulting in a failure to acquire FileHandler file locks and causing an IO Exception to be thrown. In such a case, the new logging property can be used to increase the maximum number of locks before deploying the application.
- If not overridden, the default value of maxLocks (100) remains unchanged. See java.util.logging.LogManager and java.util.logging.FileHandler API documentation for more details.

Bug fixes:
Trackpad scrolling of text on OS X 10.12 Sierra is very fast:
- The MouseWheelEvent.getWheelRotation() method returned rounded native NSEvent deltaX/Y events on Mac OS X. The latest macOS Sierra 10.12 produces very small NSEvent deltaX/Y values so rounding and summing them leads to the huge value returned from the MouseWheelEvent.getWheelRotation(). The JDK-8166591 fix accumulates NSEvent deltaX/Y and the MouseWheelEvent.getWheelRotation() method returns non-zero values only when the accumulated value exceeds a threshold and zero value. This is compliant with the MouseWheelEvent.getWheelRotation() specification
- "Returns the number of "clicks" the mouse wheel was rotated, as an integer. A partial rotation may occur if the mouse supports a high-resolution wheel. In this case, the method returns zero until a full "click" has been accumulated."
- For the precise wheel rotation values, use the MouseWheelEvent.getPreciseWheelRotation() method instead
- This release also contains fixes for security vulnerabilities described in the Oracle Java SE Critical Patch Update Advisory