Running Java3D Programs In Eclipse


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

  1. Download Java3D.

    Visit this page to download the Java3D library for your system.


     

  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:



     

  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.



    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, select Project -> Properties



     

  6. In the window that pops up select Java Build Path and then click the Add Library... button.



     

  7. In the next window select User Library and click the Next button.


     

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


     

  9. In the next click the New ... button.


     

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


     

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


     

  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 the Open button



     

  13. After adding the jars click the Okay button in the preferences window.


     

  14. In the window that pops up click the Finish button.


     

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


     

  16. In the window that pops up click the External Folder button.



     

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

  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.


     

  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.
     

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值