Entry
Computer: PDA: Blackberry: 8700: Java: How to create a Java program for Blackberry using Netbeans?
Oct 30th, 2008 03:41
games games, Knud van Eeden,
----------------------------------------------------------------------
--- Knud van Eeden --- 01 September 2020 - 08:44 pm ------------------
Computer: PDA: Blackberry: 8700: Java: How to create a Java program
for Blackberry using Netbeans?
===
Steps: Overview:
1. -Download and install Netbeans v5
1. -Goto URL
http://www.netbeans.info/downloads/download.php?type=5.0
2. -Download and install 'NetBeans IDE 5.0 Installer'
(filesize=58 megabytes)
http://us1.mirror.netbeans.org/download/5_0/fcs/200601251500/netbeans-
5_0-windows.exe
3. -Download and install 'NetBeans Mobility Pack 5.0 Installer'
(filesize=22 megabytes)
http://us1.mirror.netbeans.org/download/5_0/fcs/200601251500/netbeans_m
obility-5_0-win.exe
2. -Download and install RIM Blackberry Java Development Environment
(JDE v4.1 IDE)
http://www.blackberry.net/developers/downloads/jde/index.shtml
1. -Choose Blackberry Java Development Environment v4.1
https://www.blackberry.com/Downloads/entry.do?
code=00EC53C4682D36F5C4359F4AE7BD7BA1
(filesize= 84 megabytes)
3. -Start Netbeans v5
1. -E.g. run the program
C:\Program Files\netbeans-5.0\bin\netbeans.exe
4. -Add the RIM Blackberry as a custom mobile phone emulator
1. -Select from menu option 'Tools'
2. -Select from list 'Java Platform Manager'
3. -Click button 'Add Platform...'
4. -Enable radio button 'Custom Java Micro Edition Platform
Emulator radio button'
1. -Click button 'Next'
5. -Click button 'Browse...' in 'Platform home'
1. -Browse to your Blackberry JDE installation directory
1. -E.g.
C:\Program Files\Research In Motion\BlackBerry JDE 4.1.0
2. -Click button 'Open'
6. -Possibly change the 'Platform name'
1. -E.g.
Blackberry 8700 emulator
7. -Possibly change the 'Device name'
1. -E.g.
Blackberry 8700
8. -Do not change anything else
9. -Click button 'Next'
10. -You will get to "Bootstrap Libraries" panel
1. -Select (e.g. use <SHIFT> key) all jar files
1. -Remove them all except 1 file
net_rim_api.jar
(e.g. first select all files using <SHIFT>
then hold down <CTRL>, click on that
filename so that it is unhighlighted
and finally click button 'Remove' to
remove all other files)
11. -Click button 'Next'
12. -In the panel 'Sources and JavaDoc'
1. -Click button 'Add' below at JavaDoc
2. -Type in or browse to
C:\Program Files\Research In Motion\BlackBerry JDE 4.1.0
\docs\api\
1. -Click button 'Open'
3. -Click button 'Finish'
13. -Click button 'Close'
5. -You must restart the Netbeans IDE v5 program
6. -Create a new project
1. -Select from menu option 'File'
2. -Select from list 'New project'
3. -In 'Categories' choose
Mobile
and in 'Projects' choose
Mobile Application
1. -Click button 'Next'
4. -Give it a 'Project name'
1. -E.g.
MobileApplication1
2. -Click button 'Next'
5. -Select from list 'Emulator Platform'
<your Blackberry emulator name>
1. -E.g. the name you chose earlier for your emulator
1. -E.g.
Research in Motion Blackberry 8700 Emulator
2. -Click button 'Next'
6. -Enable the checkbox for the template you will use
1. -Choose the <your Blackberry>_template
1. -E.g.
Blackberry8700_template
2. -Click button 'Finish'
6. -For each new project you have to insert a piece of XML code
1. -Goto the Explorer like panel on the left
2. -Select tab 'Files'
3. -Expand your project (e.g. by double clicking on it)
1. -E.g.
MobileApplication1
2. -Double click on the file
build.xml
3. -Scroll down
4. -Insert that text
just above the *closing* </PROJECT> tag
--- cut here: begin --------------------------------------------------
<property
name="rim.blackberry.home"
location="C:\Program Files\Research In Motion\BlackBerry JDE 4.1.0"
/>
<property
name="rim.blackberry.emulator"
value="7250"
/>
<property
name="rim.blackberry.jdwp.port"
value="8000"
/>
<target
name="post-jar"
>
<exec
os="Windows NT Windows 95 Windows 98 Windows 2000 Windows XP"
dir="${dist.root.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="-midlet"
/>
<arg
value="jad=${dist.jad}"
/>
<arg
value="${dist.jar}"
/>
</exec>
<copy
file="${name}.alx"
todir="${dist.root.dir}"
/>
</target>
<target
name="run"
depends="init,jar"
>
<copy
todir="${rim.blackberry.home}/simulator"
verbose="true"
>
<fileset
dir="${dist.root.dir}"
>
<include
name="**/${name}.*"
/>
</fileset>
</copy>
<exec
os="Windows NT Windows 95 Windows 98 Windows 2000 Windows XP"
dir="${rim.blackberry.home}/simulator"
executable="${rim.blackberry.home}/simulator/
${rim.blackberry.emulator}.bat"
failonerror="true"
resolveExecutable="true"
/>
</target>
<target
name="debug"
depends="init,jar"
>
<copy
todir="${rim.blackberry.home}/simulator"
verbose="true"
>
<fileset
dir="${dist.root.dir}"
>
<include
name="**/${name}.*"
/>
</fileset>
</copy>
<delete
file="${preprocessed.dir}/.timestamp"
/>
<parallel>
<property
name="jpda.port"
value="${rim.blackberry.jdwp.port}"
/>
<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="${rim.blackberry.home}/simulator"
>
<include
name="**/${name}.*"
/>
</fileset>
</delete>
</target>
--- cut here: end ----------------------------------------------------
5. -An optional step is to add some extra information to
your build.xml file
If you instead add this text in your build.xml file (thus
replace the text you inserted in the step above) you can
even set RIM execution/debug for particular project
configurations.
1. -Arbitrarily the name
Test
has been chosen as the name for this particular
configuration
--- cut here: begin --------------------------------------------------
<target
name="init.rim.blackberry"
depends="init"
>
<condition
property="rim.blackberry"
value="true"
>
<or>
<equals
arg1="Test"
arg2="${config.active}"
/>
</or>
</condition>
</target>
--- cut here: end ----------------------------------------------------
6. -Create a .alx file
(That .alx file contains information about your project in
XML format, and is used and required to upload/transfer
later your Java program to your Blackberry)
1. -Goto the Explorer like panel on the left
2. -Select tab 'Files'
3. -Right click on your project name
4. -Select from list 'New'
5. -Select from list 'File/Folder'
6. -In the left pane click on 'Other'
7. -In the right pane click on 'Empty File'
8. -Click button 'Next'
9. -Create a new file with the name
<your project name>.alx
1. -E.g.
MobileApplication.alx
6. -Save this file into your project folder
(on the same level as build.xml)
1. -Click button 'Browse'
2. -Click on the name of your project
1. -E.g.
MobileApplication1
3. -Click button 'Select folder'
7. -Click button 'Finish'
8. -Copy and paste (in the right pane) the following text
in this empty .alx file
--- cut here: begin --------------------------------------------------
<loader
version="1.0"
>
<application
id="MobileApplication1"
>
<name >
</name>
<description >
</description>
<version >
</version>
<vendor >
MyCompany (change this to your liking)
</vendor>
<copyright >
Copyright (c) 2006 MyCompany (change this to your liking)
</copyright>
<fileset Java="1.5">
<directory >
MyCompany (change this to your liking)
</directory>
<files >
MobileApplication1.cod
</files>
</fileset>
</application>
</loader>
--- cut here: end ----------------------------------------------------
9. -You can change the information in this text,
but make sure that the .cod filename has the
name
<your projectname>.cod
1. -E.g.
MobileApplication.cod
as this file has to be found if you should transfer
your Java program to your Blackberry)
7. -At this point, you are ready to write code, build, run,
execute and debug your Java program in Netbeans
1. -The standard project loaded shows a 'Hello World'
screen
1. -After you compile it (click the first green '>' in
the menu you can immediately start to deploy it
from your computer to your Blackberry, where you
can run it via the menu in your Blackberry
-- or --
1. -To get a feeling, or create your own Java program
possibly change a few things
1. -Click on the 'HelloMidlet'
2. -Select tab 'Screen Design'
3. -E.g. Drag and drop controls (e.g. a 'ticker') from
the palette in the right panel on the form
(click on 'Design mode' first)
4. -When finished compile that program
1. -Click on the first green '>' in the menu
8. -When you compile your project a Blackberry emulator image
will appear on the screen
1. -To navigate
1. -Use the mouse scrollwheel or the arrow keys to
navigate through the menu items
2. -Click on the thumbwheel on the right to goto
that menu option
3. -Press <ESCAPE> or click on the escape button
on the right to go back out of the current
chosen menu option
2. -Scroll to the icon for your application (which is
called a midlet, similar to an applet and a servlet),
which will be on the main phone screen when the
emulator comes up.
9. -The compilation will by default create your project in the
directory
c:\documents and settings\<your Windows user name>
1. -E.g.
c:\documents and settings\administrator
2. -If you browse to this directory, e.g. using Microsoft
Explorer you should see e.g. a directory
MobileApplication1
1. -Inside this directory you see a file
MobileApplication.alx
1. -You will need to choose this file later
when you are finished to upload your
finished Java application to your
Blackberry
12. -Then deploy (=transfer) your Java application to your
Blackberry so that you can run it there from its menu
1. -Compile your application
2. -Connect your Blackberry
1. -Use the USB cable
3. -Run Blackberry javaloader program
javaloader.exe -u load yourfilename.cod
4. -This will add an icon in the Blackberry menu
5. -Run your Java program on your Blackberry
by clicking on its icon via the menu
===
Tested successfully on
Microsoft Windows XP Professional (service pack 2),
running
Netbeans v5.0
===
Internet: see also:
---
Computer: PDA: Blackberry: 8700: Link: Overview: Can you give an
overview of links?
http://www.faqts.com/knowledge_base/view.phtml/aid/42124/fid/1897
----------------------------------------------------------------------
http://www.f01h.com/