Wednesday, 10 December 2008

Create JAD for Jar in Linux (01)

Here is Code of Created JAD in Linux
Jad file we need to running Jar File in Java
With JAD and JAR , in our PC can running File such as Games Java in HandPhone Nokia, SE (Sony Erickson) etc

Save this as “”:

# Given a J2ME midlet jarball, create a JAD for it
# Usage: ./

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

# safety check 2
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
rm -f "${JAD}"

# 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


1 comment:

abish said...

Thank You!
Simple yet Functional.
That makes linux my favorite.

I want to add something:

||To run the script type:

abish@abish-lappy:~$ sh oxford.jar
(where oxford.jar is the .jar i want to make .jad of)

gOoD lUcK.