Is possible to have 2 child threads with different classpath in each one?
问题 I have a "core" application that is adapter to process task. Each task is implemented in an adapter load by the core to process the task. My question is, is it possible to have different classpath in each adapter to precent class/jar conflict between adapters. Regards, 回答1: Indeed: URLClassLoader cl = new URLClassLoader(urls); Thread thread = new MyThread(); thread.setContextClassLoader(cl); thread.start(); 回答2: Use Thread.currentThread().setContextClassloader() and make a new URLClassLoader