Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8676877
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 12, 20262026-06-12T20:18:34+00:00 2026-06-12T20:18:34+00:00

I tried Thread.setDefaultUncaughtExceptionHandler… in the main, and also in the start(Stage primaryStage) method. It

  • 0

I tried

Thread.setDefaultUncaughtExceptionHandler...

in the main, and also in the start(Stage primaryStage) method. It ain’t working.
I also tried

public static void main(String[] args) {
 try {
  launch(args);
 }catch(Throwable t) {
  System.out.println(t.getMessage);
 }
}

Exception stack trace.

at javafx.concurrent.Task$TaskCallable$2.run(Task.java:1251) at
com.sun.javafx.application.PlatformImpl$3.run(PlatformImpl.java:141)
at com.sun.glass.ui.gtk.GtkApplication._runLoop(Native Method) at
com.sun.glass.ui.gtk.GtkApplication$1$1.run(GtkApplication.java:56)
at java.lang.Thread.run(Thread.java:662)

Thanks for helping.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-12T20:18:36+00:00Added an answer on June 12, 2026 at 8:18 pm

    If you check the code for Platform.runLater() (see below), you will see that the exceptions are swallowed (lines 146 / 147), so a default uncaught exception handler won’t be able to catch them – based on that piece of code, I don’t think you have any options but to include try/catch blocks in your runnables.

    Note that this issue has been reported (requires login – registration is free) and should be fixed in Lombard (= Java FX 8.0 to be released with Java 8 next year).

    You could alternatively create a utility method and call

    Platform.runLater(getFxWrapper(yourRunnable));
    
    public static Runnable getFxWrapper(final Runnable r) {
        return new Runnable() {
    
            @Override
            public void run() {
                try {
                    r.run();
                } catch (Exception e) {
                    //here you probably want to log something
                    System.out.println("Found an exception");
                }
            }
        };
    }
    

    Code of Platform.runLater:

      120     private static void runLater(final Runnable r, boolean exiting) {
      121         if (!initialized.get()) {
      122             throw new IllegalStateException("Toolkit not initialized");
      123         }
      124 
      125         pendingRunnables.incrementAndGet();
      126         waitForStart();
      127 
      128         if (SystemProperties.isDebug()) {
      129             Toolkit.getToolkit().pauseCurrentThread();
      130         }
      131 
      132         synchronized (runLaterLock) {
      133             if (!exiting && toolkitExit.get()) {
      134                 // Don't schedule a runnable after we have exited the toolkit
      135                 pendingRunnables.decrementAndGet();
      136                 return;
      137             }
      138 
      139             Toolkit.getToolkit().defer(new Runnable() {
      140                 @Override public void run() {
      141                     try {
      142                         r.run();
      143                         pendingRunnables.decrementAndGet();
      144                         checkIdle();
      145                     } catch (Throwable t) {
      146                         System.err.println("Exception in runnable");
      147                         t.printStackTrace();
      148                     }
      149                 }
      150             });
      151         }
      152     }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

thread = new Thread() { @Override public void run() { while(!requestedToExit) { SystemClock.sleep(3000); Log.d(debug,
I tried the solution from this thread , but I must be missing something
Following this thread, I tried to upload a file on the server. If I
I've searched for help and tried everything on this thread , but still can't
I am new to posix thread library, and I tried to compile a sample
I've tried some codes like string s = this is example; txt1TextBlock.Text = Thread.CurrentCulture.TextInfo.ToTitleCase(s);
I've tried the following: Activity a = getActivity(); a.setRequestedOrientation(ActivityInfo.SCREEN_ORIENTATION_LANDSCAPE); Thread.sleep(2000); a.setRequestedOrientation(ActivityInfo.SCREEN_ORIENTATION_PORTRAIT); Thread.sleep(2000); on Android
When running my @Override public void updateScene(int x, int y) The code the runs
I noticed that when the function setModel is executed in parallel thread (I tried
I would like to write a real time counter. I tried to use thread,

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.