만약 당신이 각각의 메인 어플리케이션 클래스에 Runnable을 구현하게했다면, 하나의 메인 메소드 내에서 둘 다 실행할 수 있다고 생각합니다.
체크 아웃 Threads 어떻게하는지 보여주는 완벽한 예입니다. 남은 일은 응용 프로그램 객체를 포함하는 두 개의 스레드를 만들고 각 응용 프로그램 객체 내부에서 run() 메서드를 호출하는 각 스레드에 대한 start() 메서드를 호출하는 것입니다.
class App1 implements Runnable {
App1() {
//your constructor
}
//all other methods ...
public void run() {
// this will be the main method for App1
. . .
}
}
class App2 implements Runnable {
App2() {
//your constructor
}
//all other methods ...
public void run() {
// this will be the main method for App2
. . .
}
}
//your new main method
public static void main(String[] args)
{
//create the first application object
App1 application1 = new App1();
//create the second application object
App2 application2 = new App2();
//call their main methods run()
new Thread(application1).start();
new Thread(application2).start();
}
왜? 왜 그렇게 어려운가? –
WebSphere는 JVM에서 여러 응용 프로그램을 지원하며 단순히 함께 배치 할 수없는 이유를 언급하지 않았습니다. 귀하의 질문은 조숙 한 것 같습니다. 그것을 시도하고 볼 수 있습니다. – covener
당신이해야 할 일은 가지고있는 애플리케이션의 종류에 달려 있습니다. 코어 자바라면 각 스레드를 자신의 스레드에서 시작할 수도 있고 스레드를 추가하지 않고 결합 할 수도 있습니다. –