views:

468

answers:

3

Is there a way to sign an Jar for a JavaMe / j2me aplicattion, using Sun WTK via an ant task?

examples, or tutorials links would be appreciated.

+1  A: 

I've got a batch file for signing. Not sure how ANT works, but I'm sure you can figure out how to work this in:

java -jar "c:\SPRINT_WTK_31\bin\JadTool.jar" -addcert -alias sprintadp -keystore "c:\SPRINT_WTK_31\appdb\keystore.sks" -inputjad deployed\xxx.jad -outputjad deployed\xxx.jad

java -jar "c:\SPRINT_WTK_31\bin\JadTool.jar" -addjarsig -jarfile deployed\Phone.fm.jar -keystore "c:\SPRINT_WTK_31\appdb\keystore.sks" -keypass adp2006 -alias sprintadp -inputjad deployed\xxx.jad -outputjad deployed\xxx.jad

Of course, replace the Sprint ADP stuff with a real certificate (which I wish I had...), and replace Sprint's WTK path with Sun's WTK path.

zildjohn01
that will do! just include in an ant command exec task. thanks!
Decio Lira
A: 

Alternatively, use the ant tasks that netbeans generates.

QuickRecipesOnSymbianOS
I´m more of a eclipse guy, I have never used netbeans that much really, but how does it generate theses tasks? I might take a look at! thanks!
Decio Lira
+2  A: 

You go a few option:

  1. Use the ant libary antenna which has additional tasks for building, packaging, signing midlets (http://antenna.sourceforge.net/)
  2. Call wtk commands directly using exec
  3. Use a shell script

I can highly recommend the first option. To get you started on antenna look at the sample files provided in the download package.

sliver
+1 for recomending antenna!
Decio Lira