的Java 3D的Hello World - 罐冻结 [英] Java 3D Hello World - Jar freeze

查看:209
本文介绍了的Java 3D的Hello World - 罐冻结的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

大家好
我下面本教程以建立我的第一个Java 3D应用程序。我包括在我的项目的 Java3D的库和我的 DllLoader 提取(从classpath中的jar的位置)并加载类的 j3dcore-ogl.dll

Hi guys
I'm following this tutorial to build my first Java 3D application. I included in my project the java3D libraries and my DllLoader class that extracts (from the classpath to the jar's location) and loads the j3dcore-ogl.dll:

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的罐子Hello3DWorld.jar
我的问题是这样的:如果我运行jar用一个简单的双击没有任何反应。这个dll附近出现罐子,但帧永远不会出现。
把一些 JOptionPane.showMessageDialog()在我的code,找出什么错误,我意识到,执行抛出也不例外。
这只是冻结就像一个循环加载DLL后。照片你能帮助我理解为什么只挂通过双击罐子,什么问题?


Everything works fine if I run the project from Netbeans or if i open the jar from the command line with java -jar Hello3DWorld.jar".
My problem is this: if I run the jar with a simple double click nothing happens. The dll appear near the jar but the frame never appear.
Putting some JOptionPane.showMessageDialog() in my code to find out what's going wrong, I realized that the execution throws no exception.
It just freezes like in a loop after loading the dll.
Can you help me to understand why it hangs only by double clicking the jar and what's the problem?

推荐答案

解决我的问题:D
有在Windows注册表中的错误... 这是解决方案:
1)运行的 注册表编辑器
2)发现的 HKEY_CLASSES_ROOT \ jar文件\壳\开放\命令
3)请确保该路径的 javaw.exe的正确

Solved my problem :D
There were an error in the Windows Registry... this is the solution:
1) run regedit
2) find HKEY_CLASSES_ROOT\jarfile\shell\open\command
3) make sure the path for javaw.exe is correct

这篇关于的Java 3D的Hello World - 罐冻结的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