View Single Post
Old 08-17-2006, 05:43 AM   #8 (permalink)
jfisher
CrackBerry Addict
 
Join Date: Jun 2005
Location: Manchester, UK
Model: BOLD
Carrier: t-mobile
Posts: 714
Post Thanks: 0
Thanked 0 Times in 0 Posts
Default

Quote:
Originally Posted by ujbandara
What is best way to integrate JDE with Netbeans editor?
that i can help you with, i blogged a guide for doing this, unfortunately i forgot to pay my bill this month (again) so the site is down, use the google cache: MeshTech News - and scroll down to the relevant article. i've quoted the text below:

Step1 - download and install Netbeans (this tutorial was done using the preview of netbeans 5.5)

Step2 - download and install Netbeans Mobility Pack

Step3 - download and install blackberry jde 4.1

Step4 - Launch Netbeans, from the toolbar select tools > java platform manager > add platform and select 'custom java micro edition platform emulator' - View image

Step5 - Enter (or paste) 'C:\Program Files\Research In Motion\BlackBerry JDE 4.1.0' as the Platform Home, then add 'Platform Name' and 'Device Name' - View image

Step6 - Select 'Next', From the 'Bootstrap Libraries' list, remove every item except 'net_rim_api.jar' - View image

Step7 - Select 'Next', Ignore the 'Sources' pane but add the path to the Blackberry javadocs: 'C:\Program Files\Research In Motion\BlackBerry JDE 4.1.0\docs\api\' then click 'finish' - View image

Step8 - Restart Netbeans

Step9 - Create a new project by selecting 'mobile application' from the 'mobile category' - - View image. for this tutorial the application is called 'bb_test', uncheck the 'Create Hello Midlet' option - View image

Step10 - Select the Blackberry platform that you created in steps 1 to 8 - View image

Step11 - Add this xml data to the build.xml file which is visible if you select the 'Files' pane - View image

Step12 - Next you need to create an .alx file which is a Blackberry 'Application Loader' xml file, in the 'Files' pane, right-click and select 'new' > 'empty file' - View image
Name the file the same as your application - View image - and add this xml data

Step13 - You're now ready to start writing your application, switch back to the 'Project' pane and create a new java source file - View image

Here's a simple small application to get you started:

//start import net.rim.device.api.ui.component.*; import net.rim.device.api.ui.container.*; import net.rim.device.api.ui.*;

class myApp extends UiApplication {
public static void main(String[] args){
myApp instance = new myApp();
instance.enterEventDispatcher();
}

public myApp(){
pushScreen(new myScreen());
}
}

class myScreen extends MainScreen{
BasicEditField queryField = new BasicEditField("Query: ", "");
ButtonField submitButton = new ButtonField("Submit", ButtonField.CONSUME_CLICK);

public myScreen(){
add(queryField);
add(submitButton);
}
}
//eof

If you click on the 'File' pane your directory structure should look similar to this image - View image

Step14 - Netbeans still expects your project to be a standard midlet based application, we have to cheat slightly and enter the name of our main class as the midlet name (the class that will extend UIApplication), right-click on your project and select properties, select 'MIDlets' > 'Add' - View image - There will be a warning message, ignore it - View image

Step15 - All being well you should now be able to write, compile and run your native blackberry application and test in the emulator all from netbeans - View image

[NOTE] - the text you need to add inside the </project> tag of the buildxml file is:

<property name="rim.blackberry.home" location="C:\Program Files\Research In Motion\BlackBerry JDE 4.1.0"/>
<property name="rim.blackberry.emulator" value="8707v"/>

<target name="post-jar">
<exec os="Windows NT Windows 95 Windows 98 Windows 2000 Windows XP" dir="${dist.dir}" executable="${rim.blackberry.home}/bin/rapc.exe" failonerror="true" resolveExecutable="true">
<arg value="import=${rim.blackberry.home}/lib/net_rim_api.jar"/>
<arg value="codename=${name}"/>
<arg value="${dist.jad}"/>
<arg value="${dist.jar}"/>
</exec>
<copy file="${name}.alx" todir="${dist.dir}"/>
</target>

<target name="run" depends="init,jar">
<copy todir="C:\Program Files\Research In Motion\BlackBerry Device Simulators 4.1.0\Device Simulators 4.1.0.316" verbose="true">
<fileset dir="${dist.dir}">
<include name="**/${name}.*"/>
</fileset>
</copy>
<exec os="Windows NT Windows 95 Windows 98 Windows 2000 Windows XP" dir="C:\Program Files\Research In Motion\BlackBerry Device Simulators 4.1.0\Device Simulators 4.1.0.316" executable="C:\Program Files\Research In Motion\BlackBerry Device Simulators 4.1.0\Device Simulators 4.1.0.316/${rim.blackberry.emulator}.bat" failonerror="true" resolveExecutable="true"/>
</target>

<target name="debug" depends="init,jar">
<copy todir="C:\Program Files\Research In Motion\BlackBerry Device Simulators 4.1.0\Device Simulators 4.1.0.316" verbose="true">
<fileset dir="${dist.dir}">
<include name="**/${name}.*"/>
</fileset>
</copy>
<delete file="${preprocessed.dir}/.timestamp"/>
<parallel>
<property name="jpda.port" value="8000"/>
<java jar="${rim.blackberry.home}/bin/JDWP.jar" fork="true" dir="${rim.blackberry.home}/bin">
<jvmarg value="-Xmx128M"/>
</java>
<sequential>
<sleep seconds="5"/>
<antcall target="nbdebug"/>
</sequential>
</parallel>
</target>

<target name="post-clean">
<echo>Post clean</echo>
<delete>
<fileset dir="C:\Program Files\Research In Motion\BlackBerry Device Simulators 4.1.0\Device Simulators 4.1.0.316">
<include name="**/${name}.*"/>
</fileset>
</delete>
</target>
Offline