Search |
||
Starting with Sun SPOT using NetBeans 6.1Posted by brunogh on April 11, 2008 at 9:41 PM PDT
If you do not have a Sun SPOT (Figure 1), do not be bored, you can still have a lot of fun! In this entry, I gonna explain how to start programming the world using NetBeans 6.1! ![]() Figure 1: Sun SPOT rulez!!! Downloading NetBeans IDE 6.11. Download NetBeans IDE 6.1 (RC1 launched today). A lot of new nice features, take a look in the New and Noteworthy and in the release page for a detailed list. Installing Sun SPOT plugin2. Install Sun SPOT plugin into NetBeans. Download com-sun-sunspot-updatecenter.nbm. Now, in NetBeans, go to: Getting Sun SPOT SDK 3.0 Beta3. Get the Sun SPOT SDK 3.0 Beta emailing David Simmons, more details here. You will receive a link to download SPOTManager tool, that is a jar that installs the SDK and can run the emulator. Be sure you have at least JDK 1.5 and at least Ant 1.6.5 installed and configured in your system. Creating the Demo Application4. Let's make the default demo application work. Go to:
protected void startApp() throws MIDletStateChangeException {
System.out.println("Hello, world");
new BootloaderListener().start(); // monitor the USB (if connected) and recognize commands from host
long ourAddr = Spot.getInstance().getRadioPolicyManager().getIEEEAddress();
System.out.println("Our radio address = " + IEEEAddress.toDottedHex(ourAddr));
ISwitch sw1 = EDemoBoard.getInstance().getSwitches()[EDemoBoard.SW1];
leds[0].setRGB(100,0,0); // set color to moderate red
while (sw1.isOpen()) { // done when switch is pressed
leds[0].setOn(); // Blink LED
Utils.sleep(250); // wait 1/4 seconds
leds[0].setOff();
Utils.sleep(1000); // wait 1 second
}
notifyDestroyed(); // cause the MIDlet to exit
}
List 1: startApp code. Running the Demo Application in the emulator5. Put this application to run in the emulator. ![]() Figure 3: NetBeans 6.1, ToolManager, Emulator and the red LED blinking! Where I go next?In NetBeans, check the Sun SPOT Info, that you have installed with the plugin, by clicking in the Window menu. ![]() Thanks! Have a nice weekend! Program the world! Bruno Ghisi »
Related Topics >>
Mobile and Embedded Comments
Comments are listed in date ascending order (oldest first)
Submitted by brunogh on Mon, 2008-06-23 05:16.
Hello Sandra, I am not sure about your problem, maybe you should try the forum (https://www.sunspotworld.com/forums/viewforum.php?f=32&sid=aa58689815aeb...). Thanks.
Submitted by mcqueen_bochum on Mon, 2008-06-16 00:47.
thanks a lot ! I am first use this software.installing is OK!but Emulator does't not work>"Error: connection to Squawk VM was never established. Cannot run MIDlets on virtual SPOT"this comment exists when I run Emulator ,how to solve this problem.thank you again.
Submitted by brunogh on Mon, 2008-06-16 05:09.
Hello! Try to post this error on SunSPotWorld Forum too (https://www.sunspotworld.com/forums/viewforum.php?f=32&sid=aa58689815aeb...), maybe more people can help. Thanks.
Submitted by ssandra on Mon, 2008-06-23 03:01.
I have a problem running SPOTs' Emulator. I have tried almost everything that I have read in the blogs, but still I am getting the same error:
Buildfile: C:\Sun\SunSPOT\sdk\build.xml
-pre-init:
-do-init:
-post-init:
init:
-set-basestation-not-required:
-set-selector-for-host-run:
-override-warning-find-spots:
-prepare-conditions-for-find-spots:
-find-shared-basestation:
-run-spotfinder:
-decide-whether-to-run-spotselector:
-run-spotselector:
-collect-spotselector-result:
-clean-up-spotselector-output-file:
-spotselector-fail:
-decide-whether-to-start-basestation-manager:
-start-new-basestation-manager:
-do-find-spots:
-do-run-spotworld:
[echo] Java Runtime Environment version: 1.6.0_06
[java] Port dummyport unavailable... retrying...
[java] [Emulator System.err] Cannot load C:\Program Files\Java\jdk1.6.0_06\jre\bin\server
[java] [Emulator System.err] Please add the directory containing jvm.dll to your PATH
[java] [Emulator System.err] environment variable or set the JVMDLL environment variable
[java] [Emulator System.err] to the full path of this file.
[java] [Emulator System.err] Warning: Error creating Java VM -- I/O subsystem will be disabled
[java] [Emulator System.err] Uncaught exception in Thread.run():
[java] [Emulator System.err] on thread com.sun.spot.emulator.Emulator - main
[java] [Emulator System.err] java.lang.Error: IO error while loading suite from 'file://C:/Sun/SunSPOT/sdk\lib\emulator.suite': java.io.IOException: no native I/O peer for isolate
[java] [Emulator System.err] at java.lang.Throwable.(bci=16)
[java] [Emulator System.err] at java.lang.Throwable.(bci=5)
[java] [Emulator System.err] at java.lang.Error.(bci=6)
[java] [Emulator System.err] in static method #3 of com.sun.squawk.Suite(bci=72)
[java] [Emulator System.err] in static method #4 of com.sun.squawk.Suite(bci=6)
[java] [Emulator System.err] in virtual method #40 of com.sun.squawk.Isolate(bci=41)
[java] [Emulator System.err] at com.sun.squawk.Isolate.run(bci=46)
[java] [Emulator System.err] at java.lang.Thread.run(bci=17)
[java] [Emulator System.err] in virtual method #47 of com.sun.squawk.VMThread(bci=38)
[java] [Emulator System.err] in static method #3 of com.sun.squawk.VM(bci=6)
[java] [Emulator System.err]
[java] [Emulator System.err]
[java] [Emulator System.err] --------------------------------------------------------------------
[java] [Emulator System.err] Hits - Class:93.10% Monitor:90.23% Exit:100.00% New:99.86%
[java] [Emulator System.err] GCs: 0 full, 0 partial
[java] [Emulator System.err] ** VM stopped: exit code = 1 **
[java] Port dummyport unavailable... retrying...
[java] Port dummyport unavailable... retrying...
[java] Port dummyport unavailable... retrying...
[java] Port dummyport unavailable... retrying...
[java] Available ports: COM1 COM2 LPT1
[java] Error connecting to Squawk VM: java.net.SocketTimeoutException: Accept timed out
[java] Error: connection to Squawk VM was never established. Cannot run MIDlets on virtual SPOT
[java] Error: connection to Squawk VM was never established. Cannot run MIDlets on virtual SPOT
spotworld:
BUILD SUCCESSFUL
Total time: 2 minutes 2 seconds
Can you help me to solve the problem?
Thanks,Sandra
|
||
|
|