Where do I build my projects in Eclipse?

I have got Eclipse Galileo and I have successfully applied the JME engine to it, such that when I open Eclipse I can see 'jme [Trunk]' and 'jME Physics 2 [Trunk]' in the 'Package Explorer'. I can open these up and play about with the effects and physics and view examples of them and have a bicycle or view HelloTerrain and whiz about over some Terrain.



However I do not seem to be able to write some code properly, if I copy some code into a new project it seems not to be able to see the jME classes?! Do I need to build each project under the jME things? Or do I need to reference the classes in a way more than just for example…



import com.jme.app.BaseGame;



… Thanks in advance for any help, I'm a massive newbie to this but I would really like to learn it (my ambition, or one of them at least at the moment, is to learn Java enough to be able to start creating games for peeps to play, needless to say I'm finding that I'm still a bit lost, even after a couple of months of following various tutorials and such forth).



Thanks



Neilos

you need to add the jME and third party libraries to your classpath!



Right click on the new project in Eclipse and hit properties.  From there, select "build path" on the left.  If you hit the projects tab, you can select that the new project depends on the jME project.  This is one way of doing it and helps to keep your project in sync with the latest version of jME.  The other, more traditional way would be to build the jME jar's and add them to the classpath by selecting the "libraries" tab rather than the "libraries" tab on the top.



To build the jar's, right click build.xml in the jME project, select Run As -> 2 Ant Build, and select the compile-all and dist-all options and run it.  This will build the jME standalone JAR files into the folder called 'target' in your jME directory.  Refresh the Eclipse project and you will see them there.

Thanks for the speedy reply. I followed your instructions but I don't think that I did it correctly.



Forgive my ignorance but could someone outline the steps a bit more clearly for me please?



Thanks



Neilos

a video (or two) says more the 1000 words…

http://www.jmonkeyengine.com/wiki/doku.php?id=video_tutorial_-_setting_up_eclipse_to_build_jme_2

Thanks Core-Dump, but (unless I am missing something) I have already set up jME in Eclipse and that is not the problem. The problem I am having is the one that sbook answered.



I could find the 'build.xml', I went to 'Run As' and then clicked '2 Ant build…' then I was stuck and didn't know how to proceed, my question is, what do I do next?



Also I clicked the properties of one of the projects that I had created. I clicked the 'Projects' tab and then clicked 'Add' then I clicked on 'jme' and 'jME Physics 2' these were then present in the 'required projects on the build path' list but it hadn't seemed to do anything. For this way of doing things is there something else that I may have needed to do that I hadn't?



Basically I would appreciate it if someone could give me a step by step guide to adding these to the build path for each of these 2 versions of doing things.



Many Thanks



Neilos

Actually it couldn't be much clearer than sbook already wrote:


  • Create Project
  • Project-Properties->build path->projects->jm2(trunk)



    That's it

Thanks ttrocha, yes it seems that that method does indeed work, god only knows how I managed to not make it work straight away.



The Ant Build method is still unclear though, can anyone explain the difference please? When might one be more appropriate than the other?



Thanks



Neilos

Actually the ant-build creates jar-files of your jME-trunk that would be located the target-directory. That could be used to add them as jar-files to your project.

But I advice to use the trunk as long as possible during development process(and update it from time to time) and if you have an application you want to share with someone to build the jars to provide them instead of the whole jME-Classes as single class-files.

Awesome, another question I had burning away in the back of my mind was how to distribute applications with only the relevant classes in the JARS (without distributing the entire of the jME classes). It seems that Ant Builds are the answer for that. Excellent I understand it all now.



Thanks for your answers



Neilos

Neilos said:

Awesome, another question I had burning away in the back of my mind was how to distribute applications with only the relevant classes in the JARS (without distributing the entire of the jME classes). It seems that Ant Builds are the answer for that. Excellent I understand it all now.

Thanks for your answers

Neilos


JME provides the distrubtion jars at the downloads section of the Google Code page

http://code.google.com/p/jmonkeyengine/downloads/list - "jME 2.0.1 Stable Distribution (contains: separated jME only jars; intended for game distribution)"