Wednesday, January 5, 2011

The system cannot find the file specified

Error: Cannot run program "javac": CreateProcess error=2, The system cannot find the file specified
Error while building project

Most probably, such kind of error occurs only ones for the first time whenevr you do the new installations of JDK, JDE etc. This errors comes when your JDE installation cannot locate the JDK installation, particularly \bin folder of JDK installation.

To sort out this error, just set the classpath so that other softwares can locate your JDK installation. On my machine, set the classpath as C:\Program Files\Java\jdk1.6.0_23\bin; Please note that you will need to provide the complete path to the \bin folder of your JDK installation. And then restart your machine. I hope this will sort out this error. That’s it.

How can I set a classpath variable?

Setting a classpath variable is very simple, just follow the steps below:

  1. Right-Click on My Computer
  2. Go to Properties
  3. It will open a window named as System Properties
  4. Click on Advanced tab
  5. Click on a button Environment Variables which you will find at the bottom of the window.
  6. It will open an another window named as Environment Variables with two sections, one is User variables for Administrator, and another one is System variables.
  7. In the System Variables section, scroll to find the variable Path and select it.
  8. Now click the Edit button.
  9. It will open an another small window named as Edit System Variables, with Path as a Variable name and a long string consisting of various path as Variable value. NOTE: Please don’t delete the existing paths.
  10. Then add the complete path e.g. C:\Program Files\Java\jdk1.6.0_23\bin; at the end of the existing path in the Variable value field.
  11. Press OK on each window.
  12. Restart your machine. That’s it!


Thursday, December 2, 2010

Warning: No definition found for exported static routine: .main(String[])


To get rid of this warning, I cannot call it as a solution, but it is a setting which is needed to be done, particularly for executing the Midlets. Just putting here what I did.... Select the project in your JDE, Right Click on it, then select the "Application" tab, then change the Project Type to "Midlet", then click OK. That’s it. Clean and Build the project, now it will not show the warning.

Installation Failed: Error 907 Invalid JAR illegal host string: starts with ‘/’



This error may occur, while installing the mobile application whose name is same as the application which is already installed on the mobile device. When it asks whether to overwrite the existing application which is installed on the mobile device, and even if you select YES, still this error may occur.

Best way to deal with such error is to uninstall the older version of an application from your mobile device and then re-install the newer version.

Installation Failed: Error 907 Invalid JAR output file: -1.cod code section too large: 65432 bytes


This error comes when one or more classes in your application produce more than 64K byte code. IE there is a limit of 64K for each COD file. It is good idea to create number of small classes instead of creating very large single class.

Installation Failed: Error 907 Invalid JAR Error: Control flow verification information too large: commandAction



This error occurs at the time of installing a mobile application on a device if any method in your application is very big and lengthy. From the error, it is self explanatory. To sort out this error, you have to go on reducing the method. For this you can remove the repetitive statements from the method and place them in a separate method, and then calling that method into the bigger one.

Such kind of error generally come for the methods like commandAction(), itemStateChanged() etc.

Installation Failed: Error starting xxx: Class 'xxx.xxx' ref member out of range



Reducing the number of class level variables will sort out this error. Many devices have a limited memory allotted to declare the class level variables. But remember, this limit is not for an application, but for each class in your application. In short, instead of defining all the class level variables in a single class, it is recommended that you create several classes and distribute your class level variables in all these classes. So the above error will occur when, class level variables in any of your classes in your application has occupied more memory than the allowed for each class. Please also note that, this limitation is for class level variables and not for local variables those you declare inside any method.




Errors, Exceptions and Problems in Mobile Application Development and Its Installation on Mobile Devices



Like a newbie, I also have started developing application and go on implementing code after code as per requirement and ultimately finished my application development.
My application was fully developed with great efforts and it was running perfectly fine as expected on emulators, I have tested it vigorously to make it bug free. Then I wanted to install and test it on actual mobile device. I followed all the necessary steps of installing mobile application on the device, but I was failing again and again with various kinds of errors which I had never seen in my life. At first glance, I thought it is a small problem. After taking guidance from some experts on the various forums, I have decided to alter my application. It was really annoying to make changes in the already developed application. But there was no other option left for me.

I started resolving errors after errors. I came to know that I was totally wrong about the problem that I thought it was a small problem.

When you start installing mobile application on a mobile device, the application is verified first. There are various criteria defined by the device vendor. These criteria varies vendor to vendor, and device to device of the same vendor. On the basis of these criteria, the application is checked at the time of installation on the mobile device. If application fulfills all the criteria set by the device vendor for that particular device, the application is marked as verified and then installation proceeds further.

Really I was totally unaware of various physical limitations like method should not be too long, there should be limited number of variables, size of COD should not be more than 64KB etc. So I decided to share my experience, what I did to sort out these errors. It may be possible that I might have not experienced the errors which you are facing, and vice-versa. Sorry about that.

My development environment was NetBeans IDE and BlackBerry JDE. I tested my application on various BlackBerry emulators. I tried installation on mobile device BlackBerry 8520 Curve Smart Phone.