Skip to content
This repository has been archived by the owner on Sep 18, 2018. It is now read-only.

Latest commit

 

History

History
86 lines (59 loc) · 3.46 KB

README.md

File metadata and controls

86 lines (59 loc) · 3.46 KB

Starter kit for a new generation of hybrid applications

Description

If you follow the following steps, you will build gwt, javascript and Objective-C calculators. These calculators are built from a single java code base.

This demo illustrates what Ray Cromwell call a new generation of Hybrid applications :

Requirements

  • Java 6 (Java 7 syntax is not yet supported)
  • Maven
  • Android : The Android SDK
  • XCode and the command line compiler tools for the Mac OS part.

J2Objc installation

Example :

export J2OBJC_DISTRIBUTION=/Users/abdennebi/Dev/Tools/j2objc-0.8.8

##Testing

  • Run `mvn install' at the root directory. Then follow the next steps :

Testing GWT

  • Go to demo/calc-engine-gwt-demo directory
  • Run command mvn jetty:run-war
  • Open your internet browser and call the following URL : http://localhost:9999/
  • To stop jetty, run the command mvn jetty:stop

Testing Javascript

  • Go to demo/calc-engine-js-demo directory
  • Run command mvn jetty:run-war
  • Open your internet browser and call the following URL : http://localhost:9999/
  • Read and follow the displayed indications
  • To stop jetty, run the command mvn jetty:stop

Testing Chrome App

  • Go to demo/calc-engine-js-demo directory
  • Run command mvn package
  • Launch your Chrome Browser and bring up the extensions tab by taping chrome://extensions/ in the address bar.
  • Make sure the Developer mode checkbox has been checked.
  • Click the Load unpacked extension button, navigate to the demo/calc-engine-js-demo/target/calc-engine-js-demo-1.0-SNAPSHOT/ folder, then click OK.
  • The application is installed, you can now launch it by clicking on its icon in the Applications panel.

Testing Android

Setup

  • Download and install the Android SDK
  • Set the ANDROID_HOME environment variable that points to the installation directory of the Android SDK.
  • Add $ANDROID_HOME/tools and $ANDROID_HOME/platform-tools to yourPATH.
  • Launch an Android Virtual Device or plug your Android phone (tutorial can be found here).

Testing

  • Go to demo/calc-engine-android-demo directory
  • Run command mvn clean package android:deploy

Testing Objective-C

Don't forget to define the J2OBJC_DISTRIBUTION environment variable!

  • Go to demo/calc-engine-objectivec-demo directory

  • Run make, it will create two executables : one called launcher and other called calc

    • the launcher executes any Java class containig a main function. In our case the class is CalcMain. The full command is ./launcher com.sfeir.calc.CalcMain expression. Example ./launcher com.sfeir.calc.CalcMain 36+69.
    • the calc executable corresponds to the native code that references the transcompiled Javacode. Please take a look to the main.m source file.
  • to clean objects run make clean, to remove executables run make mrclean

Improving the Calculator

  • Edit calc-engine-core/src/main/java/com/sfeir/calc/CalcEngineImpl.java
  • Rebuild, that's it