Prepare your computer to write Sunspot code

Note: These instructions are mainly for students of DIT (UoA).

Summary of what you are going to install to your computer:

  1. virtualbox
  2. virtualbox extensions

You will install the following software inside the VM:

  1. IObit unlocker

Although you may use Windows or MAC OS as an operating system for your development computer, as a beginner it is recommended that you use a Linux-based distribution.

If you haven’t installed the OS read this article.

Here are the steps:

1) Update the repository (?)

sudo apt-get update

2) Install virtual box (?)

You can easily install virtual box via command line:

$ sudo apt install virtualbox 
$ sudo apt install virtualbox-ext-pack

In windows you just download and run the executable. Virtual box is a very stable software so you should not worry about encountering any problems at this point.

4) Download and import the OVA file

Download the OVA (Open Virtualization Format file) file provided by your instructors. You may have to use a VPN in order to do so. The specific OVA file cannot be offered for download by this site since it contains copyrighted software.

Once you download the image you should import it from within virtual box. In order to do so:

  1. Open VirtualBox
  2. Open menu item: File Import appliance
  3. Select the ova file and import it (it may take a while if you have a slow computer)

Virtual box will create a virtual machine and configure everything for you. You do not have to make any changes to the virtual machine.

For screenshots on how to import an .ova you can refer to this article.

5) Software not to install

The provided OVA already contains an IDE  (netbeans), a web browser (firefox) and a powerful text editor (ps-pad). You don’t need anything else.

If a notification prompts you to update netbeans, do NOT do so, as this may cause incompatibility issues with Solarium. You may update firefox or pspad if you wish though.

6) Recommended additional software

The following software is useful:

  1. IObit Unlocker
  2. Double commander (optional)

You need unlocker because the VM sometimes locks the jar files deployed in Solarium and netbeans cannot delete them (i.e. during a Clean & build). You could restart Solarium in order to unlock the jar files, but if you have configured many SunSpots it could be troublesome. Instead of restarting solarium, you can simply run unlocker and unlock the jar file(s). Then you can clean & build from within netbeans.

The generated jar files are located in …/suite/ subdirectory inside the project you are compiling.

 

7) Final advice

First, J2ME does not contain a fully implemented math library. So if you want to calculate power or logarithms you may have to do one the following:

  1. You can use a custom implementation like this one
  2. You can use the non standard MathUtils library of the squawk library (included in SunSPOT API):
import com.sun.squawk.util.MathUtils;

Since MathUtils is included by Sun itself, it is the recommended approach.

Here are some important directories inside the virtual machine:

Installation directory of SunSpot SDK C:\Program Files\Sun\SunSPOT\sdk\
Demos C:\Program Files\Sun\SunSPOT\sdk\Demos
Code samples C:\Program Files\Sun\SunSPOT\sdk\Demos\CodeSamples
Starting template C:\Program Files\Sun\SunSPOT\sdk\Demos\CodeSamples\SunSpotApplicationTemplate

Instead of starting a new project from scratch, you should copy the SunSpotApplicationTemplate project to another directory and start from there.

If you do decide to start from scratch you will have to write a couple of XML files which definitely does not worth neither the effort nor the time for this specific assignment.

 

Leave a Reply