這是歷史版本頁面 — 看 Java Development Kit (64-bit) 最新版本
寫Java程式一直編譯失敗,JDK到底該不該裝
你剛開始學Java,興沖沖地裝了Eclipse或IntelliJ IDEA,照著教學影片打了第一支Hello World,按下執行卻跳出「javac不是內部或外部命令」,或者直接顯示找不到Java執行環境。你上網查,有人說要裝JDK,有人說裝JRE就夠,還有人叫你改環境變數——但你連這些名詞在講什麼都還搞不清楚,只想知道為什麼寫個程式這麼麻煩。
多數人習慣直接裝一套IDE就開始寫,但IDE本身只是編輯器,真正負責把原始碼編譯成可執行檔、提供除錯工具和執行環境的,是底層那套開發工具包。沒有它,你寫的程式碼就只是一堆文字檔。這類工具的核心工作,就是補齊從「寫完程式」到「跑得起來」之間那段看不見的基礎建設——編譯、執行、除錯、看文件,全部靠它。
01JDK和JRE到底差在哪裡,我該裝哪一個?
JDK是完整的開發環境,包含編譯器、除錯工具、函式庫和JRE;JRE只是JDK的子集,只提供執行Java程式的必要元件。如果你要寫程式、編譯原始碼,必須裝JDK;如果只是要執行別人寫好的Java程式,裝JRE就夠了。以你的情況——會寫到javac指令——需要的是JDK。
02這套軟體裝完之後,具體能幫我做到哪些事?
它提供Java編譯器,把.java原始碼轉成可在JVM上執行的位元組碼;內含JRE讓你能在本機執行Java應用程式;附帶大量函式庫和API,涵蓋資料庫存取、網路通訊、GUI開發等;還有jdb、jstack等除錯工具,以及JConsole、VisualVM等效能分析工具。另外包含完整的Java API文件,查類別和方法用法時不必另外上網。
03它跟Eclipse、IntelliJ IDEA這些IDE是什麼關係?
它本身不包含IDE,但設計上就是為了跟這些工具搭配。Eclipse、IntelliJ IDEA、NetBeans等IDE在背後呼叫JDK的編譯器和工具來完成建置與執行。你裝好JDK後,在IDE裡指定JDK路徑,IDE就能用它來編譯和執行你的程式。兩者是互補關係,不是二選一。
0464位元版本跟32位元有什麼差別,我該怎麼選?
資料中沒有針對64位元與32位元差異的詳細說明。一般來說,64位元版本能使用更大的記憶體空間,如果你的作業系統是64位元,且需要處理大型專案或大量資料,通常會選擇64位元版本。但具體支援情況和安裝需求,建議到Oracle官方網站確認你的系統相容性。
05它的除錯工具實際上是怎麼用的?
它提供jdb(Java除錯器)和jstack(執行緒堆疊分析工具)。jdb讓你在命令列中設定中斷點、逐步執行、檢視變數值,適合不習慣用IDE內建除錯器的人;jstack則用來查看JVM執行緒狀態,可以找出死結或執行緒卡住的原因。另外JConsole和VisualVM提供圖形化介面,可以監看記憶體使用量、CPU負載和執行緒狀態。
06完全沒寫過程式的新手,適合直接碰這套軟體嗎?
可以裝,但要有心理準備。資料中明確提到,設定環境變數對初學者來說有挑戰性,安裝過程也需要手動設定。如果你只是跟著教學走,照步驟設定JAVA_HOME和PATH,通常能順利完成。但如果你對命令列操作不熟悉,第一次設定環境變數可能會卡一段時間。建議先找一篇完整的安裝教學照著做。
07商業用途可以免費使用嗎?
可以免費下載和使用,但商業使用時必須遵守Oracle的授權條款。資料中強調,JDK 20之後的版本在Oracle No-Fee條款下,可以在生產環境免費使用和重新散布,但授權條款細節需要自行審閱。如果你的公司要拿它來開發商業軟體,建議讓法務或主管確認授權內容,不要直接當作完全免費。
08我只是想跑別人寫好的Java程式,不寫程式,需要裝這個嗎?
不需要。如果你不寫程式、不編譯原始碼,只需要執行Java應用程式,裝JRE就夠了。JDK包含了JRE,但體積更大、安裝更複雜。資料中明確指出JRE是JDK的子集,只提供執行所需的元件。先確認你的需求是「執行」還是「開發」,再決定要裝哪一個。
09我已經在用OpenJDK了,還需要換成這套嗎?
不一定。資料的FAQ中提到,OpenJDK、Amazon Corretto、IBM SDK for Java都是功能相近的替代方案。如果你目前的OpenJDK能正常編譯和執行你的專案,沒有必要更換。Oracle JDK和OpenJDK在核心功能上高度重疊,選擇哪一套通常取決於你對授權條款、更新頻率和技術支援的需求。
10這套軟體只有英文介面,看不懂英文的人該怎麼辦?
它的介面確實是英文,但實際使用上,你主要接觸的是命令列工具和IDE整合,不是圖形介面操作。javac、java這些指令的錯誤訊息是英文,API文件也是英文。如果你英文閱讀有困難,可以搭配中文教學網站或書籍學習,但長期寫Java程式,英文文件閱讀能力幾乎是必需的,這點要先有心理準備。
11我的電腦硬碟空間不多,裝這個會不會很佔空間?
資料中有提到,它的安裝套件相對較大,需要可觀的磁碟空間。具體需要多少空間,資料中沒有提供數字,建議到官方下載頁面查看安裝需求。如果你的硬碟空間有限,可以考慮只裝JRE(如果不需要開發),或選擇體積較小的OpenJDK發行版。安裝前先確認剩餘空間,避免裝到一半失敗。
12我朋友說用Android Studio寫Java也行,那我還需要另外裝這個嗎?
ndroid Studio本身是開發Android應用程式的IDE,它會綁定或要求安裝特定的JDK版本。資料中將Android Studio列為功能相近的軟體,但它的定位是Android開發,不是一般Java應用程式開發。如果你要寫的是桌面或伺服器端的Java程式,Android Studio並不適合;如果你要開發Android App,那Android Studio會處理JDK的配置,通常不需要手動另外安裝。
下載與官方連結
前往官方網站 下載 Java Development Kit (64-bit)
jdk-8u121-windows-x64.exe · 195.51 MB · 連結指向軟體原廠
版本紀錄
- 2026-10-24 Java JDK 27.0.1 (64-bit) 187.56 MB
- 2026-09-15 Java JDK 27 (64-bit) 187.54 MB
- 2026-08-20 Java JDK 26.0.2.1 (64-bit) 188.75 MB
再看 5 筆
- 2026-07-22 Java JDK 26.0.2 (64-bit) 188.73 MB
- 2026-04-22 Java JDK 26.0.1 (64-bit) 188.65 MB
- 2026-03-18 Java JDK 26 (64-bit) 188.68 MB
- 2025-09-18 Java JDK 25 (64-bit) 182.25 MB
- 2025-07-16 Java JDK 24.0.2 (64-bit) 205.86 MB
這一版改了什麼
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