- Timestamp:
- 2021-03-30T10:29:14+02:00 (4 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/org/openstreetmap/josm/tools/Utils.java
r17679 r17692 1721 1721 1722 1722 /** 1723 * Determines if a class can be found for the given name. 1724 * @param className class nmae to find 1725 * @return {@code true} if the class can be found, {@code false} otherwise 1726 * @since 17692 1727 */ 1728 public static boolean isClassFound(String className) { 1729 try { 1730 return Class.forName(className) != null; 1731 } catch (ClassNotFoundException e) { 1732 return false; 1733 } 1734 } 1735 1736 /** 1723 1737 * Determines whether JOSM has been started via Web Start (JNLP). 1724 1738 * @return true if JOSM has been started via Web Start (JNLP) … … 1726 1740 */ 1727 1741 public static boolean isRunningWebStart() { 1728 try { 1729 // See http://stackoverflow.com/a/16200769/2257172 1730 return Class.forName("javax.jnlp.ServiceManager") != null; 1731 } catch (ClassNotFoundException e) { 1732 return false; 1733 } 1742 // See http://stackoverflow.com/a/16200769/2257172 1743 return isClassFound("javax.jnlp.ServiceManager"); 1734 1744 } 1735 1745 … … 1740 1750 */ 1741 1751 public static boolean isRunningJavaWebStart() { 1742 return isRunningWebStart() && Package.getPackage("com.sun.javaws") != null;1752 return isRunningWebStart() && isClassFound("com.sun.javaws.Main"); 1743 1753 } 1744 1754 … … 1749 1759 */ 1750 1760 public static boolean isRunningOpenWebStart() { 1751 return isRunningWebStart() && Package.getPackage("net.adoptopenjdk.icedteaweb") != null; 1761 // To be kept in sync if package name changes to org.eclipse.adoptium or something 1762 return isRunningWebStart() && isClassFound("net.adoptopenjdk.icedteaweb.client.commandline.CommandLine"); 1752 1763 } 1753 1764
Note:
See TracChangeset
for help on using the changeset viewer.