tags:

views:

561

answers:

3

Dear Sir/Madam,

I have a java me application and now I want to place that application at the server. I want to write the download page with servlet. I mean when the user keys in the servlet url and hit to that servlet, my jad file will send to the phone(user no need to click to download button or link.After page loading, the servlet will automatically send the jad file to the requested mobile phone.).

I tried with this code.

> File exportFile = new File("C:\\Voice.jad");
> response.setContentType("text/vnd.sun.j2me.app-descriptor");
> response.setContentLength((int)
> exportFile.length()); 
> response.addHeader("Content-Disposition",
> "attachment; filename=" +
> exportFile.getName()); 
> OutputStream os= response.getOutputStream(); 
> InputStream is = new FileInputStream("C:\\Voice.jad"); 
> while (is.available() > 0)  { char c =
> (char) is.read(); 
>     os.write(c); }    
>     os.flush(); 
>     is.close();

and I tried to download the application from Nokia Series 40th 5rd edition emulator. It shows the jad file's information and try to install. But on the way for installing, it said jar file doesn't exist.

I don't know how to move on. Please give me some information or samples. How can I write the download page for java me application at the servlet?

Thanks you, With Regards

A: 

i guess the problem lies in the contents of jad file - path to jar file must be invalid.

besides, handsets frequently are quite picky about the format of jad file - order of rows, newline character, etc

miceuz
Hi Thanks you for your reply.Yes, I only point the jar file like this.MIDlet-Jar-URL: Voice.jarHow should I point to my jar file which is located on server's under C:?Or should I use the other way?Thanks you,With Regards,
A: 

Hi Thanks you for your reply. Yes, I only point the jar file like this. MIDlet-Jar-URL: Voice.jar How should I point to my jar file which is located on server's under C:? Or should I use the other way? Thanks you, With Regards,

A: 

you should add variety of other lines that usually come in jad file ;)

in this example below jad and jar files are in the same directory. if they are not in the same dir, you should provide MIDlet-Jar-URL: either with relative path to the jad file or an absolute path to your jar file. I mean this has to be full url - http://yourserver.com/some/path/your.jar

MIDlet-1: BiteTravel, i3.png, main.MainMidlet
MIDlet-Icon: i1.png
MIDlet-Jar-Size: 109855 //this is very important -- jar size must match this number!
MIDlet-Jar-URL: BiteTravelBite.jar
MIDlet-Name: BiteTravel
MIDlet-Vendor: Bite
MIDlet-Version: 1.0
MicroEdition-Configuration: CLDC-1.0
MicroEdition-Profile: MIDP-2.0
miceuz