Frequently Asked Questions
Sun JavaTM Wireless Toolkit for CLDC
The installation failed during the extraction phase. I got a message that says:
Extracting the installation files...
Error! CRCs do not match! Got e61aebb2, expected f53ddfb0
Failed to extract files. Installation will stop now.
It is likely that the Java archive (JAR) utility you are using is incompatible. During the installation you are prompted for the path to the Java interpreter. You must provide the full path to a JavaTM Platform, Standard Edition (Java SE SDK), version 1.5.0 installation.
The installation failed during the extraction phase. I got a message that says:
/usr/java/jre1.5.0_08/bin/jar: No such file or directory
Failed to extract files. Installation will stop now.
The JRE is not enough, you need a version 1.5.0 Java Development Kit (JDK). Install the full JavaTM Platform, Standard Edition (Java SE). During installation, provide the full path to the Java SE installation.
The Release Notes describe the installation of the SNAP Mobile Emulation Environment on the Windows platform. How do I get the SnapMobileSample MIDlet working on Linux?
- Use the Release Note instructions to install the SNAP Mobile Emulation Environment on any Windows machine in your network.
- Launch the SNAP server emulator.
- Change the property "SNAP-Mobile-Host" in the SnapMobileSample.jad file to the name of the machine running the SNAP server emulator.
I successfully installed on Windows 98 SE, but there are some problems.
Windows 98 SE is not a supported platform. Windows XP is the only supported platform, as stated in docs/BinaryReleasNotes.html .
Do I need Sun Java Wireless Toolkit Version 2.5.2_01 for CLDC?
The Sun Java Wireless Toolkit contains vulnerabilities that might allow an untrusted application to execute arbitrary code. The vulnerability can only be exploited if you obtain a malicious program and execute it in the toolkit. Although this scenario is unlikely for toolkit users, Sun Microsystems has released version 2.5.2_01 to fix the vulnerability. You can download the updated version from http://java.sun.com/products/sjwtoolkit/download.html, or, you can resolve to never use the toolkit to execute MIDlets from untrusted sources.
If this toolkit is written in Java, why does it take so long to make it available on other platforms?
Although the user interface of the toolkit is written in Java SE, the product contains a substantial amount of platform-specific native code, including a full implementation of a Java ME Virtual Machine. Each platform requires a separate effort to port, test, and maintain the native code.
I have updated my JDK. How do I get the emulator to use the updated JDK?
You cannot point the emulator at a different installation. You can install the new JDK in the same location as the old JDK, or, you can uninstall and re-install, supplying the path to the new JDK.
What's the fastest way to get started?
To get started using KToolbar, try opening some of the demonstration projects and running them. You can also examine and modify the source code for the demonstrations. More information is here.
Can I use the toolkit from the command line?
Yes. See Appendix B of the User's Guide for more information.
Where can I find out more about MIDP, CLDC, MMAPI, and WMA?
For more information, visit these links:
Can I build applications for MIDP 1.0 devices?
Yes, you can build applications for a wide variety of software stacks. Click the Settings... button to edit project settings, then choose the configuration, profile, and optional packages you would like on the API Selection tab.
I created a new project. Now what do I do?
The next step is to edit source code for the project. The messages in the KToolbar console tell you where to put the source code, resource files, and library files. If you're still not sure what to do, Chapter 2 of the User's Guide contains a simple example.
Where are my project's Java Application Descriptor (JAD) and Java Archive (JAR) files?
First you need to package the project by choosing Project > Package > Create Package from the KToolbar menu. The MIDlet suite descriptor and JAR file are placed in the bin directory of your project.
Can I change the directory for my project after it has been created?
Edit wtklib/Windows/ktools.properties to add the following property:
kvem.apps.dir = your-new-app-directory
For full project management features, consider the NetBeans Mobility Pack.
Can I use an obfuscator?
Yes. The toolkit supports ProGuard and includes an architecture for supporting any obfuscator. See the User's Guide for more information.
Can I use a debugger?
Yes. Most likely you will use the Sun Java Wireless Toolkit for CLDC in conjunction with the debugger in an IDE. The User's Guide has more information on using a debugger.
How can I make sure that my application only uses specific APIs, for example only MIDP 2.0 APIs?
Select the API Selection tab in the Settings dialog box and select the Target Platform and APIs that you want to use.
Can I use network protocols other than HTTP and HTTPS in Java ME applications?
Yes. The MIDP 2.0 specification introduces optional support for socket, server socket, datagram, SSL, and serial (COMM) communication. The WMA specification provides support for SMS, CBS, and MMS messaging. The toolkit's support for JSR 75 and JSR 82 adds file, Bluetooth, and OBEX connections as well.
How can I test the push registry?
To observe MIDlets being launched in response to incoming network connections, you will need to run your application using the Run via OTA feature. Run via OTA simulates the process of installing an application on a device and will correctly respond to incoming network connections based on entries in the push registry. See the User's Guide for more information.
How can I access a Comm port when running on Linux?
You must set the following permission at the command line (note that you must have root privileges):
chmod a+w /dev/ttyS
How can I transfer a MIDlet suite to a real device?
It depends entirely on the device. Each device manufacturer that supports MIDP must provide a mechanism for transferring MIDlets onto its devices.
Can I connect the wireless toolkit to an external bluetooth device, such as a mobile phone?
No, the wireless toolkit does not enable communications with wireless devices.
Why does the emulator ask me if I can connect to the network?
Depending on the protection domain in which your application runs, the emulator might ask permission for certain operations including network access. For an overview of permissions and protection domains in MIDP 2.0, see Understanding MIDP 2.0's Security Architecture.
I can still use an API in the emulator even though it's not selected in the API selection project settings. What's going on?
The API selection project settings apply to building only. The emulator always supports all available APIs.
The Emulator incorrectly displays text in languages other than English. How can I change the fonts?
To display text in languages other than English, follow one of these steps:
- Set the default locale of the desktop to the language you are trying to display.
- Update the font configuration of the emulated device. See the Basic Customization Guide for details.
The device image displayed by the emulator is too small. How can I enlarge it?
How can I enable touch screen events in the emulator?
How can I change the set of character encoding converters available for a device?
See the Basic Customization Guide for information on modifying the default emulator.
I'm having problems deploying a demo MIDlet to a real device. What's wrong?
Some demo MIDlets are built for the MSA platform and use the MIDP 2.1 profile (check their .jad and .jar files). Many devices do not support this rather new profile. To change your project settings to match your device capabilities, click the Settings... button. In the Settings window click API Selection on the left. In the API Selection pane, choose a target platform other than MSA, and a profile other than MIDP 2.1. Select a configuration and any optional packages. Click OK.
My MIDlet won't talk to my server. What's wrong?
Make sure your server is speaking the right version of HTTP. You can adjust the version used by the emulator in the KToolbar preferences. A good way to debug network problems is to use the network monitor. See the User's Guide for details.
A connection might fail because you are behind a firewall. Go to Preferences > Network Configuration > User Proxy Server and supply your proxy information.
Why won't my device recognize my signed MIDlet suite?
Real devices on real networks might have root certificates that are specific to the manufacturer or wireless carrier. Check with your device manufacturer or wireless carrier for details on signed MIDlets.
I signed my MIDlet with a trusted key, but when I install it on my device the midlet is classified as untrusted. What is wrong?
This can happen when the project's security policy does not match the security policy available on the device. While the emulator is able to switch security policies between MSA or JTWI, a device cannot. It will have either MSA or JTWI, never both. To avoid this problem you must make sure the MIDlet security policy matches that of the device.
For example, let's suppose that you develop your MIDlet with the MSA security policy.You sign the MIDlet with the default signing certificate named trustedkey, which has a corresponding root certificate that belongs to the MSA security policy manufacturer domain. Next you decide to install this MIDlet on a real device that runs JTWI. You switch the emulator security policy to JTWI and start to install via OTA. The emulator finds trustedkey's root certficate in the manufacturer domain. This is a problem because manufacturer does not exist in the JTWI security policy, so the MIDlet is not recognized as trusted. During the installation, the emulator displays the content of the certificate and asks you to confirm the installation.The installation is successful, but the MIDlet is considered untrusted. This is the only possible behavior when the root certificate is not known to the security policy on the device.
When running my MIDlet, a security alert is displayed. Why can't I dismiss the alert?
You are probably trying to access a protected API (for example, opening a connection) from your
commandAction()method, which is locking the UI thread. Access protected APIs from a separate thread. Refer to the NetworkDemo for an example on how this can be done.
When I run the emulator it crashes with one of these messages. How can I fix it?
Title: drwtsn32.exe - Unable To Locate Component
Content: This aplication has failed to start because dbgeng.dll was not found.
Re-installing the application may fix this problem.
Error: Can not find soundbank path in registry.
Your Windows installation is missing one or more of the following files:
Copy the missing files from a standard Windows installation to the problem installation and restart.
I'm using an application that connects to the internet and I get an error code. Do I need to change the settings in the toolkit?
Yes. Select Preferences > Network > Proxy Server and specify your proxy information.
JSR172Demo calls sunwireless.quimbik.com but that server does not respond. Is there another server I can use?
Yes. JSR172Demo uses http://cds.cmsg.sun.com:80/serverscript/serverscript.
Why do I get
Error loading class... messages when running the preverifier?
First, check that your Java sources and libraries can be used with CLDC and MIDP APIs.
Then, ensure that you installed the Sun Java Wireless Toolkit for CLDC in a directory whose path does not contain any spaces. For example, the toolkit does not work with the path
If you installed the toolkit in a directory whose path contains spaces, you must uninstall the toolkit and reinstall it in a directory whose path name does not contain any spaces.
I want to use an external library, but when I try to build a MIDlet suite that uses it, I get "
Error preverifying class..." messages. Why does this happen?
If you get this error, you are probably using a class library that was written for Java 2 Platform, Standard Edition (J2SETM platform). This toolkit supports the development of MIDP applications, which have limited capabilities compared to their J2SE counterparts.
I created an application that uses a third party library. There are no compilation or preverification problems, but I get the following error message. How can I fix this?
Uncaught exception java/lang/NoClassDefFoundError: java/awt/Frame: Cannot create class in system package.
To use 3rd party libraries see Project > Properties > External APIs and see the User's Guide. Note, you can't create classes in system packages (for example, java, javax., com.sun.) because of security restrictions.
I wrote an application to send SMS messages and it fails with *Type not supported*.
You should pass MessageConnection.TEXT_MESSAGE and add the payload like this:
smsconn = (MessageConnection)Connector.open(address);
TextMessage txtmessage = (TextMessage)smsconn.newMessage(
Please, see the SMSDemo example for a complete code example.
I have another question, and I can't find the answer here.
Try the developer forum, or send us feedback from developer.sun.com.
Copyright © 2007 Sun Microsystems, Inc. All rights reserved. Use is subject to the license terms.