wiki:SetUp

Setting up GeoGebra's development environment

This page will guide you through the initial setup of  Eclipse to start. Please read the licence information before developing.

Please allow 1 hour to complete the installation process below.

Quickstart

If you are familiar with Eclipse then you will probably be able to follow this, otherwise more detailed instructions are below.

You must use this version of Java to develop GeoGebra

  • Install the latest version (Sept 2011) of Eclipse IDE for Java Developers. Run Eclipse with the right  permissions set, on Windows: run Eclipse as administrator.

 http://www.eclipse.org/downloads/

  • Install JavaCC

Help -> Install New Software ->  http://eclipse-javacc.sourceforge.net/

  • Install Subclipse (not Subversive)

Help -> Install New Software ->  http://subclipse.tigris.org/update_1.8.x for Windows (for other systems please read the detailed instructions below)

  • Install the GWT plugin (you need Google Plugin for Eclipse and SDKs)

Help -> Install New Software ->  http://dl.google.com/eclipse/plugin/3.7

  • Disable Project -> Build Automatically.
  • Package Explorer -> Project “desktop” -> kickstart.xml -> Right click -> Run As... -> 2 Ant Build...-> Build tab -> disable "Build before launch" -> Run -> Console “BUILD SUCCESSFUL”
  • Package Explorer -> Project “desktop” -> refresh (F5)
  • To run GeoGebra 4.2 Beta: Package Explorer -> Project “desktop” -> geogebra -> GeoGebra.java -> Run as -> Java Application
  • To run GeoGebra 5.0 Beta: Package Explorer -> Project “desktop” -> geogebra -> GeoGebra3D.java -> Run as -> Java Application

Detailed Instructions

Installing JDK 1.5

Install JDK 1.5.22 from  oracle.com

You must use this version of Java to develop GeoGebra - Why?

If you install this after installing Eclipse then you need to add it by going to "Window" -> "Preferences" menu item. Go to the "Installed JREs" section in the "Java" category.

JRE preferences dialog of eclipse

Now click on the "Add..." button and select "Standard VM" on the first page of the dialog. On the second page specify the path of your JDK home directory

Installing Eclipse

To install Eclipse just download  Eclipse IDE for Java Developers for your operating system. Further informations about the installation procedure can be found at  eclipse.org. Run Eclipse with the right  permissions set, on Windows: run Eclipse as administrator.

JavaCC in Eclipse

GeoGebra uses the JavaCC parser generator. Install it in Eclipse by going to the "Help" menu, "Install New Software...", and type  http://eclipse-javacc.sourceforge.net/ into the "Work with" text box then press <enter>. Tick the check box next to JavaCC Eclipse Plug-in and then click the "Next" button until the installation is finished.

SVN in Eclipse

It is important that you use the Subclipse plugin when developing GeoGebra as the Subversive plugin (which was used by us until now) does not support some things that are needed. Install it in Eclipse by going to the "Help" menu, "Install New Software...", and type  http://subclipse.tigris.org/update_1.8.x into the "Work with" text box then press <enter>. (If you need a different version than 1.8.x, then use that one instead; see below.) Tick the check boxes next to Optional JNA Library (recommended) and Subversion and then click the "Next" button until the installation is finished.

For Linux users: Please take the time to visit the  official Subclipse info page about JavaHL. First a package must be installed (e.g. libsvn-java for Ubuntu) and depending on its version number the appropriate Subclipse plugin version must be installed for Eclipse (e.g. 1.6.x for the recent Ubuntu versions).

Installing the GWT plugin

Install it in Eclipse by going to the "Help" menu, "Install New Software...", and type  http://dl.google.com/eclipse/plugin/3.7 into the "Work with" text box then press <enter>. Tick the check boxes next to Google Plugin for Eclipse and SDKs and then click the "Next" button until the installation is finished.

Create project from SVN

Before creating a project, it is mandatory to switch off the automatic building feature of Eclipse. Currently the .classpath file will not be present before downloading the 3rd party libraries, and Eclipse wants to do the compilation process without them if it is not stopped in advance. So simply disable this by clicking "Project" -> "Build automatically" (the checkbox or pipe should disappear then).

Now create a new project using the "File" -> "New" -> "Project.." menu item. Don't use the "Java Project" item! Select the "SVN" category in the appearing dialog, select "Checkout Projects from SVN" and continue with the dialog.

Select "Create new project repository location" and enter the URL of the GeoGebra SVN on the next page: http://www.geogebra.org/svn/trunk/geogebra. On the next page at "Select Folder" select these three folders (<Ctrl>Click): common, desktop, web. On the next page enter your authentication information if you already have some, otherwise just "Finish".

Now some time is required to download the source files from the GeoGebra SVN server. It may take a few minutes, depending on your network connection and the load of the SVN server.

Downloading 3rd party libraries

