我已经在互联网上找到了一个代码,但实际上我不知道该代码引发这些异常的原因,请帮助我!非常感谢您的帮助。

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!");

最佳答案

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

尝试用文件的完整路径替换“ images / stone.jpg”。例如。 “ c:\ abc \ efg \ images \ stone.jpg”。

10-06 02:16