jME and Eclipse: A Starter Guide - v1.1.1

Having had a rather difficult time setting up Eclipse to interface nicely the jME CVS system, I thought I’d post a guide here to save others the frustration. I’ll assume a basic knowledge of how to navigate Eclipse. So without further ado…



Step 1: Connect to CVS

Open the CVS Reposity Exploring perspective, and create a new Repository Location by right-clicking in the CVS Repositories view. Use the following parameters to connect:

Host: cvs.dev.java.net

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 Project”. Wait patiently [optional].



Step 3: Configure the jME project

Before we can compile the project, we must first unpack the unofficial lwjgl distribution that comes with jME. Using your zip tool of choice, extract the lwjgl_unofficial.zip file in the /data directory into the /lib directory. Ignore warnings about overwriting existing files.



Now we have to tell Eclipse that jME is a Java project. Open the .project file for jME using the Navigator view. Inside the <natures></natures> tags add <nature>org.eclipse.jdt.core.javanature</nature>.



Now, under the Package Explorer view, jME should have all those nice package icons. Right click on the project folder (most likely in blue) and select “Properties”. Go to Java Build Path, then select the Source tab. Click “Add Folder” and select the src/ folder. The entry jme/src should now appear in the list. Click on its Exclusion Filter, then click “Edit”. Add the jme folder 'cause we don’t want to see the old version of jME, now do we?



Still in our Properties/Java Build Path view, browse to the Libraries tab. Use the “Add JARs…” button to add both lwjgl.jar and jl030.jar located in the jme/lib folder.



Almost there! Go to External Tools Builder, and add a new Ant Build called JMEBuild. Under the Main tab, enter the Location by using “Browse Workspace” and selecting build.xml under the jme project. Also set the Base Directory to be the jme project. Under the Targets tab, you can select what jME does when it is compiled. I usually select “dist” and then use the resulting JAR in my other programs.



One final thing! Close the Properties view. Go to Window -> Preferences.Under the Java node, go to Code Generation and then select the Code and Comments tab. 'Cause I’m nice, I’ve exported the code templates for you. You can download them here. All you have to do now dowload them, click on Import and select my file! (If you want to do things by hand, mind you, you can find the official specifications here. Keep in mind that to input the $ symbol, you need to type $$.)



Step 3: Compile the jME project

Making sure the jme project is selected in the Package Explorer View (double click on it to make sure), go to Project -> Rebuild Project.



Whee! One compiled, complete, bleeding edge jMonkey Engine!



Step 4: Update the jME project sometimes!

Under the Package Explorer view, right click on the jme project, then go to Team -> Update.



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. New model code added last hour? Update and now you can use it! :stuck_out_tongue:


  • Eric



    v1.1: added code templates stuff

    v1.1.1: changed location of downloadable code templates

Well, I’m not exactly sure if anything like that exists in the Java perspective, but if you go to Window → Open Perspective → Other… then select Team Synchronizing you’ll get a view detailing changes that are incoming from CVS and outgoing from your local version. The buttons at along the top of the frame act as filters for incoming/outgoing/all. I’ve not had much experience using this view, so you’ll have to play around with it to learn more.

Ok, one more newbie question. Can you show the CVS status in the Java Perspective? That is, show a file that’s modified locally, new, etc?

Ah! It works much better. Cool.

Will do!

Rejoice! Eclipse 3.0M6 seems to completely recitify the problem. And it has a lot of excellent subtle improvements to the CVS interface. Not to mention being a heck of a lot faster! "Check out as…" also works correctly now. My advice? Upgrade to 3.0, but keep a backup just in case.

Actually, truth be told, I didn’t get it to work for the tutorial. I went as far as I could with a test project - just short of actually uploading it. The rest I filled in from the help docs. That’s why I needed someone to fill me in on what happends when it actually gets uploaded. :stuck_out_tongue:



And yes, I have broadband. Don’t know what I’d do without it!

Hmmm, then how were you able to get it working to write your guide? I’m on a dial-up at home, so maybe a time out issue? Are you on broadband?

Yeah, I get the same thing. Very strange. From what I can gather, Eclipse is listening for some message or such, and after not receiving it dies. I get a “broken pipe signal” error.



After some research, this is what I’ve come up with: Eclipse is receiving a “broken pipe signal” when it attempts to issue multiple commands over a single connection. The cvs.dev.java.net servers don’t like this. The problem lies specifically in, I think, RemoteFolderTreeBuilder#buildTree(). Refer to bug 23575 for more info. I’m not sure quite how to resolve this yet.



For the moment, I’m testing 3.0M6 to see if the problem is fixed. I certainly hope it is!

same here dude. It doesn’t happen with WinCVS!

Great! I’m really glad someone has done this. I might put this up on the tutorials page if you don’t mind.

Go right ahead. If it saves someone else from cursing at Eclipse, I’m happy.

Thanks. I’ve always used WinCVS, but I think I’ll investigate now.



:slight_smile:

Now, if someone can explain to me how to tie an existing java project to a cvs repository I’d be set. I have my existing project and just want to tie it with the cvs repository without starting over and can’t figure out how.

Appendix A: Learning to Share - A Guide to Uploading Existing Projects to CVS



So, you have your cool project you want to share? Great! In a few quick steps you can upload it to CVS.



Step 1: Connect to CVS

In Eclipse, create the repository where you want to store your project. If you’re unsure how to do this, refer to Step 1 in the main guide. Make certain you have write access before attempting this.



Step 2: Upload Your Project

In the Package Explorer view, right click on your project and go to Team → Share Project. Choose the repository location you want to upload to and click Next. Now, specify in which folder you want to store your project. Remember, if you’re using cvs.dev.java.net, you have to specify somewhere inside your project folder. (For example “jme/stuff”.) Click Finish, and that’s all there is to it!



– I have nothing to upload, so I can’t really say what happens beyond this point. If someone does, please let me know so I can update the tutorial accordingly. Thanks!



Edit: It’s 2am and I can spell better than I can at 7. Go figure.

I’m starting to feel like a fool… but…



Whenever I try to link the project with the CVS I get the following error:



“The server reported an error while performing the “cvs status” command”



This also happens while trying to checkout as java project… but NOT when just doing a normal check out.



Any ideas?

bump… until I give it it’s own page.

I highly recommend using “Team → Synchronize with Repository” if you’re not already doing so. This is far superior to individual commit/updates due to the built-in diffs.



It’ll show you what’s new in cvs (with diffs) as well as what’s changed in your local copy (with diffs). It makes it easy to individually update or commit files.



Incoming shows just what’s new in the repository (and allows updates)

Outgoing shows just what’s changed locally (and allows commits)

I/O shows both and gives you total control over whether to commit, update, or mark as merged.

"EricTheRed" wrote:
Step 3: Configure the jME project
Now we have to tell Eclipse that jME is a Java project. Open the .project file for jME using the Navigator view. Inside the <natures></natures> tags add <nature>org.eclipse.jdt.core.javanature</nature>.

Rather than having users look this up on the forums, why not just update the .project file in cvs so that it's correct to start with? :)

And add .classpath to cvs so that the build path is also correct.

If you're worried about making it too eclipse-centric (and it's a bit late for that since there's a .project file in cvs already), you can handle it like the cayenne project does.

http://www.objectstyle.org/cayenne/developerguide/eclipse.html

-Mike

CVS is going to under go a major scrubbing soon. It’s gotten out of hand, so that .project file (which should never have been in there to begin with) will be gone before too long. However, you are right that making them go to the forums to read this isn’t good, so I am going to make this it’s own page and put it in the documents section.