Editing Source Code with Eclipse

Setting up project

We start by creating a new project under New->Project

[画像:eclipse]

This takes us through a set of wizard pages, first we want to setup as a wizard:

[画像:eclipse]

On the next screen enter the project name, then set the JDK compliance, I did this by clicking on 'Configure default':

[画像:eclipse]

Clicking on 'Configure default' gives the following screen, I set the compliance level to 5.0

[画像:eclipse]

Clicking on 'Installed JREs' gives the following screen, but I did not need to change anything on this page:

[画像:eclipse]

Clicking on OK takes us back to the wizard:

[画像:eclipse]

Clicking on next gives up a page which allows us to set 'Source', 'Projects', 'Libraries' and 'Order and Export' parameters. For now I have left these at the default and set them later when the files are loaded.

[画像:eclipse]

Click on 'Finish' then close the 'welcome' project, we can then see the project just setup:

[画像:eclipse]

I then copied the mjbWorld files into the workspace as shown here:

The mjbWorld files are availible from sourceforge here.

[画像:eclipse]

I then right-clicked on 'mjbworld' in Package Explorer and clicked on refresh:

[画像:eclipse]

The program files are then shown in the Package Explorer window but when using the 64bit version of Eclipse my system usually crashes with the following error (full report),

[画像:eclipse]

I have therefore used the 32 bit version of eclipse for the following. I also found that the Eclipse 3.1 seems more stable when run under java 1.4 so I start Eclipse using the following command line:

/usr/share/eclipse/eclipse -vm /usr/lib/jvm/java-1.4.2-sun-1.4.2.08/jre/bin/java

This seems reasonably relible.


We now need to tell eclipse about the JOGL library. In the menu under the Project -> Properties we can select 'Java Build Path' in the tree window and select the 'Libraries' tab. We can then click on 'Add JARs':

[画像:eclipse]

select jogl.jar

[画像:eclipse]

Click on 'Native library location'

[画像:eclipse]

click on workspace

[画像:eclipse]

click on the location where jogl.dll is located, in this case resources.

[画像:eclipse]

We can also set the Default output folder so that the main directory does not get cluttered.

[画像:eclipse]

If prompted we can click on 'yes' to move the existing outut:

[画像:eclipse]

Running the mjbWorld application

We can click on the down arrow to the right of the green arrow. Then select Run As->Java Application

[画像:eclipse]

In this case select 'mjbWorld' and then click on 'OK'. The program should then start.

[画像:eclipse]


metadata block
see also:
Correspondence about this page

This site may have errors. Don't use for critical systems.

Copyright (c) 1998-2023 Martin John Baker - All rights reserved - privacy policy.

AltStyle によって変換されたページ (->オリジナル) /