Getting Started with Eclipse

In this section you'll learn how to install Eclipse, install the RoboVM Eclipse plugin, activate your commercial license, and create and run your first iOS application.

Installing Eclipse

With all the prerequisites out of the way, proceed to download a recent Eclipse build from Eclipse comes in many different flavors, the Eclipse IDE for Java Developers package is sufficient for RoboVM development. Simply download the package, decompress it, and copy the resulting folder int /Applications/.

There are some important steps that must be completed in order to properly setup Eclipse for working with RoboVM.

  1. Eclipse MUST be run using Oracle’s Java SE 7 JDK or later. Apple’s Java 6 JVM will not work. Running Eclipse itself in Java 7 is not the same as adding a Java 7 JRE to Eclipe's Installed JREs dialog in Preferences. To check which Java version Eclipse is running in go to Eclipse -> About Eclipse, then click Installation Details and open the Configuration tab. Find the java.version property and make sure it is 1.7 or higher.

  2. The default max heap setting for Eclipse may be too low. In order to increase it you need to change the -Xmx setting used when launching Eclipse. To do this locate your Eclipse installation folder, right-click the Eclipse file and select Show Package Contents. Open the eclipse.ini file located in Contents/MacOS in a text editor and change the -Xmx value to 2G or more. Restart Eclipse.

Installing the Plugin

With Eclipse installed and setup, you can now install the RoboVM Eclipse plugin by selecting Install New Software from the Eclipse Help menu, enter the following update site into the Work with field and click Next:

Eclipse Install New Software dialog

Follow the on-screen instructions until installation is complete and restart Eclipse.

NOTE: You can use a nightly build by using as the software site instead of the one listed above.

Activating your License

You have to active the license for use on your computer. Activating the license will enable the features you purchased. Select License Manager from the Eclipse RoboVM menu and enter your license key.

License Manager dialog

Creating a Project

You can now create your first RoboVM project! Select File -> New -> RoboVM iOS Project. The project wizard will appear:

New Project Wizard

Perform these steps to define your project:

  1. Fill in your Project Name
  2. From the Template combobox select RoboVM iOS App without storyboards
  3. Specify the package and name of your Main Class, e.g. com.mycompany.myapp.Main
  4. Specify the App Name. This is the name used when your app is installed to an iOS device or simulator
  5. Specify the App ID. This must be a unique identifier, usually your package name
  6. Click Finish

Running & Debugging

You can run or debug a RoboVM app on either the simulator or a provisioned device connected via USB, directly from within Eclipse. Right click the project in the package or project view, select Run As or Debug As, then select which platform you want to run/debug the app on.

Running & Debugging from within Eclipse

NOTE: The first time you run your application on the simulator or the device, RoboVM has to compile not only the classes of your app, but also any runtime classes required by your code. This can take some time. The next time you compile your app, RoboVM will only recompile the classes that have changed since the last compilation. You can view RoboVM's progress in the RoboVM console view.

Debugging on the simulator in Eclipse

When starting you app in debug mode, you have the full debugging tools of Eclipse at your disposal: you can set breakpoints, step into/out/over source lines, inspect and set variables and even use Eclipse's display view

Unit Testing

RoboVM supports running and debugging JUnit tests for console and simulator apps. Let's add a new unit test to our project.

Create a new source folder which will contain all your unit tests by right clicking the project and selecting File -> New -> Source Folder. In the dialog, enter src/test/java, then click Finish. Copy the following source code to your clipboard, then select the src/test/java folder in Eclipse and paste the clipboard contents.

import static org.junit.Assert.*;
import org.junit.Test;

public class MyIOSUnitTest {
    public void test() {
        fail("Not yet implemented");

We have not yet added JUnit as a dependency to our project, so you will see compilation errors. Move your cursor somewhere on the line that reads @Test of the file, then press CMD+1 and select Add JUnit 4 libray to the build path.

You can now run this unit test by right clicking the file in Eclipse, then select Run As or Debug As, followed by iOS Simulator JUnit Test.

Unit testing in Eclipse


Once your are happy with your app and have tested it on multiple devices, it's time to publish it to the App Store. For this you need to create an iOSApplication Archive(IPA). To do so from within Ecipse, right click your project, then select RoboVM Tools -> Package for Ad-hoc/App Store distribution....

IPA export for ad-hoc and App Store distribution

Specify the output directory, your signing identity and provisioning profile and click Finish. You will find a file with the extension .ipa in the output directory, which is ready to be uploaded to iTunes Connect via the Application Loader.

NOTE: Please refer to Apple's documentation on how to submit your application.

results matching ""

    No results matching ""