Thursday, February 14, 2008

Class Info: Oh no, I can't find my jad file!!!

You've created your Java file and compiled it. It's ready to run in the Motorola emulator (SDK.exe), but oh no, where did it go?

OK, here's what happens in the WindowsXP/DOS file system when you create a midlet using BlueJ.
1) I'm in BlueJ. I click File --> New Project and give my project a name like MyHelloWorldProject. What happens? BlueJ makes a subdirectory or folder and titles it the name of your project. So, I would find a folder with the name MyHelloWorldProject somewhere on my computer. You tell BlueJ ahead of time where to create this folder when you create your new project. A window opens into the file system and usually defaults to the MyDocuments or Desktop folders.
2) Now I make a new class. I click New Class and give it a name like myHelloWorld. What happens in the file system? BlueJ makes a file in the MyHelloWorldProject and calls it MyHelloWorld.java. Since the MyHelloWorld file has the extension of .java, I know that it is my source code file. The source code file is where I enter the Java commands for my program.
3) I've finished entering my Java code, and click the Compile button. If you do not have any mistakes, BlueJ creates a binary file for you with a .class file extension. So, in our example, I would have a MyHelloWorld.class file.
4) Now, I click File --> Create Jar file. Wait! Before you do that, make sure that you have made your manifest.mf file. Remember that a jar file contains the manifest.mf file plus any .class files. Also, make sure you don't have any extra files in the MyHelloWorldProject folder (like from Eliza) or your jar file won't work on the cell phone. Blue makes a MyHelloWorld.jar file in our example.
5) Now, I need a jad file. So, you use Notepad to create your jad file. The jad file, among other items, indicates the size of the jar file so your cell phone can run your program with the right amount of memory. So, you cut-and-paste into a new jad file, edit the info including the size of your jar file, and save it. How do I find the size of the jar file? I use My Computer to find my jar file, right click, and select Properties from the drop-down menu. The size of your jar file in bytes is in the Properties list.

0 Comments:

Post a Comment

<< Home