2011-01-23 3 views
3

안녕하세요
첫 번째 Java 3D 응용 프로그램을 빌드하려면 this tutorial을 따르고 있습니다. 내 프로젝트에 (클래스 패스에서 jar의 위치로) 추출 java3D librariesDllLoader 클래스를 포함하고j3dcore-ogl.dll로드 : 나는를 실행하면Java 3D Hello World - Jar 동결

public class DllLoader { 

    private DllLoader() { 
    } 

    public static void extractAndLoad(String dll) throws IOException { 
     int aux = dll.lastIndexOf('/'); 
     if (aux == -1) { 
      aux = dll.lastIndexOf('\\'); 
     } 
     File dllCopy = new File((aux == -1) ? dll : dll.substring(aux + 1)); 
     try { 
      System.load(dllCopy.getAbsolutePath()); 
     } catch (UnsatisfiedLinkError e1) { 
      try { 
       DllLoader.copyFile(DllLoader.class.getResourceAsStream(dll), dllCopy); 
       System.load(dllCopy.getAbsolutePath()); 
      } catch (IOException e2) { 
      } 
     } 
    } 

    private static void copyFile(InputStream pIn, File pOut) throws IOException { 
     if (!pOut.exists()) { 
      pOut.createNewFile(); 
     } 
     DataInputStream dis = new DataInputStream(pIn); 
     FileOutputStream fos = new FileOutputStream(pOut); 
     byte[] bytes = new byte[1024]; 
     int len; 
     while ((len = dis.read(bytes)) > 0) { 
      fos.write(bytes, 0, len); 
     } 
     dis.close(); 
     fos.close(); 
    } 
} 


모든 것이 잘 작동 프로젝트를 Netbeans에서 또는 java -jar Hello3DWorld.jar"과 함께 명령 줄에서 jar 파일을 열면 어떻게됩니까?
내 문제는 다음과 같습니다. 간단한 두 번 클릭으로 jar 파일을 실행해도 아무 것도 발생하지 않습니다.. dll은 항아리 근처에 나타나지만 프레임은 나타나지 않습니다.
어떤 코드가 잘못되었는지 알아보기 위해 JOptionPane.showMessageDialog()을 두어 실행해도 예외가 발생하지 않는다는 것을 깨달았습니다.
dll을로드 한 후 루프처럼 고정됩니다 ().
병을 두 번 클릭하여 문제가 발생하는 이유와 문제점을 이해하는 데 도움이 될 수 있습니까?

답변

2

내 문제를 해결 :
1) 실행 regedit
2) HKEY_CLASSES_ROOT\jarfile\shell\open\command
3를 찾을 수) 확인 : D이 해결책입니다 Windows 레지스트리에 오류가 있었다 ...
의 경로는 javaw.exe입니다.

0

실행 여부 javaw를 사용하여 jar 파일을 실행하는 데 올바른 파일 연결을 가질 수 없습니다.

jar 파일 연결과 관련하여 this StackOverflow question을 참조하십시오.