2011-10-23 14 views
0

친구들 사이에서 첫 알파 테스트를 위해 게임을 실행 파일 .jar 파일로 추출하려고합니다. 그러나, 내보낼 때, 그냥 빈 프레임을 여는 응용 프로그램을 얻을. 그것은 Eclipse 내에서 실행을 사용하여 잘 작동합니다. 여기 프로젝트를 실행 가능한 Jar 파일로 추출 할 수 없습니다

는 내 정적 주 :

public static void main(String[] args){ 
regular=new DisplayMode(800,600); 
mainframe=new JFrame(); 
mainframe.setSize(new Dimension (regular.getWidth(), regular.getHeight())); 
Dimension dim = Toolkit.getDefaultToolkit().getScreenSize(); 
mainframe.setLocation(dim.width/2-(regular.getWidth()/2), dim.height/2-(regular.getHeight()/2)); 
ExecutorService exmain = Executors.newFixedThreadPool(1); 
displaycanvas=new Canvas(); 
     displaycanvas.setSize(regular.getWidth(), regular.getHeight()); 
     mainframe.add(displaycanvas); 
     displaycanvas.setFocusable(true); 
     displaycanvas.requestFocus(); 
     displaycanvas.setIgnoreRepaint(true); 
     mainframe.setVisible(true); 
     mainframe.setResizable(true); 
Main datmain=new Main(displaycanvas, mainframe); 
mainframe.addWindowListener(datmain.new maincloser(datmain)); 
mainframe.addComponentListener(datmain.new mainresize(datmain)); 
Thread mainthread= new Thread(datmain); 
mainthread.run(); 
} 

그리고 당신이 요청하기 전에, 나는 (내 매니페스트에서 선택) 메인 클래스가 아닌 실행 가능한 스레드를 만드는 시도 않았고, 나는 모든 것을 아래로 줄여보십시오 않았다 간단한 표시. 게임 기능 자체가 할당 된 메모리 근처에 절대 도달하지 않기 때문에 작동하지 않는다는 것을 알고 있습니다.

내 opengl 라이브러리가 jar 파일로 추출됩니다. Main 클래스는 프로세스 패키지 내에 있습니다 (기본 패키지로도 작동하지 않음).

그리고 내가 말했듯이 Main을 Main 클래스 (정적 메인이있는)로 지정하는 매니페스트에서 실행 중입니다.

꽤 많이 들렸습니다. Eclipse에서 Run에서 정상적으로 작동하지만 Display 클래스에 대한 모든 호출을 줄였습니다. (System.exit (0) 사용, 함수 호출 후 동결 된 경우 제거됨)

추가 : 또한 추출 된 jar 파일의 lwjgl 패키지에서 Display 클래스가 8 개의 개별 파일로 분할되어 있음을 발견했습니다. 그러나, 나는 opengl. *을 가져오고있다.

+0

아마도 예외가 발생합니다 ...'main()'코드를'try/catch (Exception e)'로 묶으십시오. –

답변

0

병 안에 내재재를 포장하지 않았습니다.

0

코드에 숨겨진 버그가 있습니다. main()이 예외를 throw하면 (그리고 네이티브 라이브러리를로드 할 수 없을 때 발생했을 가능성이 큽니다),이 코드는 표시되지 않습니다. 도

public void main(String[] args) { 
    try { 
     MainClass tool = new MainClass(); 
     tool.run(args); 
    } catch(Exception e) { 
     e.printStackTrace(); 
    } 
} 

을 당신이 당신의 클래스 경로에 commons-lang이있는 경우 새로운 개인 방법 run()

main() 코드를 이동, 중첩 된 예외를 참조하는 대신 ExceptionUtils.printRootCauseStackTrace()를 사용하는 대신이 패턴을보십시오.

관련 문제