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 8401407
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 9, 20262026-06-09T21:47:54+00:00 2026-06-09T21:47:54+00:00

I am trying to build a general exception handler for a swing application as

  • 0

I am trying to build a general exception handler for a swing application as described here: http://www.javaspecialists.eu/archive/Issue081.html

I work in jython (python syntax getting compiled to java and executed). My code looks roughly like this (updated):

def launcher(func):
    class launcherThread(Runnable):
        def __init__(self):
            super(launcherThread, self).__init__()

        def run(self):
            func()

    #trying to get the name which can be used to instantiate this in java
    cls = ExceptionGroup().getClass()
    fullName = cls.__module__ + '.' + cls.__name__

    System.setProperty("sun.awt.exception.handler", fullName)
    Thread(ExceptionGroup(), launcherThread(), 'Cross ExceptionHandlerThread').start()

class ExceptionGroup(ThreadGroup):
    def __init__(self):
         super(ExceptionGroup, self).__init__("HardenedGroup")

    def uncaughtException(self, thread, exception):
        #make a fancy dialog displaying str(exception)

If I test it it works fine however in the production enviornment it failes.
For testing I launch my program in Eclipse (PyDev), the production enviornment is a third party application written in Java, that has a Jython console build in. The application supports adding of custom menu entries, and putting jython scripts on these.

The main difference I see between testing and production enviornment is that in the production enviornment the swing threads are allready started (the third party application utilitizes swing). Does this cause my ThreadGroup setting to fail, or is there another reason why this is not working?

How can I get the Involved threads (exceptions ar thrown as a result of buttonActions) to check their defaultException handlers? If (as I am afraid) it should turn out that the third party installed its own handler (all exceptions are written to a log file) how can I make a new swing worker thread? (I don’t want to catch the exceptions created by the host application after all)

Question recap:
1. How can I check which threads are started for the function func passed into the launcher function and see thier uncaught exception handler?
2. Can I enforce a seperate swing dispatcher for my gui part and the main applications gui part? (If I exitOnClos on a frame of my add in, the third party application closes)?

Update:
Considering the anwser from lbalazscs I am trying to use the sun.awt.exception.handler property, but it has no effect, the exceptions still end up in the log file (applications dfeault behaviour). Am I using it right? (p.s.: I am on Java 1.6)

  • 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-09T21:47:56+00:00Added an answer on June 9, 2026 at 9:47 pm

    If you have Java 5 or higher, you can also use Thread.setDefaultUncaughtExceptionHandler(), which is also described in a newer “Java Specialists’ Newsletter”:

    http://www.javaspecialists.eu/archive/Issue089.html

    And here is the newest Java 7 version:

    http://www.javaspecialists.eu/archive/Issue196.html

    Also see this:
    Why bother with setting the "sun.awt.exception.handler" property?

    EDIT: This is how I use Thread.setDefaultUncaughtExceptionHandler (in Java…):

    public static void setupGlobalExceptionHandling() {
        Thread.setDefaultUncaughtExceptionHandler(new Thread.UncaughtExceptionHandler() {
            @Override
            public void uncaughtException(Thread t, Throwable e) {
                handleException(e);
            }
        });
    }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I was trying Build For Archiving application (from Titanium Mobile) with xCode 4.4, but
I'm trying build an App Engine connected Android application and am having some problems
Trying to build out an exception if move.UserId does not equal currentUserId then Redirect
Trying to build sslsniff on a RHEL 5.2 system here. When compiling sslsniff on
I'm vastly trying to build a solid and responsive coding style. My general question
I'm trying to build an authentication system in my application, but I'm having some
I am trying to build a general numeric function to take an array of
I'm trying to prepare to build a database driven .net application and I have
i'm trying to build a general purpose template function which should function with 2
Here's the workflow that I'm trying to build compile my proto files using a

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.