Is it possible let WTK emulator run a MIDlet from jar file without jad?

All I know emulator can load MIDlet from jad file like this:C:\WTK25\bin\emulatorw.exe -gui -Xdescriptor:C:\WTK25\apps\Games\bin\Games.jadBut many cases, only jars are provided. If WTK emulator could load a jar file to run MIDlet without jad file?thanks.
[282 byte] By [yixiaoqianga] at [2007-11-27 5:27:03]
# 1

I wrote a simple tool for producing jad files from jar files.

Just for fun.

/**

a simple tool for creating a jad file for a given MIDlet jar file. and launch WTK emulator to run it.

author: yi xiaoqiang

time: 2007-05-30

*/

import java.io.*;

import java.util.*;

import java.util.jar.*;

public class SimpleRunJarMIDlet

{

public static void main(String[]args) throws Exception

{

if(args.length == 0)

{

System.out.println("Usage:");

System.out.println(" java RunJarMIDlet XXX.jar");

}else

{

if(args[0].endsWith(".jar"))

{

String jarFile = args[0];

String jadFile = args[0]+".jad";

if(!new File(jadFile).exists())

makeJad(jarFile, jadFile);

Runtime.getRuntime().exec("C:\\WTK25\\bin\\emulatorw.exe -gui -Xdescriptor:"+jadFile);

}

}

}

static void makeJad(String jarFile, String jadFile) throws Exception

{

File file_jarFile = new File(jarFile);

long size = file_jarFile.length();

JarFile jarFile_jarFile = new JarFile(file_jarFile);

Manifest manifest = jarFile_jarFile.getManifest();

FileOutputStream out = new FileOutputStream(jadFile);

manifest.write(out);

String s = "MIDlet-Jar-URL: " + jarFile + "\n"

+ "MIDlet-Jar-Size: " + size + "\n";

out.write(s.getBytes("UTF-8"));

out.flush();

out.close();

System.out.println("Made: " + jadFile);

}

}

yixiaoqianga at 2007-7-12 14:48:21 > top of Java-index,Java Mobility Forums,Java ME Technologies...