BlackBerry Forums Support Community
              

Closed Thread
 
Thread Tools
Old 02-19-2007, 01:56 PM   #1
rivviepop
BlackBerry Extraordinaire
 
rivviepop's Avatar
 
Join Date: Dec 2006
Location: san francisco
Model: 8320
PIN: n/a
Carrier: t-mobile
Posts: 2,166
Default jadmaker.sh: create a missing JAD from JAR

Please Login to Remove!

Originally a blog post of mine:
create a missing JAD from JAR (J2ME midlets) « rivviepop phantom

== snip ==
You’ve managed to download a J2ME jar file to install on your phone (typically a game), but your particular handset requires a JAD file (a text file describing the jarball itself) to be used as well for installation purposes. But, you don’t have this JAD file and need to make one.

Typically a J2ME midlet jarball has 80% of the needed JAD content already inside, it just needs extracted and given a bit more data to make the actual JAD file a usable entity. Use the below script to do this work for you; no other tools (like the JDK) are needed, just your basic BASH shell utlities.

Save this as “jadmaker.sh”:

Code:
#!/bin/bash
#
# Given a J2ME midlet jarball, create a JAD for it
# Usage: ./jadmaker.sh <filename>

# safety check 1
FILE=$1
if [ ! -f "${FILE}" ]; then
  echo "Input file '${FILE}' missing, exiting."
  exit 1
fi

# safety check 2
JAD="${FILE%.*}.jad"
if [ -f "${JAD}" ]; then
  echo "${JAD} already exists, overwrite? (y/N)"
  read tmpans
  answer=$(echo "$tmpans" | tr '[:upper:]' '[:lower:]')
  if [ "$answer" != "y" ] && [ "$answer" != "yes" ]; then
    echo "Not overwriting ${JAD}, exiting."
    exit 1
  else
    rm -f "${JAD}"
  fi
fi

# unzip the internal manifest, changing line endings to our local OS
# the sed action removes blank lines, with or without spaces/tabs
unzip -aa -j -p ${FILE} "META-INF/MANIFEST.MF" | sed -e '/^[ \t]*$/d' > "${JAD}"

# generic variables
echo "MIDlet-Jar-URL: ${FILE}" >> "${JAD}"
echo "MIDlet-Info-URL: http://" >> "${JAD}"

# actual jarball size
FILESIZE=$(stat -c%s "${FILE}")
echo "MIDlet-Jar-Size: ${FILESIZE}" >> "${JAD}"

# weee
echo "Created ${JAD}."
exit 0
You can quickly generate JAD files for an entire directory of jarballs using a simple command like:

Code:
for ii in *.jar; do ./jadmaker.sh $ii; done;
__________________
[ Linux & BlackBerry ] http://www.blackberryforums.com/linux-users-corner/
Offline  
Closed Thread



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


OEM Dell XPS 8910 8920 8930 Alienware Aurora R5 R6 R7 Front Cooling Fan 7M0F5 picture

OEM Dell XPS 8910 8920 8930 Alienware Aurora R5 R6 R7 Front Cooling Fan 7M0F5

$13.81



DELL 330-6581 3306581 725-10229 OEM LAMP FOR 1510X 1610HD 1610X  - Made By DELL picture

DELL 330-6581 3306581 725-10229 OEM LAMP FOR 1510X 1610HD 1610X - Made By DELL

$39.98



Dell OEM Latitude Rugged Extreme 7404 GPS Antenna Junction Cable Cable KMX0M picture

Dell OEM Latitude Rugged Extreme 7404 GPS Antenna Junction Cable Cable KMX0M

$2.95



OEM Dell Precision M3800 XPS 15.6

OEM Dell Precision M3800 XPS 15.6" 15-9530 CPU Left Fan 2PH36 NIA01 DC28000DQF0

$9.99



Genuine OEM Dell 2375 B2375dnf B2375dfw 110V Fuser fixing N41P2 sku 724-BBCI picture

Genuine OEM Dell 2375 B2375dnf B2375dfw 110V Fuser fixing N41P2 sku 724-BBCI

$94.99



OEM Dell 3310 2 in 1 LCD Touch Screen D2TNH NV133FHM-T00 06GHX8 picture

OEM Dell 3310 2 in 1 LCD Touch Screen D2TNH NV133FHM-T00 06GHX8

$54.00







Copyright © 2004-2016 BlackBerryForums.com.
The names RIM © and BlackBerry © are registered Trademarks of BlackBerry Inc.