How to catch exception thrown by another thread in Java? [duplicate]
问题 This question already has answers here : How to catch an Exception from a thread (16 answers) Closed 2 years ago . I'm using a library that creates its own thread and it throws an exception. How can I catch that exception? The exception is thrown on the line marked below: ResourceDescriptor rd = new ResourceDescriptor(); rd.setWsType(ResourceDescriptor.TYPE_FOLDER); fullUri += "/" + token; System.out.println(fullUri); // >>> EXCEPTION THROWN ON THE FOLLOWING LINE <<< rd.setUriString(fullUri