Skip to main content

Notice: this Wiki will be going read only early in 2024 and edits will no longer be possible. Please see: https://gitlab.eclipse.org/eclipsefdn/helpdesk/-/wikis/Wiki-shutdown-plan for the plan.

Jump to: navigation, search

Difference between revisions of "Equinox Demos"

 
(48 intermediate revisions by 5 users not shown)
Line 1: Line 1:
==[http://www.nokiausa.com/phones/9300 Nokia 9300 Communicator]==
+
==Application Model==
 +
The [[Equinox Application Model Demo]] shows how to create and run multiple OSGi MEG applications.
  
===Local Machine Setup===
+
==API Tooling==
The first thing you need to do is ensure that your machine can talk to your phone. We used Bluetooth for our communications. We also downloaded and installed the  [http://nokia.com/pcsuite Nokia PC Suite] so we could use the File Manager tool for transfering files from your local machine to the phone.
+
  
===Java on the phone===
+
The [[API Comparison demo]] uses comparison of Eclipse SDK 3.1 and 3.2 to show how to generate reports on:
The Java VM on the phone is J9 Personal Profile 1.0 (ppro10) Well, that was the VM on ''our'' phone. :-)
+
<ul>
 +
<li>breaking API changes</li>
 +
<li>binary backward-compatible changes</li>
 +
<li>version number checks</li>
 +
</ul>
  
===Java on your local machine===
+
==Launcher Demos==
To make things easier, we set up the demos on our local machine, ensured they were working ok, and then transfered them to the phone. So the first thing we had to do was ensure that we had the right VM set up locally.
+
Demos related to the new launcher work.
* First you need to download the [[J9 | Foundation 1.0/Personal Profile 1.0 VM]].
+
* Add the VM as an Installed JRE (<code>Window -> Preferences -> Java -> Installed JREs</code>).
+
* Add the 2 extra libraries as external JARs (<code>ppro-ui.jar</code>, <code>ppro-extras.jar</code>).
+
* Add the following default VM arg: <code>-jcl:ppro10</code>.
+
  
===Running a Java application on the phone===
+
==[[Equinox Phone Demos | Phone Demos]]==
* The file-system can be referenced like Windows with <code>C:</code> and <code>D:</code> (the <code>D:</code> drive is the memory card).
+
Click [[Equinox Phone Demos | here]] to check out some of the demos that the Equinox team has done for some cool phones.  
* The J9 VM is associated with the <code>.j9</code> file-type. You create a <code>.j9</code> file with all the command-line arguments for your application and then when you click on it in the file manager it will run J9.  
+
* Setting up the [[Equinox_Phone_Demos#Nokia_9300_Communicator | Nokia 9300 Communicator]].
* The file contains everything that you want on the command line except the reference to the VM executable. e.g.
+
* Using the [[Equinox_Phone_Demos#SavaJe | SavaJe]] phone.
<pre>-cp foo.jar com.Foo</pre>
+
* ''Note:'' any arguments '''after''' the class name on the commandline are passed to the class as arguments to the application and are '''not''' interpreted by the VM. Therefore if you are trying to set system properties, it should be done early in the command-line. e.g.
+
<pre>-Dfoo=bar -cp foo.jar com.Foo</pre>
+
* Use the file manager on the phone to select the <code>.j9</code>. Opening it will launch the Java application.
+
  
===Running an Eclipse Application on the phone===
+
==Provisioning Demos==
 +
Demos related to the new provisioning story can be found here.
  
====XML====
+
==Resource Monitoring Demos==
Since Eclipse uses an XML parser to read the registry and other files, you will need to get bundles that provides the XML Parser APIs. A good candidate for this are 2 bundles (<code>org.eclipse.ercp.xml</code>, <code>org.eclipse.ercp.xmlParserAPIs</code>) which are included as part of the [http://eclipse.org/ercp eRCP] project. These two bundles are created as framework extensions so you need to tell OSGi about them by setting a system property:
+
<pre>osgi.framework.extensions=org.eclipse.ercp.xmlParserAPIs,org.eclipse.ercp.xml</pre>
+
  
====Personal Profile EE====
+
Check out the [http://www.eclipse.org/equinox/incubator/monitoring/index.php Equinox Incubator] for more information on our Resource Monitoring code. Here is a link to our [[Equinox Resource Monitoring Demo | EclipseCon 2007 demo script]].
Now when you try and run, you will likely get an exception saying that OSGi couldn't match the required Execution Environment for some of the bundles. They are looking for the Founation 1.0 EE but the current VM doesn't match this. So we need to create a new profile which looks like this:  
+
<pre>
+
org.osgi.framework.system.packages = \
+
javax.microedition.io
+
org.osgi.framework.bootdelegation = \
+
javax.microedition.io
+
org.osgi.framework.executionenvironment = \
+
OSGi/Minimum-1.0,\
+
OSGi/Minimum-1.1,\
+
CDC-1.0/Foundation-1.0,\
+
CDC-1.0/PersonalProfile-1.0,\
+
CDC-1.1/PersonalProfile-1.1
+
osgi.java.profile.name = CDC-1.0/PersonalProfile-1.0
+
</pre>
+
Next we need to set a system property for the new profile which contains a file URL to the location of the file:
+
<pre>osgi.java.profile=file:d:/temp/ppro.profile</pre>
+
  
===Writing to the Console===
+
==Server-Side OSGi==
* <code>C:/logs/j9vm</code> - You ''must'' have this directory created or your Java application will hang when it tries to write something to <code>System.out</code> or <code>System.err</code>.
+
* JSPs - there are some demos that come with Tomcat and Struts
* When you run your Java application 2 files will be created in this directory, one for <code>System.err</code> and one for <code>System.out</code>.
+
* Embedded in app server
* The files will be named <code>&lt;pid&gt;_syserr.txt</code> and <code>&lt;pid&gt;_sysout.txt</code>
+
* show the dev scenario - easy to use
* Output will always be to this directory, even if your JAR files are on a different drive.
+
  
===Extras===
+
[[Category:Equinox|Demos]]
* j9 -io:host:port
+
* console telnet
+
 
+
===Networking===
+
In order to set up the phone for a demo, we wanted an IP address. The best way to do this (since you don't know where you are going to give a demo or the network status when you are at that location) is to set up an adhoc network on your local machine and then connect to it from the phone.
+
 
+
==[http://www.savaje.com SavaJe]==
+
 
+
We also have a [http://www.savaje.com SavaJe] phone...haven't done anything very cool with it yet though.
+
 
+
===Writing a Midlet===
+
 
+
====Local Machine Setup====
+
We want to write a simple Midlet for the Jasper S20 phone. First, we need a suitable development environment to write, and test, the midlet locally on our machine. To do this, we installed [http://eclipseme.org/ Eclipse ME], a plugin for Eclipse. As the homepage states, you can install this plugin really easily by setting a remote site, with http://eclipseme.org/updates/ as the URL.
+
 
+
====Using Eclipse ME====
+
Once you have EcliseME installed, you'll need to set it up. The website provides good [http://eclipseme.org/docs/index.html documentation], but here are some highlights
+
*You'll need to set up at least one device configuation. (<code>Window -> Preferences -> J2ME -> Device Management -> Import</code>)
+
*In our case, we got the configuration file from the Midlet Toolkit 1.0 that came with the developper version of the phone. We chose the configuration with the name SavaJePhoneA
+
*EclipseME will add options to create a new Midlet Suite, and to create a new Midlet.
+
 
+
====Deploying the Midlet====
+
Once you've written a Midlet to your satisfaction, you may want to test it on an actualy phone. To deploy your midlet, bring up the context menu on your Midlet project, and select <code>J2ME -> Create Package</code>
+
 
+
In your midlet project, there should be a folder called deployed. In that folder, there should now be two files [project name].jad, and [project name].jar. Place these two files in a directory, on your phone's memory expansion card, called MidletInstall (We placed the two files in a subdirectory named after the project, but I'm not sure what effect, if any, this had). Next replace the memory card back in your phone, and open the Application Manager in the Utilities menu. You should see your Midlet in the list of applications to install.
+
 
+
===Writing an Xlet===
+
 
+
====Local Machine Setup====
+
There isn't currently an eclipse plugin for creating Xlets, so a little more manual work is required. First, we got a suitable JRE. We chose to use Personal Profile 1.1, which we downloaded using instructions from the [http://wiki.eclipse.org/index.php/J9 J9 page]. The only difference is that in step 7 we chose 1.1, isntead of 1.0. Also take note of the last part of that article, Foundation 1.1. It applies to Personal Profile 1.1 as well. Once you install this JRE into eclipse, you'll probable need to add ppro-extras.jar, and ppro-ui.jar, using <code>Add External Jar</code>. Ppro-ui.jar, in particular contains the Xlet class, which your main class needs to extend.
+
 
+
====Using Elcipse====
+
To set up a project in our workspace, we created a standard Java project, and chose PPRO1.1 as the associated JRE. Our particular project required Swing classes, so we added SavaJeDevelopper.jar as a library (This came with the developper version of the phone). When writing an Xlet your main class should extend the Xlet class.
+
 
+
====Deploying the Xlet====
+
To run your Xlet on the phone, create a directory called savaJe/bundles on the memory expansion card. Inside this directory create a directory named after your Xlet project. Inside this directory, you'll need a file called bundle.jnlp, a file called bundle.policy, and a fodler called lib. Next, export your Xlet project as a JAR file. You will not need to expoert the .classpath or .project files, os uncheck those. Name the file classes, and choose to export it to your lib directory.
+
 
+
====.policy file====
+
My .policy file looked like this:
+
grant codeBase "sb:/VmCheck/lib/classes.jar" {
+
  permission java.security.AllPermission;
+
};
+
 
+
VmCheck is the name of the directory We created in savaJe/bundles, it's also the directory containing the .policy file. You should modify your .policy appropriately.
+
 
+
====.jnlp file====
+
My .jnlp file looked like this:
+
<?xml version="1.0" encoding="utf-8" ?>
+
<jnlp codebase="sb:///VmCheck/">
+
 
+
  <resources>
+
    <j2se version="1.4+"/>
+
    <jar href="lib/classes.jar"/>
+
  </resources>
+
 
+
  <information>
+
    <title>VmCheck</title>
+
    <vendor>Vendor</vendor>
+
    <description>Hello</description>
+
  </information>
+
 
+
  <application-desc main-class="org.eclipse.savaje.simplexlet.SimpleXlet">
+
  </application-desc>
+
 
+
</jnlp>
+
 
+
*The <jnlp codebase> tag contains the name of the root directory for the Xlet.
+
*the <jar href> is a relative url to your exported project, from the root directory
+
*the main-class in the <application-desc> tag is the name of your Xlet class within the JAR file.
+
 
+
We're not entirely sure how strictly you have to adhere to conventions like having the lib directory, and the JAR file being called classes.jar, but we had some difficulty getting our test program to work, so we decided to follow the conventions established in the example Xlets that came with our phone.
+

Latest revision as of 12:16, 22 March 2007

Application Model

The Equinox Application Model Demo shows how to create and run multiple OSGi MEG applications.

API Tooling

The API Comparison demo uses comparison of Eclipse SDK 3.1 and 3.2 to show how to generate reports on:

  • breaking API changes
  • binary backward-compatible changes
  • version number checks

Launcher Demos

Demos related to the new launcher work.

Phone Demos

Click here to check out some of the demos that the Equinox team has done for some cool phones.

Provisioning Demos

Demos related to the new provisioning story can be found here.

Resource Monitoring Demos

Check out the Equinox Incubator for more information on our Resource Monitoring code. Here is a link to our EclipseCon 2007 demo script.

Server-Side OSGi

  • JSPs - there are some demos that come with Tomcat and Struts
  • Embedded in app server
  • show the dev scenario - easy to use

Back to the top