Now go to the desktop project and select the kickstart.xml file by right-clicking and choose "Run As" -> "2 Ant Build...", then go to the Build tab and disable the checkbox for "Build before launch". Now click "Apply" and "Run". This will download all needed 3rd party libraries from the GeoGebra web server, and does some additional file movements. You then need to refresh the files in the Package Explorer (by clicking the project name: "desktop", and pressing F5, for example). A message will also be shown in the Console window to do that.

Compiling GeoGebra for the first time and running it in Eclipse

GeoGebra 4.2 Beta will not compile automatically by default, except if you re-enable it in Eclipse. However, you don't have to do that, just select the file "geogebra/GeoGebra.java" from the "desktop" project and choose "Run as" -> "Java Application" from the "Run" menu or toolbar icon. To run GeoGebra 5.0 Beta use "geogebra/GeoGebra3D.java" instead.

If GeoGebra is starting properly in a new window, then you were successful: you can start your work by developing in Eclipse. Congratulations! You can stop reading here and start Java programming.

Building GeoGebra JAR files

If you are a GeoGebra developer, this is normally not needed. You can safely ignore this section if you do not want to create JAR files for GeoGebra.

To learn more on building GeoGebra, please read BuildingProcess. For Eclipse related notes please read this part of that page.

Eclipse ticket integration

From this section the steps are optional.

If you finished the basic setup of eclipse above you probably should take another step if you're actively developing GeoGebra. Eclipse allows you to seamlessly integrate the trac issue tracker into your workspace, hence you can view, create, comment or modify tickets in trac from your eclispe workspace without having to switch to the browser. First of all activate the eclipse "Task List" view from the "Window" -> "Show View" -> "Task List" menu item if it's not already visible.

task list menu entry

Now click on the left-most icon of the Task List view and choose "Add Repository.." from the appearing menu.

Add repository

A new dialog should appear. By default the "trac" repository connector isn't installed hence you have to click the "Install More Connectors..." button and install the Trac connector. (Note: If this installation doesn't work for you out of the box, please add the main Mylyn update site  http://download.eclipse.org/tools/mylyn/update/e3.4 as well as the Mylyn Extras update site  http://download.eclipse.org/tools/mylyn/update/extras in Eclipse, Help, Install Software... in order to install the latest version of the Mylyn Task List feature and the Trac connector.)

After installation select the "Trac" repository type and continue. As URL use "http://www.geogebra.org/trac" and enter your trac credentials if you have some. As "Access Type" choose "XML-RPC" (important!) and the "Task Editor Settings" should be set to "TracWiki". Finish the dialog.

GeoGebra Trac repository info

Fully explaining the capabilities of this plugin, called Mylyn, is way out of the scope of this tutorial. It's really recommended to take a look at  the official plugin website. The Task List view is a first starting point where you can create new tasks directly from within eclipse or create Queries, which are basically filtered task lists from trac which are automatically updated for you.

Task menu with options to add tasks and to create queries

The future for setting up a GeoGebra development environment

See the SetUpMaven page for details.

Compiling from the Command Line (unsupported)

To learn how to compile GeoGebra from command line, please read SetUpCommandLine.

Developing GeoGebra using Java version >= 6

For some people it is rather difficult to use Java 1.5 because of several reasons. For example, Mac OS X Lion users cannot obtain a 64-bit package for Java 1.5. To work around this problem, it is still possible to use a newer Java version, but the compiler compliance level must be set to 1.5.

You can set this in Eclipse by changing compliance level at Window -> Preferences -> Java -> Compiler. You can even set this a per project basis by enabling project specific settings. Please make sure that both the "desktop" and the "common" project require Java 1.5 compliance level.

Caution: When you work with Java >= 6, please be extremely careful and don't use any version specific features. If you commit a Java 6 or Java 7 specific code, you will break the autobuild process, and GeoGebra cannot be packaged any longer (since for packaging Java 5 is used) until you revert your changes or find a workaround to substitute your version specific code with a Java 5 compatible way.

Compiling the "web" version

This page focused on the desktop version of GeoGebra, which can be run by using a Java Runtime Environment (Java RE). If you are interested in compiling the web version (which can be run in a modern web browser without Java installed), please read the compilation section for the "web" version here, too. Remember that the "web" version is in pre-alpha stage and has just a limited functionality yet.

Troubleshooting

The project 'common' does not have any App Engine / GWT SDKs on its build path

Go to Project -> Properties -> Java Build Path -> Libraries, click on any that are "[unbound]", Click "Edit..." and select the correct one from the drop-down menu.

Parser / ParseException cannot be resolved to a type

Right-click on common/geogebra.common.kernel.parser.Parser.jj and select "Compile with JavaCC"

java.lang.UnsupportedClassVersionError: Bad version number in .class file

You must be working with multiple Java versions and use the wrong compliance level. Please set it to 1.5 for the "desktop" and the "common" projects.

Attachments