1313import javax .imageio .ImageIO ;
1414import javax .swing .ImageIcon ;
1515import javax .swing .InputMap ;
16+ import javax .swing .JOptionPane ;
1617import javax .swing .KeyStroke ;
1718import javax .swing .SwingUtilities ;
1819import javax .swing .ToolTipManager ;
@@ -253,6 +254,12 @@ public static void initUIManager() {
253254 * String[]
254255 */
255256 public static void main (String [] args ) {
257+ if (!ClientPrerequisites .isAcceptable ()) {
258+ showUnsupportedJreDialog ();
259+ System .exit (1 );
260+ return ;
261+ }
262+
256263 CommandLineOptions opts = new CommandLineOptions (args );
257264
258265 if (StringUtils .isNotBlank (opts .getProtocols ())) {
@@ -267,6 +274,19 @@ public static void main(String[] args) {
267274 start (opts .getServer (), opts .getVersion (), opts .getUsername (), opts .getPassword ());
268275 }
269276
277+ private static void showUnsupportedJreDialog () {
278+ var message = String .format (
279+ "%s Client requires Java 17 or newer with JavaFX (JFX).%n%n"
280+ + "Detected Java runtime: %s%n%nPlease relaunch the client with a supported JRE." ,
281+ BrandingConstants .PRODUCT_NAME , System .getProperty ("java.version" ));
282+
283+ try {
284+ JOptionPane .showMessageDialog (null , message , "Unsupported Java Runtime" , JOptionPane .ERROR_MESSAGE );
285+ } catch (Throwable t ) {
286+ System .err .println (message );
287+ }
288+ }
289+
270290 private static void start (final String server , final String version , final String username , final String password ) {
271291 // disable the velocity logging
272292 Logger velocityLogger = LogManager .getLogger (RuntimeConstants .DEFAULT_RUNTIME_LOG_NAME );
0 commit comments