1 / 16

Eclipse での MIDP 開発

Eclipse での MIDP 開発. 必要なもの. Java 2 Standard Edition (J2SE) Runtime Environment(JRE) < 説明省略 > Java 2 Micro Edition (J2ME) Wireless Toolkit (WT) Eclipse < 説明省略 > Eclipse Language Pack < 説明省略 > EclipseME. 目次. 1. EclipseME 1.1. EclipseME  のインストール 1.2. EclipseME  のオンラインインストール

xannon
Télécharger la présentation

Eclipse での MIDP 開発

An Image/Link below is provided (as is) to download presentation Download Policy: Content on the Website is provided to you AS IS for your information and personal use and may not be sold / licensed / shared on other websites without getting consent from its author. Content is provided to you AS IS for your information and personal use only. Download presentation by click this link. While downloading, if for some reason you are not able to download a presentation, the publisher may have deleted the file from their server. During download, if you can't get a presentation, the file might be deleted by the publisher.

E N D

Presentation Transcript


  1. EclipseでのMIDP開発

  2. 必要なもの • Java 2 Standard Edition (J2SE) Runtime Environment(JRE) <説明省略> • Java 2 Micro Edition (J2ME) Wireless Toolkit (WT) • Eclipse <説明省略> • Eclipse Language Pack <説明省略> • EclipseME

  3. 目次 • 1.EclipseME • 1.1. EclipseME のインストール • 1.2. EclipseME のオンラインインストール • 2. J2ME Wireless Toolkit 2.2 • 3. デバックの設定 • 4. プロジェクトの作成 • 5. プログラムの作成 • 6. ProGuardの設定

  4. 1.1.EclipseME のインストール • http://eclipseme.org/ • Downloads ページ • Download後、中に入っている「fearures」、「plugins」をフォルダごと既存のeclipseフォルダに上書き

  5. 1.2.EclipseME オンラインインストール • Eclipse起動 • ヘルプ→ソフトウェア更新→検索とインストール • 「新規リモート・サイト」 • 名前: Eclipse更新など • URL: http://www.eclipseme.org/updates/ • 追加したサイトにチェック確認して「終了」 • サイト情報の検索が始まる • 再び現れたダイアログにEclipseMEがあるはずなのでチェックをつけて「次へ」 • ライセンス同意事項の表示が出るので、チェックして「終了」 • セキュリティの警告が出るのでそのまま「インストール」 • Eclipse再起動 • 再起したらウィンドウメニュー→設定を選んでJ2MEの項目があれば成功

  6. 2.J2ME Wireless Toolkit 2.2 • http://java.sun.com/products/sjwtoolkit/ja_download-2_2.html • 上記リンク先からインストーラーを入手して実行

  7. 2.1.J2ME Wireless Toolkitとの関連付け • Eclipse 「ウィンドウ→設定」 • 設定ウィンドウツリー「J2ME→Device Management」 • DeviceManagement → Import • Specify search directoryにJ2ME Wireless Toolkitが含まれるフォルダを指定し 「Refresh」 • デフォのままならC:\WTK22 かな・・・ • 検索結果から関連付けたいJ2MEWirelessToolkitnoデバイス(DefaultColorPhoneなど)を選択し、終了 • Device Management画面に戻ったらOK

  8. 4. プロジェクトの作成 • Eclipse ファイル→新規→プロジェクトを選択肢、開いたダイアログのツリー「J2ME→J2ME Midlet Suite」を選択し、次へ • プロジェクト名を入力し、次へ • プラットフォーム(「J2ME Wireless Toolkit2.2」など)を選択し、終了

  9. 5. プログラムの作成 • クラスの追加 • パッケージエクスプローラのプロジェクト名を右クリ、新規→クラス プロジェクトにクラスが追加されるので、ソースコード記述し保存 • ADFの編集 • パッケージエクスプローラの「○○.jad」をクリックするとADFの編集画面が開く。「Midletsタブ」をクリックするとMIDletの定義画面が表示される。Addボタンを押し、アプリ名(Name) とMIDletクラス名(Class) を指定し保存。 • エミュレーターでの実行 • メニュー 実行→構成および実行 を選択、ダイアログが開かれたら、「Wireless Toolkit Emulator」を選択し、新規ボタンを押す。プロジェクト名(Project)と実行するMIDletクラス名(Executable)を指定し、実行ボタンを押す • JARファイルの作成 • パッケージエクスプローラのプロジェクト名右クリ 「J2ME→CreatePackage]を選択、ProGuardを使用するときは「J2ME→CreateObfuscaterPafkage]を選択

  10. <HelloWorld.java> import javax.microedition.lcdui.*; import javax.microedition.midlet.*; //HelloWorld(本体) public class HelloWorld extends MIDlet { static HelloCanvas c;//キャンバス //コンストラクタ public HelloWorld() { c=new HelloCanvas(); Display.getDisplay(this).setCurrent(c); } //アプリの開始 public void startApp() { } //アプリの一時停止 public void pauseApp() { } //アプリの終了 public void destroyApp(boolean flag) { } } <HelloCanvas.java> import javax.microedition.lcdui.*; //HelloWorld(キャンバス) public class HelloCanvas extends Canvas { //描画 public void paint(Graphics g) { g.setColor(255,255,255); g.fillRect(0,0,getWidth(),getHeight()); g.setColor(0,0,0); g.drawString("Hello World!",0,0,g.LEFT|g.TOP); } } Sample

  11. 6.ProGuardの設定(おまけ参照) • http://proguard.sourceforge.net/ • 上記サイトからダウンロード • 解凍するとフォルダ作成されるので日本語を含まない適当なフォルダに配置 • Eclipse ウィンドウ→設定 • 設定ウィンドウツリー J2ME→Packaging→Obfuscationを選択 • ProguardRootDirectoryにProguardの√フォルダを指定

  12. おまけ資料

  13. J2SE Develoment Kit 5.0(JDK 5.0) • パソコン上で動くJavaアプリを作るための開発キット。サン・マイクロシステムズのサイトで入手できる。「J2ME Wireless Toolkit」を実行するのに必要なので、それより先にインストールする。

  14. J2ME Wireless Toolkit 2.2 • MIDP2.0のアプリを作るための開発キット。サン・マイクロシステムズのサイトで入手できる。APIリファレンスはdocsフォルダにある。

  15. ProGuard • ProGuardはObfuscator(難読化ツール)のひとつ。Obfuscatorとは,Javaクラスファイルの逆コンパイルしてソースコードを盗み見ることを防ぐツール。その結果としてクラスファイルのサイズが小さくなるという利点もある。これを指定することにより、ビルド時に自動的にJARファイルの最適化を行われる。サイトからProGuardをダウンロードし、libフォルダの「proguard.jar」をJ2ME Wireless Toolkitのbinフォルダにコピーすればインストール完了。KToolbarのメニュー「プロジェクト→パッケージ→難読化パッケージを作成」で最適化されたJARファイルが生成される。

  16. 参照 • MIDP2.0メモ • http://www.saturn.dti.ne.jp/~npaka/kvm/midp2/index.html • http://www.saturn.dti.ne.jp/~npaka/kvm/midp2/eclipseme.html • EclipseでJ2MEプログラミング(MIDP編) • http://www.iplatform.org/develop/eclipse/j2me/midp.htm

More Related