在eclipse上用lwuit的過程

來源:互聯網
上載者:User

下面是國外一個人發的在eclipse上用lwuit的過程。(是有很多注意的地方,感覺這個東西還是用sun的netbean方便)

Hello all

if you are an Eclipse developer like me, than you are probably missing
the possibility to build LWUIT with Eclipse. This small How-To describes
what I did to get this done:

What you need

a. Love to work with Eclipse

b. A subversion client (I use TortoiseSVN) and some subversion know-how

c. A good internet connection

Setup Eclipse and create a new Midlet project

1. Install the Eclipse MJT plugin (http://www.eclipse.org/dsdp/mtj/
) and set it up correctly (http://www.eclipse.org/dsdp/mtj/ ... /gettingstarted.php
)

2. Create a new "Midlet Project"

3. Open the "Application Descriptor" file and change the "Microedition Profile" from version 2.1 to 2.0

Checkout LWUIT

4. Open a file explorer and navigate to the new project in your Eclipse
workspace (You can see where this is in the project properties
(Alt-Enter) on the "Resource"-tab)

5. Checkout the LWUIT directory with the URL
"https://lwuit.dev.java.net/svn/lwuit/trunk/MIDP/LWUIT" (guest/guest)
directly into your project directory with your svn client

Fix compilation errors

6. Go back to Eclipse and refresh (F5) your project: now there "src"
folder should show some "com.sun.lwuit" folders and also (unfortunately)
some compiling errors

7. To fix the compiling errors (maybe if someone of the developer team
reads this, he can fix this directly in the repository), open the
erroneous classes and put a "this." in front of every expression marked
as error ("setLayout..." -> "this.setLayout...")

Download necessary build files

8. Now comes the circumstantially part. You have to download Netbeans!
Yes, I'm afraid so. All you need is a JAR file with about 200K, that's
inside the Netbeans distribution. But I don't want to post it here,
because I am not sure if this offend against any SUN licenses.

9. After you downloaded and installed Netbeans, create a "lib" directory
inside your project. Then copy the
"org-netbeans-modules-mobility-antext.jar" from the
"NETBEANS_INSTALLATION/mobility8/modules" directory into your new "lib"
directory.

Fix the build for Eclipse

10. Open "nbproject/build-impl.xml" and delete "${netbeans.user}/" in line 7. The line should now appear as:

<property name="user.properties.file" location="build.properties"/>

(I know, that this file should not be edited (see line 2), maybe someone has a better idea here)

10. Create a new "build.properties" file right under the project (next
to "build.xml") with your settings for the build. You need at least this
three entries here:

* "project.LWUIT" = the path to the LWUIT project (in our case this is ".")

* "libs.j2me_ant_ext.classpath" = the path to the netbeans lib (in our
case this is now "lib/org-netbeans-modules-mobility-antext.jar")

* "platform.home" = the path to your WTK (this depends on your WTK installation)

My "build.properties" looks like this:

project.LWUIT=.

libs.j2me_ant_ext.classpath=lib/org-netbeans-modules-mobility-antext.jar

platform.home=C://WTK2.5.2

These are the minimum entries for the "build.properties" file. If someone finds more useful settings, please post it here.

Run the build

Now everything should be ready to run the build. Right-Click on
"build.xml" and say "Run as/Ant Build". The build should finish
successfully and you should find the resulting "LWUIT.jar" in the "dist"
directory of the project.

I hope I can make some Eclipse developers happy with this How-To. Any comments are welcome.

聯繫我們

該頁面正文內容均來源於網絡整理,並不代表阿里雲官方的觀點,該頁面所提到的產品和服務也與阿里云無關,如果該頁面內容對您造成了困擾,歡迎寫郵件給我們,收到郵件我們將在5個工作日內處理。

如果您發現本社區中有涉嫌抄襲的內容,歡迎發送郵件至: info-contact@alibabacloud.com 進行舉報並提供相關證據,工作人員會在 5 個工作天內聯絡您,一經查實,本站將立刻刪除涉嫌侵權內容。

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.