Jump to: navigation, search

Difference between revisions of "Equinox Demos"

(Running an Eclipse Application on the phone)
Line 27: Line 27:
  
 
====XML====
 
====XML====
* 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.
+
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:  
* 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>
 
<pre>osgi.framework.extensions=org.eclipse.ercp.xmlParserAPIs,org.eclipse.ercp.xml</pre>
  
 
====Personal Profile EE====
 
====Personal Profile EE====
* 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:  
+
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>
 
<pre>
 
org.osgi.framework.system.packages = \
 
org.osgi.framework.system.packages = \
Line 46: Line 45:
 
osgi.java.profile.name = CDC-1.0/PersonalProfile-1.0
 
osgi.java.profile.name = CDC-1.0/PersonalProfile-1.0
 
</pre>
 
</pre>
* Next we need to set a system property for the new profile which contains a file URL to the location of the file:  
+
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>
 
<pre>osgi.java.profile=file:d:/temp/ppro.profile</pre>
  

Revision as of 09:44, 22 September 2006

Nokia 9300 Communicator

Local Machine Setup

  • Download and install the Nokia software.
  • Ensure you can use Bluetooth to connect to the phone from your PC.
  • The File Manager tool is useful for transferring files from your local machine to the phone.

Java on the phone

  • the Java VM on the phone is J9 Personal Profile 1.0 (ppro10)
  • well, that was the VM on our phone :-)

Java on your local machine

  • to mimic the phone's VM on your local machine
    • download the Foundation 1.0/Personal Profile 1.0 VM
    • add the VM as an Installed JRE (Window -> Preferences -> Java -> Installed JREs)
    • add the 2 extra libraries as external JARs (ppro-ui.jar, ppro-extras.jar)
    • add the following default VM arg: -jcl:ppro10

Running a Java application on the phone

  • The file-system can be referenced like Windows with C: and D: (the D: drive is the memory card).
  • The J9 VM is associated with the .j9 file-type. You create a .j9 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.
  • The file contains everything that you want on the command line except the reference to the VM executable. (e.g. -cp foo.jar com.Foo)
  • 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. -Dfoo=bar -cp foo.jar com.Foo)
  • Use the file manager on the phone to select the .j9. Opening it will launch the Java application.

Running an Eclipse Application on the phone

XML

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 (org.eclipse.ercp.xml, org.eclipse.ercp.xmlParserAPIs) which are included as part of the eRCP project. These two bundles are created as framework extensions so you need to tell OSGi about them by setting a system property:

osgi.framework.extensions=org.eclipse.ercp.xmlParserAPIs,org.eclipse.ercp.xml

Personal Profile EE

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:

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

Next we need to set a system property for the new profile which contains a file URL to the location of the file:

osgi.java.profile=file:d:/temp/ppro.profile

Writing to the Console

  • C:/logs/j9vm - You must have this directory created or your Java application will hang when it tries to write something to System.out or System.err.
  • When you run your Java application 2 files will be created in this directory, one for System.err and one for System.out.
  • The files will be named <pid>_syserr.txt and <pid>_sysout.txt
  • Output will always be to this directory, even if your JAR files are on a different drive.

Extras

  • j9 -io:host:port
  • console telnet

SavaJe

We also have a SavaJe phone...haven't done anything cool with it yet though.