抛出异常的简单3d代码!

时间:2010-03-02 03:56:56

标签: java netbeans 3d

我在互联网上找到了一个代码,但我真的不知道为什么它会抛出这些异常,请帮帮我!真的,我需要你的帮助谢谢。

run:
java.lang.UnsupportedOperationException: No AudioDevice specified
        at com.sun.j3d.utils.universe.Viewer.createAudioDevice(Viewer.java:986)
        at javaapplication17.WrapShooter3D.<init>(WrapShooter3D.java:54)
        at javaapplication17.Shooter3D.<init>(Shooter3D.java:25)
        at javaapplication17.Shooter3D.main(Shooter3D.java:38)
    Java 3D: audio is disabled
    Exception in thread "main" com.sun.j3d.utils.image.ImageException: javax.imageio.IIOException: Can't read input file!
        at com.sun.j3d.utils.image.TextureLoader$1.run(TextureLoader.java:344)
        at java.security.AccessController.doPrivileged(Native Method)
        at com.sun.j3d.utils.image.TextureLoader.<init>(TextureLoader.java:337)
        at com.sun.j3d.utils.image.TextureLoader.<init>(TextureLoader.java:291)
        at javaapplication17.GunTurret.stoneApp(GunTurret.java:58)
        at javaapplication17.GunTurret.<init>(GunTurret.java:43)
        at javaapplication17.WrapShooter3D.makeGun(WrapShooter3D.java:167)
        at javaapplication17.WrapShooter3D.createSceneGraph(WrapShooter3D.java:79)
        at javaapplication17.WrapShooter3D.<init>(WrapShooter3D.java:56)
        at javaapplication17.Shooter3D.<init>(Shooter3D.java:25)
        at javaapplication17.Shooter3D.main(Shooter3D.java:38)
    Caused by: javax.imageio.IIOException: Can't read input file!
        at javax.imageio.ImageIO.read(ImageIO.java:1275)
        at com.sun.j3d.utils.image.TextureLoader$1.run(TextureLoader.java:342)
        ... 10 more

_ java.lang.UnsupportedOperationException:未指定AudioDevice

行:

 AudioDevice audioDev = su.getViewer().createAudioDevice();
    WrapShooter3D w3d = new WrapShooter3D();
    javax.imageio.IIOException: Can't read input file!
    { new Shooter3D(); }

_ Java 3D:禁用音频       线程“main”中的异常com.sun.j3d.utils.image.ImageException:

行:

 TextureLoader stoneTex = new TextureLoader("images/stone.jpg", null);
 Appearance apStone = stoneApp();
 GunTurret gun = new GunTurret(startVec);
 makeGun(canvas3D);
 createSceneGraph(canvas3D);
 WrapShooter3D w3d = new WrapShooter3D();
 { new Shooter3D(); }

_引起:javax.imageio.IIOException:无法读取输入文件!

行:

throw new IIOException("Can't read input file!");

1 个答案:

答案 0 :(得分:1)

TextureLoader stoneTex = new TextureLoader(“images / stone.jpg”,null);

尝试将“images / stone.jpg”替换为文件的完整路径。例如。 “C:\ ABC \ EFG \图像\ stone.jpg”。