Quite a while ago I had quite a bit of difficulty getting the CVS version jME to play nicely with Eclipse. I wrote a guide - now terribly outdated - to help others with the process. Now, an outdated guide is not a particularly helpful guide, so I’ve rewritten it so now it actually works! As before, I assume a very basic knowledge of how to navigate Eclipse.
Step 1: Connect to CVS
Open the CVS Reposity Exploring perspective by selecting window -> Open Perspective -> Other…. Create a new Repository Location by right-clicking in the CVS Repositories view. Use the following parameters to connect:
Repository path: /cvs
Connection type: pserver
Step 2: Open jME as a project
Browse to the jme folder under the HEAD tree node under our newly created repository. Right-click on the folder and select Check Out As… then Check out as a project configured using the New Project Wizard. Click Finish and prepare to be whisked off to the New Project Wizard!
Step 3: Configure the jME project
Select Java Project and click Next. On the Create a Java Project screen, give the project a suitable name (“jme” strikes me as a good choice :)) and select Create new project in the workspace and Create separate source and output folders. Click Finish, and if Eclipse prompts you if you want to switch to the Java perspective, say yes.
Now, under the Package Explorer view, you should see your newly checked out jME! Right-click on the blue project folder and select Properties. Go to Java Build Path, then select the Libraries tab. Use the Add JARs… button to add lwjgl.jar, lwjgl_fmod3.jar, jogg-0.0.5,jar, and jorbis-0.0.12.jar, all located in the lib/ directory.
Step 3: Compile the jME API
Making sure the jme project is selected in the Package Explorer View (double-click on it to make sure), go to Project -> Build Project.
But, hey, that’s boring… so let’s also compile jME with Ant so we can create jar files for jME! In the Package Explorer View, open the jME project right-click on build.xml. Select Run As -> Ant Build…. Go to the Targets tab and take a look at all the options available. The target in which we’re interested is dist-all. It’ll compile jME (putting the classes in build/) and also create jar files for jME in the target/ directory. Click Run and you’re all set! You can now use these jars in your other projects.
You can also use jME with your other projects in Eclipse without creating the jar files. This saves you the hassle of recreating the jars everytime the jME changes. From the Package Explorer view, right-click on the project you want to link with jME and select Properties. Choose Project References from the list on the left, then select jME. Click OK and now you can always use the latest version of jME in your project!
Step 4: Run a Demo
jME’s no fun unless you can test it out, right? Again in the Package Explorer view, go to src -> jmetest.renderer.TestScenegraph.java and double-click the entry to open the file. Go to Run -> Run…. We’re going to use a shortcut now: in the left-hand pane, double-click on Java Application. An entry for TestScenegraph should now appear in the list. Select the entry, and click on the Arguments tab. In the VM arguments tab enter “-Djava.library.path=lib/;”. Click Run and have fun!
Step 5: Update the jME project occasionally!
Under the Package Explorer view, right click on the jME project, then go to Team -> Update.
Step That’s-Not-A-Good-Dialog-Box: Help! Something doesn’t work quite right…
Error: “The declared package does not match the expected package src.com…”
Solution: Right-click on your jME project folder and select Properties. Go to Java Build Path, then select the Source tab. Click Add Folder… then add the src/ folder.
That’s it! It’s well worth all the effort to set things up, because you now always have the absolute latest version of jME. Take advantage of jME’s rapid development cycle!
Thanks to everyone who has contributed to this guide!