To be able to send the exception to the parent thread, you can put your background thread in a Callable (it allows throwing also checked exceptions) which you then pass to the submit method of some Executor. The submit method will return a Future which you can then use to get the exception (its get method will throw an ExecutionException which contains the original exception).
Related Contents:
- What causes a java.lang.ArrayIndexOutOfBoundsException and how do I prevent it?
- Understanding checked vs unchecked exceptions in Java
- Causes of getting a java.lang.VerifyError
- What are the effects of exceptions on performance in Java?
- When to choose checked and unchecked exceptions
- What is an OutOfMemoryError and how do I debug and fix it
- Can I catch multiple Java exceptions in the same catch clause?
- Java List.add() UnsupportedOperationException
- Handling exceptions from Java ExecutorService tasks
- What could cause java.lang.reflect.InvocationTargetException?
- Exception thrown in catch and finally clause
- How to define custom exception class in Java, the easiest way?
- Null check chain vs catching NullPointerException
- Java unreported exception [duplicate]
- (Unknown Source) in Exception stack trace
- Handling Java crypto exceptions
- java.util.ConcurrentModificationException not thrown when expected
- How do you assert that a certain exception is thrown in JUnit tests?
- Why doesn’t Java allow generic subclasses of Throwable?
- When should we create our own Java exception classes? [closed]
- Using Joda Date & Time API to parse multiple formats
- Why are Exceptions not Checked in .NET?
- JavaFX Exception in thread “main” java.lang.NoClassDefFoundError: javafx/application/Application
- JDBC driver throws “ResultSet Closed” exception on empty ResultSet
- Java: Exceptions as control flow?
- tomcat server fails to start the server and application in STS [duplicate]
- Eclipse – java.lang.ClassNotFoundException
- “NoClassDefFoundError: Could not initialize class” error
- Exception NoClassDefFoundError for CacheProvider
- try/catch versus throws Exception
- When to use an assertion and when to use an exception
- Why does Java throw NullPointerException here?
- Why can’t I throw an exception in a Java 8 lambda expression? [duplicate]
- PrintWriter and PrintStream never throw IOExceptions
- Java: Global Exception Handler
- While constructing the default constructor can not handle exception : type Exception thrown by implicit super constructor
- Rethrowing exceptions in Java without losing the stack trace
- Connection Java – MySQL : Public Key Retrieval is not allowed
- org.hibernate.MappingException: Unknown entity: annotations.Users
- Why does order matter when catching exceptions?
- Why does TreeSet throw a ClassCastException?
- org.openqa.selenium.UnhandledAlertException: unexpected alert open
- What is the advantage of chained exceptions
- Guidelines on Exception propagation (in Java)
- Getting Exception org.apache.logging.slf4j.SLF4JLoggerContext cannot be cast to org.apache.logging.log4j.core.LoggerContext
- In Java how can I validate a thrown exception with JUnit?
- How can I detect when an Exception’s been thrown globally in Java?
- CompletableFuture already completed with an exception
- Java exception handling
- Close resource quietly using try-with-resources