2012-02-14 7 views
3

可能性の重複:
You must include the platform port before the LWUIT in the classpath runtime exceptionLWUITの前にプラットフォームパスをクラスパスに含める必要があります。このランタイム例外を解決するにはどうすればよいですか?

私はちょうど今、J2MEでLWUITの使用を開始しています。私はLWUITの知識はまだありませんが、私はより良いJ2MEを知っています。私はそれがうまくコンパイルしています、私のJ2MEのプロジェクトにLWUITのライブラリを追加したが、実行時には、例外の下に表示されます。

java.lang.RuntimeException: You must include the platform port before the LWUIT in the classpath 
    at com.sun.lwuit.impl.ImplementationFactory.createImplementation(ImplementationFactory.java:67) 
    at com.sun.lwuit.Display.init(Display.java:406) 
    at HelloMidlet.<init>(HelloMidlet.java:26) 
    at java.lang.Class.newInstance(), bci=0 
    at com.sun.midp.main.CldcMIDletLoader.newInstance(), bci=46 
    at com.sun.midp.midlet.MIDletStateHandler.createMIDlet(), bci=66 
    at com.sun.midp.midlet.MIDletStateHandler.createAndRegisterMIDlet(), bci=17 
    at com.sun.midp.midlet.MIDletStateHandler.startSuite(), bci=27 
    at com.sun.midp.main.AbstractMIDletSuiteLoader.startSuite(), bci=52 
    at com.sun.midp.main.CldcMIDletSuiteLoader.startSuite(), bci=8 
    at com.sun.midp.main.AbstractMIDletSuiteLoader.runMIDletSuite(), bci=161 
    at com.sun.midp.main.AppIsolateMIDletSuiteLoader.main(), bci=26 

この問題を解決するためにどのように?

以下

は私のコードです:

import com.sun.lwuit.*; 
import com.sun.lwuit.animations.CommonTransitions; 
import com.sun.lwuit.animations.Transition3D; 
import com.sun.lwuit.events.*; 
import com.sun.lwuit.layouts.BorderLayout; 
import com.sun.lwuit.layouts.BoxLayout; 
import com.sun.lwuit.plaf.UIManager; 
import com.sun.lwuit.util.Resources; 
import java.io.IOException; 

public class HelloMidlet extends MIDlet implements ActionListener { 
    private Form form1; 
    private Form form2; 

    private Command cmdRotate = new Command("Rotate"); 
    private Command cmdSlide = new Command("Slide"); 
    private Command cmdExit = new Command("Exit"); 
     public HelloMidlet(){ 
      Display.init(this); 
     } 
    public void startApp() { 
     Resources r; 
     try{ 
      r=Resources.open("/TimelineTheme.res"); 
      UIManager.getInstance().setThemeProps(r.getTheme("LWUITDefault")); 
     }catch (IOException e) { 
      // TODO: handle exception 
      e.printStackTrace(); 
     } 
     form1 = new Form("Form 1"); 
     form1.setLayout(new BorderLayout()); 
     form1.addComponent(BorderLayout.NORTH, new Label("My First Form")); 
     form1.addComponent(BorderLayout.WEST, new Label("WEST")); 
     form1.addComponent(BorderLayout.CENTER, new Label("CENTER")); 
     form1.addComponent(BorderLayout.EAST, new Label("EAST")); 
     form1.addComponent(BorderLayout.SOUTH, new Label("Click Rotate")); 
     form1.addCommand(cmdRotate); 
     form1.addCommand(cmdExit); 
     form1.addCommandListener(this); 
     form1.setTransitionInAnimator(CommonTransitions.createSlide(
        CommonTransitions.SLIDE_HORIZONTAL, true, 1000)); 

     //Setup Form 2 
     form2 = new Form("Form 2"); 
     form2.setLayout(new BoxLayout(BoxLayout.Y_AXIS)); 
     form2.addComponent(0,null,new Label("This is the second Form")); 
     form2.addCommand(cmdSlide); 
     form2.addCommand(cmdExit); 
     form2.addCommandListener(this); 
     form2.setTransitionInAnimator(Transition3D.createCube(1000, true)); 

     form1.show(); 
    } 

    public void pauseApp() {} 

    public void destroyApp(boolean unconditional) {} 

    public void actionPerformed(ActionEvent ae) { 
    if (ae.getCommand()==cmdExit) { 
      notifyDestroyed(); 
     } else if (ae.getCommand()==cmdRotate) { 
      form2.show(); 
     } else if (ae.getCommand()==cmdSlide) { 
      form1.show(); 
     } 
    } 
} 
+0

私はMidletコードが問題を解決するために必要ではないと思います。代わりに、あなたのproject.propertiesを投稿してください。具体的には、libs.classpathプロパティが役に立つかもしれません。 – mdelolmo

答えて

2

あなたはその記事を見ましたか? You must include the platform port before the LWUIT in the classpath runtime exception

これは同様の問題だと思います。上記の質問の答えに示唆されているように、それを解決しようとしてください:

問題はUIの瓶に含まれていたことでした。 LWUITには、の2つの 「セット」が付属しています。 LWUIT \ UIフォルダにある一般的なものと、LWUIT \ Portsフォルダにある プラットフォーム固有のものです。一般 は、すべて共通の コードを含む「親」プロジェクトとして使用されていますが、あなたの プラットフォームの.jarファイルreadmeファイルが言うように:

これらのプロジェクトは、簡単にコンパイルしますが、彼らは1が適切な プロジェクトを使用する必要があるプラットフォームを使用し、 プラットフォーム用の結合接着剤を含んでいないので、彼らがどのような目的のために無用になります特定のポートディレクトリの下にあるプラットフォームに移動します。私は Transitions3D.javaファイルを削除するために、ライブラリを再コンパイルしている間、私は再コンパイル(そして輸入)

ジェネリック ui.jarが。適切なことは、親プロジェクト( ジェネリックUI.jar)をコンパイルしてから、ポート固有のライブラリ(私の場合は LWUIT \ ports \ MIDP \ UI.jar)をコンパイルしてプロジェクトにインポートします。 が行われます。

+0

私は彼らから何の考えも得ていませんでした。 –

+0

最新のLWUIT zipファイルをダウンロードしましたが、LWUIT \ portsフォルダとUI.jarファイルはありません。どのように私はこの答えで解決することができますか? –

+0

SVNからLWUIT 1.5をダウンロードする必要があります。http://java.net/projects/lwuit/sources/svn/show UIポート – Mun0n

関連する問題