This page explains how to run programs that use the Java3D library in Eclipse.

  1. Download Java3D.

    Visit this page to downloadthe Java3D library for your system.

    Running Java3D Programs In Eclipse

  2. The download for Windows includes an installer. I found it easiest to install the Java3D files and directories in my Java folder, the same one that contains the download for standard java, jdk1.6.0_18 in my case. After running the installer:

    Running Java3D Programs In Eclipse

  3. Start Eclipse. You can either create a new project for your Java3D code or use a preexisting project. I will create a new project named 3DExamples

  4. Download HelloUniverse.java and add it the project from step 3.

    Running Java3D Programs In Eclipse

    HelloUniverse.java has a lot of syntax errors because it refers to a number of non standard classes in Java3D. We need to tell the project where to look for these classes.

  5. In the Eclipse menu, selectProject -> Properties

    Running Java3D Programs In Eclipse

  6. In the window that pops up selectJava Build Pathand then click theAdd Library...button.

    Running Java3D Programs In Eclipse

  7. In the next window selectUser Libraryand click theNextbutton.

    Running Java3D Programs In Eclipse

  8. In the next window click theUser libraries ...button

    Running Java3D Programs In Eclipse

  9. In the next click theNew ...button.

    Running Java3D Programs In Eclipse

  10. In the window that pops up give the new library a name. I use the name Java3DLib. Then click theOKbutton.

    Running Java3D Programs In Eclipse

  11. Select the library you just created and then click theAdd JARs ...button.

    Running Java3D Programs In Eclipse

  12. In the file selector that pops up navigate to the folder where you installed Java3D in step 2. (On my machine the path to the jar files for Java3D is Java3D -> 1.5.2 -> lib -> ext ->) Select all three jar files (j3dcore.jar, j3dutils.jar, and vecmath.jar). After selection all three jar files click theOpenbutton

    Running Java3D Programs In Eclipse

  13. After adding the jars click theOkaybutton in the preferences window.

    Running Java3D Programs In Eclipse

  14. In the window that pops up click theFinishbutton.

    Running Java3D Programs In Eclipse

  15. Back in the Build Path window select the Java3DLib you just added, expand it, and select theNative Library Locationproperty. Then click the edit button.

    Running Java3D Programs In Eclipse

  16. In the window that pops up click theExternal Folderbutton.

    Running Java3D Programs In Eclipse

  17. In the window that pops up, browse to thebinfolder in your Java3D folder. (On my machine this was at Java3D -> 1.5.2 -> bin) Select the folder then clickOkay.

  18. Close the preferences window. HelloUniverse should now compile without any syntax errors. When you run the program you should see a spinning colored cube.

    Running Java3D Programs In Eclipse

  19. You can download more example programs for Java3D here.(download the zip file, unzip it, and then you can add classes / programs with examples to Eclipse)

  20. You can access the documentation for the Java3D classes here.

  21. You can download the documentation to install or your own machine here.

相关文章:

  • 2021-08-02
  • 2022-12-23
  • 2021-09-21
  • 2021-09-20
  • 2021-11-21
  • 2021-05-25
猜你喜欢
  • 2021-06-01
  • 2021-06-09
  • 2022-02-18
  • 2022-12-23
  • 2022-01-06
  • 2021-07-11
  • 2021-07-30
相关资源
相似解决方案