Changeset 18580 in josm
- Timestamp:
- 2022-10-24T19:55:28+02:00 (2 years ago)
- Location:
- trunk/src/org/openstreetmap/josm/tools
- Files:
-
- 5 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/org/openstreetmap/josm/tools/PlatformHook.java
r18116 r18580 301 301 if (latestVersion == null || !latestVersion.equalsIgnoreCase(currentVersion)) { 302 302 callback.askUpdateJava(latestVersion != null ? latestVersion : "latest", 303 Config.getPref().get("java.update.url", "https://www.java.com/download"),303 Config.getPref().get("java.update.url", getJavaUrl()), 304 304 DateUtils.getDateFormat(DateFormat.MEDIUM).format(expiration), false); 305 305 } 306 306 } 307 } 308 309 /** 310 * Checks if we will soon not be supporting the running version of Java 311 * @param callback Java expiration callback 312 * @since 18580 313 */ 314 default void warnSoonToBeUnsupportedJava(JavaExpirationCallback callback) { 315 // Java 11 is our next minimum version, and OpenWebStart should be replacing Oracle WebStart 316 // We'd go to 17, but some Linux distributions (Debian) default to Java 11. 317 // And OpenWebStart currently doesn't have Java 17 JREs. 318 if (Utils.getJavaVersion() < 11 && !Utils.isRunningWebStart()) { 319 String latestVersion = Utils.getJavaLatestVersion(); 320 String currentVersion = Utils.getSystemProperty("java.version"); 321 // #17831 WebStart may be launched with an expired JRE but then launching JOSM with up-to-date JRE 322 if (latestVersion == null || !latestVersion.equalsIgnoreCase(currentVersion)) { 323 callback.askUpdateJava(latestVersion != null ? latestVersion : "latest", 324 Config.getPref().get("java.update.url", getJavaUrl()), 325 null, Utils.getJavaVersion() < 17); 326 } 327 } 328 } 329 330 /** 331 * Get the Java download URL (really shouldn't be used outside of JOSM startup checks) 332 * @return The download URL to use. 333 * @since 18580 334 */ 335 default String getJavaUrl() { 336 StringBuilder defaultDownloadUrl = new StringBuilder("https://www.azul.com/downloads/?version=java-17-lts&package=jre-fx"); 337 if (PlatformManager.isPlatformWindows()) { 338 defaultDownloadUrl.append("&os=windows"); 339 } else if (PlatformManager.isPlatformOsx()) { 340 defaultDownloadUrl.append("&os=macos"); 341 } // else probably `linux`, but they should be using a package manager. 342 // For available architectures, see 343 // https://github.com/openjdk/jdk/blob/master/src/jdk.hotspot.agent/share/classes/sun/jvm/hotspot/utilities/PlatformInfo.java#L53 344 String osArch = System.getProperty("os.arch"); 345 if (osArch != null) { 346 // See https://learn.microsoft.com/en-us/windows/win32/winprog64/wow64-implementation-details#environment-variables 347 // for PROCESSOR_ARCHITEW6432 348 if ("x86_64".equals(osArch) || "amd64".equals(osArch) 349 || "AMD64".equalsIgnoreCase(System.getenv("PROCESSOR_ARCHITEW6432"))) { 350 defaultDownloadUrl.append("&architecture=x86-64-bit"); 351 } else if ("aarch64".equals(osArch)) { 352 defaultDownloadUrl.append("&architecture=arm-64-bit"); 353 } else if ("x86".equals(osArch)) { 354 // Honestly, just about everyone should be on x86_64 at this point. But just in case someone 355 // is running JOSM on a 10-year-old computer. They'd probably be better off running a RPi. 356 defaultDownloadUrl.append("&architecture=x86-32-bit"); 357 } // else user will have to figure it out themselves. 358 } 359 defaultDownloadUrl.append("#download-openjdk"); // Scrolls to download section 360 return defaultDownloadUrl.toString(); 307 361 } 308 362 -
trunk/src/org/openstreetmap/josm/tools/PlatformHookOsx.java
r18141 r18580 95 95 Logging.warn("Failed to register with macOS: " + ex); 96 96 } 97 warnSoonToBeUnsupportedJava(javaCallback); 97 98 checkExpiredJava(javaCallback); 98 99 checkWebStartMigration(webStartCallback); -
trunk/src/org/openstreetmap/josm/tools/PlatformHookUnixoid.java
r18211 r18580 189 189 } else if (home.contains("java-11-openjdk")) { 190 190 return getPackageDetails("openjdk-11-jre", "java-11-openjdk"); 191 } else if (home.contains("java-17-openjdk")) { 192 return getPackageDetails("openjdk-17-jre", "java-17-openjdk"); 191 193 } else if (home.contains("java-openjdk")) { 192 194 return getPackageDetails("java-openjdk"); -
trunk/src/org/openstreetmap/josm/tools/PlatformHookWindows.java
r18208 r18580 155 155 @Override 156 156 public void startupHook(JavaExpirationCallback javaCallback, WebStartMigrationCallback webStartCallback) { 157 warnSoonToBeUnsupportedJava(javaCallback); 157 158 checkExpiredJava(javaCallback); 158 159 checkWebStartMigration(webStartCallback); -
trunk/src/org/openstreetmap/josm/tools/Utils.java
r18556 r18580 1806 1806 Config.getUrls().getJOSMWebsite() + "/remote/oracle-java-update-baseline.version"))) 1807 1807 .connect().fetchContent().split("\n", -1); 1808 if (getJavaVersion() <= 8) {1808 if (getJavaVersion() <= 11 && isRunningWebStart()) { // OpenWebStart currently only has Java 11 1809 1809 for (String version : versions) { 1810 if (version.startsWith("1.8")) { 1810 if (version.startsWith("11")) { 1811 return version; 1812 } 1813 } 1814 } else if (getJavaVersion() <= 17) { 1815 for (String version : versions) { 1816 if (version.startsWith("17")) { // Use current Java LTS 1811 1817 return version; 1812 1818 }
Note:
See TracChangeset
for help on using the changeset viewer.