Connecting our developers

Write, Run and Debug your code

Next step: Configure FlexyCore project

This section describes how to create your first Java for iPhone project in Eclipse, compile, run and debug it.

Install a new project

  1. We recommand you, at least for the first time, to check out our 'BlankProject' from the FlexyCore CVS as explain in the Compile FlexyCore sample code.
  2. Disconect this project from FlexyCore CVS:
    1. Right click on 'BlanckProject', and click on Team > Disconnect....
    2. Check Also delete the CVS meta-information from the file system.
    3. Click Yes.
  3. Rename the project with the name of your choice by selecting BlankProject and by clicking Refactor > Rename...
  4. Rename the package com.yourcompany with the name of your choice by selecting it and by clicking Refactor > Rename...
  5. Rename the class BlankDelegate with the name of your choice by selecting it and by clicking Refactor > Rename...
When you will be familiar with Java project for iPhone, you could directly create your java project, and setting up with some few configuration as explained in the next section Configure FlexyCore project

Write your code

  • First of all, in the main delegate class, insert your code inside the method applicationDidFinishLaunching, it is the entry point of your application
  • Complete with Java code in the latest Java programming language
  • Browse inside FlexyCore Libraries to navigate available classes, interfaces, fields and methods
  • Use standard Eclipse completion
  • Look at Javadoc tab to see documentation
  • Consult our sample codes at Google Code Project

Compile and Run your code

  1. To test your code, compile it for iPhone by clicking the icon in the icon bar:
Done! Your application will runs on the iPhone simulator after the compilation steps.

Note: If you do not run iSpectrum on a Mac OS X or you do not have the Apple iPhone SDK installed on your system, iSpectrum does not launch the iPhone simulator, but Objective-C source files are generated in a folder 'build' inside the Java project, and resources are copied in a folder 'res' beside. You could import these files inside an iPhone Xcode project to compile and run your application.

Note: FlexyCore Eclipse Plug'in launches, controls and quits Apple Xcode application. Do not be surprise if Xcode appears and do not quit Xcode during iSpectrum compilation steps.

Note: During the first compilation of the sample code, FlexyCore Eclipse Plug'in compiles also libraries with your installed Apple SDK compiler. This process take times, but subsequent compilations will take less time thanks to incremental compilation.

Debug sample code

  1. Toggle breakpoint(s) in sample code by selecting a line and then click on Run > Toggle Breakpoint
  2. Open debug configurations with Run > Debug configurations...
  3. Select FlexyCore and create a new configuration by pressing New button
  4. Choose the your project with Choose button
  5. Choose a Debugger Version, a stable one is recommended
properties

  1. Click Debug
Done! Your application will runs on the iPhone simulator and Eclipse switch to the Debug perspective when your application reach a breakpoint. You could now begin a debug session as usual, by example:
  • Toggle breakpoints during execution

  • Inspect local variables, fields

  • Continue, step over, step into, …

  • Break on exception
  • ...
Enjoy!

Next step: Configure FlexyCore project