在eclipse上用lwuit的过程

下面是国外一个人发的在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.

欢迎关注我的微信公众号:

 

如无特殊说明,文章均为本站原创,转载请注明出处!

发表回复

您的电子邮箱地址不会被公开。