|
Replies:
10
-
Last Post:
Nov 8, 2009 5:45 AM
by: iftachb
|
Threads:
[
Previous
|
Next
]
|
|
|
|
|
|
How to build LWUIT with Eclipse
Posted:
Jan 8, 2009 12:37 AM
|
|
|
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/development/tutorial/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.
Regards Christoph
|
|
|
|
|
|
|
Re: How to build LWUIT with Eclipse
Posted:
Jan 8, 2009 1:16 AM
in response to: csperle
|
|
|
Hi,
thanks for the howto, it looks very complete. However, I use LWUIT on Eclipse all the time as a dependency on other projects and I don't have any trouble. Maybe the problems arise when using the ANT script, but I don't know because I just do "create package" with EclipseME.
One thing I can tell you for sure is that you can save the tedious step 7 by setting Java code compatibility in the LWUIT project to 1.3 instead of 1.4 which is the default. If I'm not clear enough I'll find a link for you, but it's been explained many times on the mailing list.
Thanks again and hope it helped. Arnau
En/na lwuit-users@mobileandembedded.org ha escrit: > 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/development/tutorial/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. > > Regards > Christoph > [Message sent by forum member 'csperle' (csperle)] > > http://forums.java.net/jive/thread.jspa?messageID=324709 > > --------------------------------------------------------------------- > To unsubscribe, e-mail: users-unsubscribe@lwuit.dev.java.net > For additional commands, e-mail: users-help@lwuit.dev.java.net > > > >
--------------------------------------------------------------------- To unsubscribe, e-mail: users-unsubscribe@lwuit.dev.java.net For additional commands, e-mail: users-help@lwuit.dev.java.net
|
|
|
|
|
|
|
|
Re: How to build LWUIT with Eclipse
Posted:
Jan 8, 2009 2:31 AM
in response to: csperle
|
|
|
Thanks for this How-To! If you use SVN for your own project as well you can use the svn:externals property as described at the end of this thread: http://forums.java.net/jive/thread.jspa?threadID=54457. Then if you change Java source compatibility of the LWUIT code from 1.3 to 1.4 in Eclipse you shouldn't need Netbeans any more.
|
|
|
|
|
|
|
|
Re: How to build LWUIT with Eclipse
Posted:
Jan 8, 2009 2:38 AM
in response to: klemensz
|
|
|
Yep, that's it, from 1.3 to 1.4. I made a mistake before. Arnau
En/na lwuit-users@mobileandembedded.org ha escrit: > Thanks for this How-To! > If you use SVN for your own project as well you can use the svn:externals property as described at the end of this thread: http://forums.java.net/jive/thread.jspa?threadID=54457. Then if you change Java source compatibility of the LWUIT code from 1.3 to 1.4 in Eclipse you shouldn't need Netbeans any more. > [Message sent by forum member 'klemensz' (klemensz)] > > http://forums.java.net/jive/thread.jspa?messageID=324723 > > --------------------------------------------------------------------- > To unsubscribe, e-mail: users-unsubscribe@lwuit.dev.java.net > For additional commands, e-mail: users-help@lwuit.dev.java.net > > > >
--------------------------------------------------------------------- To unsubscribe, e-mail: users-unsubscribe@lwuit.dev.java.net For additional commands, e-mail: users-help@lwuit.dev.java.net
|
|
|
|
|
|
|
|
Re: How to build LWUIT with Eclipse
Posted:
Jan 8, 2009 9:19 AM
in response to: csperle
|
|
|
Hey, excellent! I was building last night and had to download NetBeans to make it work. I'm much much happier in Eclipse. I'll give it a shot tonight.
Thanks! Karl
|
|
|
|
|
|
|
|
Re: How to build LWUIT with Eclipse
Posted:
Jan 8, 2009 11:23 AM
in response to: karmat
|
|
|
Yeah... I prefer eclipse for day-to-day tasks too. When the going gets really tough I fall-back on Emacs though 
Regardless, I don't have to do many of the things mentioned so far. My eclipse environment is *very* minimal however (no EclipseME, no need for code compatibility settings, no usage of ant, etc). Actually, I Just install subclipse (for convenience) and make sure to change Eclipse's debug settings so remote debugging via sun's WTK will work.
The setup procedure resembles...
1) check-out LWUIT as new project using subclipse (must have subclipse plugin installed within eclipse)
2) right-click on the LWUIT project and edit the build path... remove any J2SE classpath entries & add the necessary WTK jar files instead: cldcapi11.jar midpapi20.jar jsr184.jar mmapi.jar jsr75.jar jsr226.jar (eclipse problems/errors should vanish if "Project"->"Build Automatically" is checked)
3) make sure the eclipse java debugging options are compatible w/ sun's wtk (i.e. go to Window->Prefs->Java->Debug and disable first 2 suspend options & increase debug timeout >=15000ms).
4) create a LWUIT "stub" project with the WTK 2.5.2 emulator.
5) finally, within that project's filesystem (e.g. ~/j2mewtk/2.5.2/apps/LWUIT) i remove the src directory and point it symbolically to the eclipse workspace code instead (using "ln -s" obviously).
The edit-compile-debug cycle involves using eclipse to edit, the wtk to compile, and both to debug. Not as tightly integrated as using ant + EclipseME I guess... but easier for me.
Anyway, it's certainly nice to hear all the different ways people are using eclipse 
On Thu, Jan 8, 2009 at 12:19 PM, <lwuit-users@mobileandembedded.org> wrote: > Hey, excellent! I was building last night and had to download NetBeans to make it work. I'm much much happier in Eclipse. I'll give it a shot tonight. > > Thanks! > Karl > [Message sent by forum member 'karmat' (karmat)] > > http://forums.java.net/jive/thread.jspa?messageID=324801 > > --------------------------------------------------------------------- > To unsubscribe, e-mail: users-unsubscribe@lwuit.dev.java.net > For additional commands, e-mail: users-help@lwuit.dev.java.net > >
--------------------------------------------------------------------- To unsubscribe, e-mail: users-unsubscribe@lwuit.dev.java.net For additional commands, e-mail: users-help@lwuit.dev.java.net
|
|
|
|
|
|
|
|
Re: How to build LWUIT with Eclipse
Posted:
Jan 15, 2009 12:51 AM
in response to: csperle
|
|
|
Hmm....
I tried your instructions, but I'm getting an error during the build:
BUILD FAILED C:\j2meworkspace\LWUIT\nbproject\build-impl.xml:532: Could not create task or type of type: copypath.
Ant could not find the task or a class this task relies upon.
any ideas?
Thanks.
|
|
|
|
|
|
|
|
Re: How to build LWUIT with Eclipse
Posted:
Jan 15, 2009 9:37 AM
in response to: oneguitar
|
|
|
You don't want to run the NetBeans build.xml files. Just use the built-in Eclipse builder on the LWUIT code. If you've set your Java code profile to 1.4 it works pretty easily.
Cheers, Karl
|
|
|
|
|
|
|
|
Re: How to build LWUIT with Eclipse
Posted:
Sep 14, 2009 9:56 PM
in response to: csperle
|
|
|
I get java.lang.NoClassDefFoundError: com/sun/lwuit/layouts/Layout every time I try to run MIDlet using generated LWUIT.jar =(
|
|
|
|
|
|
|
|
Re: How to build LWUIT with Eclipse
Posted:
Nov 8, 2009 5:45 AM
in response to: untit1ed
|
|
|
you sholud klick on the LWUIT.jar at project oroperties->Java build path->order and export->LWUIT.jad
|
|
|
|
|
|
|
|
Re: How to build LWUIT with Eclipse
Posted:
Oct 20, 2009 7:58 AM
in response to: csperle
|
|
|
This is interesting. It went pretty easy for me, though. I just added the LWUIT.jar to my project created with Eclipse PULSAR. ( with Eclipse ME out of the box ), and it works.
|
|
|
|
|