2007年 12月 11日 火曜日
[Sun SPOT (2)] Sun SPOT の NetBeans 用プラグインを入れてみる。
前回のエントリで Sun SPOT SDK のインストール方法をご紹介しましたので、早速 Sun SPOT アプリケーションを開発してみたいところですが、その前に NetBeans IDE 用のプラグインを入れてしまいましょう。今回も、Sun SPOT Manager を使ってインストールします。
[2008/02/07: 修正・追記]
Sun SPOT Java Development Kit に付属するユーザガイドに従って、Sun SPOT Managerを起動します。
なお、現時点では残念ながら NetBeans IDE 6.0 には対応していない(インストーラが?)ようですね(NetBeans 5.5 はこちらからダウンロードできます)。
NetBeans 用のプラグインをインストールすために、ここでは「SDKs」タブをクリックします。
右下の「Modules」ボタンがアクティブになっていると思いますので、クリックします。すると、インストール可能なプラグインモジュールの一覧が表示されますので、すべてチェックして「Install」ボタンをクリックします。
これで、プラグインのインストールは完了です。早速 NetBeans 5.5 を起動して確認してみましょう。
ツールバーに黒っぽい物体が表示されています。これをクリックすると、「Sun SPOTs Info」タブが表示されました。どうやらインストールできているようです。
インストールしたプラグインを使って「Sun SPOT アプリケーション」プロジェクトを作成してみます。メニューから「ファイル」->「新規プロジェクト」を選択すると、カテゴリの「一般」にSun SPOTアプリケーション用のプロジェクト
が追加されています(Sun SPOT Application は、Sun SPOTデバイス上で動作する プログラムを作成するための、また Sun SPOT Host Application はホスト上で動作(してSun SPOTデバイスと通信)するアプリケーションを作成するためのプロジェクトです)。
ここでは Sun SPOT Application を選択します。
新しいプロジェクトが作成できました。さっそくビルドしてみます。
ちなみに、Sun SPOT アプリケーションのソースコードはこんな感じです。CLDCの MIDlet そのままです。
package org.sunspotworld; // LEDのインスタンスへの参照を取得 |
# Sun SPOT上で動かしてみました
# 一番左のLEDが赤色に点灯しています

※ 画像がブレているのは気のせいです 
Posted at 01:56午後 12 11, 2007 by Shuichi Machida in SunSPOT | 投稿されたコメント[4]
こんにちは。すごく昔の記事なので見て頂けるかわかりませんが……
最近spotを手に入れてこの記事と同じようにやったのですが
デプロイしている最中に止まってしまいます。
ログは
init:
No jar.file specified.
Using "suite/SunSpotApp_1.0.0.jar"
Please wait while connected Sun SPOTs are examined...
Using Sun SPOT device on port COM3
Deleting: C:\Program Files\Sun\SunSPOT\sdk\temp\spotselector-1715080243
[loaded object memory from 'file://squawk.suite']
[loaded object memory from 'file://squawk.suite.metadata']
[loaded object memory from 'file://transducerlib.suite']
[loaded object memory from 'file://transducerlib.suite.metadata']
[translating suite image ...]
Translator properties and current values:
translator.help=false
translator.verbose=true
translator.optimizeConstantObjects=true
translator.deadMethodElimination=true
[Translator: computing closure....109ms.]
[Translator: whole-suite optimizing and inlining...16ms.]
[Translator: phase2...[Loaded org.sunspotworld.StartApplication]
15ms.]
[Including resource: META-INF/MANIFEST.MF]
[Adding property key: |Manifest-Version| value: |1.0|]
[Adding property key: |Ant-Version| value: |Apache Ant 1.6.5|]
[Adding property key: |Created-By| value: |1.5.0_15-b04 (Sun Microsystems Inc.)|]
[Adding property key: |MIDlet-Name| value: |SunSpotApp|]
[Adding property key: |MIDlet-Version| value: |1.0.0|]
[Adding property key: |MIDlet-Vendor| value: |Sun Microsystems Inc|]
[Adding property key: |MIDlet-1| value: |src/org/sunspotworld/StartApplication, , org.sunspotworld.src/org/sunspotworld/StartApplication|]
[Adding property key: |MicroEdition-Profile| value: |IMP-1.0|]
[Adding property key: |MicroEdition-Configuration| value: |CLDC-1.1|]
[loaded object memory from 'file://image.suite']
Romizer processed 1 classes and generated these files:
C:\Documents and Settings\user\SunSpotApp\image.sym
C:\Documents and Settings\user\SunSpotApp\image.suite
C:\Documents and Settings\user\SunSpotApp\image.suite.metadata
C:\Documents and Settings\user\SunSpotApp\image.suite.api
Moving 1 file to C:\Documents and Settings\user\SunSpotApp\suite
Moving 1 file to C:\Documents and Settings\user\SunSpotApp\suite
Moving 1 file to C:\Documents and Settings\user\SunSpotApp\suite
Deleting: C:\Documents and Settings\user\SunSpotApp\image.suite.api
SPOT Client starting...
(please reset SPOT on port COM3)
[waiting for reset]
[waiting for reset]
[waiting for reset] ** VM stopped: exit code = 0 **
[waiting for reset]
Sun SPOT bootloader (purple-071018)
SPOT serial number = 0014.4F01.0000.4FCB
About to flash to C:\Documents and Settings\user\SunSpotApp/suite/image
です。
ここで止まってしまっていつまで経っても配備が終わりません。
原因はなんでしょうか、教えて下さい。
Posted by hirasan on 7月月 29日, 2008年 at 09:54 午後 JST #
hirasanさん、こんにちは。
通常は、About to flash... のあと
Writing imageapp7953.bintemp(2188 bytes) to local SPOT on port COM3
...
となって書き込みが始まるのですが。。
このログを見ただけでは断言できませんが、
Sun SPOTのファームウェアが壊れているかもしれないですね。
一度、ファームウェアのアップグレードを試していただけますか?
# SPOT Manager ツールの 「Sun SPOTs」タブを選んで、「Upgrade」を選択すると実行できます。
このエントリの情報はちょっと古くなってしまっていますので、こちらの記事などもよろしければ:
http://sdc.sun.co.jp/java/series/sunspot/200806.html
Posted by machida on 7月月 30日, 2008年 at 09:05 午前 JST #
お忙しい中、わざわざお返事ありがとうございます。
ファームウェアのアップグレードに加え新潮流の記事の様に設定してからやってみましたが状況は変わりませんでした。
新潮流の記事の方をまた1から設定してみます。
Posted by hirasan on 7月月 30日, 2008年 at 12:05 午後 JST #
動きました!!
ありがとうございました。
原因はおそらくなのですが
MANIFEST.MF ファイルの修正がうまくいってなかったようです。
それ以外にも1から設定しなおしたので影響しているかもしれません。
本当にありがとうございました。
また質問するかもしれませんがその時はよろしくお願いします。
Posted by hirasan on 7月月 30日, 2008年 at 12:57 午後 JST #