jME and Eclipse: A Started Guide - v2

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

User: guest

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 -> 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…”

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! :slight_smile:

Thanks to everyone who has contributed to this guide!

  • Eric

I deleted my old project and followed this step - by - step from scratch. It all went smoothly. (I’m using Eclipse 3.0.0 on Windows XP.) This was especially sweet after spending 12 hours at work. Thanks, man!

Thanks for putting that together Eric, you rock as always :slight_smile:

I think it would be great if we had this guide as a .pdf, perhaps supplemented with some screenshots.

So Mojo could provide it in the Getting Started-section of the mainpage as a foolproof tutorial on how to set up jME with Eclipse.

Very good, but I think it should be mentioned that you can refer to the jME project instead of adding all the jars.

Thanks Eric! Eclipse 3.0.2 on XP here and the only other thing I needed to do is add & select the correct jre in Eclipse’s preferences (new notebook so new Java (1.5.0_03) and Eclipse installs).

PS: Thanks also for your reply in old thread (to do with Eclipse on Mac). I’ll reply back later.

Wow that looks easy enough that I could do it! What version of lwjgl goes with CVS JME?

Thanks for this tutorial - really appreciate it!

LWJGL 0.96

Per: Good point. I’ll mention that in version 2.1.

Hopiu: Good idea. After the long weekend I’ll look into taking screenshots of the steps and getting a PDF version of the guide created.

I’m glad everyone is finding the guide useful. :slight_smile:

project properties -> java build path -> “source” tab -> “add folder…”

select the “src” folder in the jme project and confirm

when asked if you want to update the build output folder to “bin” click on “yes”.

that’s all (i suppose)

Beautiful, just beautiful. :slight_smile:

Thanks a lot for that.

Well, I’ve finally updated the guide. Sorry it took so long to get things sorted out. Unfortunately, real life kinda tore me to pieces these past few weeks.

I’ve added a new section for errors peole encounter and how to fix them. If you can think of anything that should be in this section, let me know.

Thanks to everyone who’s contributed ideas to this guide! :slight_smile:

ummm… is the jme cvs down or something? i just tried all that and i can't build my project because there is not source in it. there is a little red X thing by the icon of the project source. i have no idea what's going but I just did everything in the directions, and had to hunt down and download those 4 jars on my own because they weren't in any /lib folder anywhere. im stuck at the build part because i don't think my project actually had anythign source in it… eeh…

Exactly same problem here as wangsoft. The src folder is empty . can anyone help.