[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Re: What is openjdk equivalent of javaws.jar



Vincent Fourmond wrote:

This raises a problem which I've hit quite a few times already: it is
a currently pain to find which java package holds which java classes.
It would be quite great to have the equivalent of apt-file for java
classes ;-)... (and that shouldn't be too difficult to write, actually
- I just do not currently have the time).

This should do it.

Andrew.

#!/bin/sh
#
# loc   Find a class or package
#
# Usage:  loc [-l] class-pattern [dirname]

#    -l    Use system locate command instead of find.  In that case, loc
#          will ignore any directory to be searched.

# Example:
#
#     $ loc -l org.objectweb.jonas.common.JProp
#     /var/lib/jonas/demoserver/ejbjars/autoload/mejb.jar
#     /var/lib/jonas/lib/common/ow_jonas_bootstrap.jar
#     /var/lib/jonas/eclipseserver/ejbjars/autoload/mejb.jar
#     /var/lib/jonas/ejbjars/autoload/mejb.jar
#     /var/cache/jonas/work/ejbjars/jonas/mejb_2005.09.15-17.01.52.jar
#     /usr/src/redhat/BUILD/jonas-4.3.3/jonas/classes/common/org/objectweb/jonas/common/JProp.class


MODE=$1
if test "$MODE" == "-l"; then
    COMMAND='(locate \*.jar ; locate \*.war)'
    shift
else
    COMMAND='(find "$FOO" -name \*.jar -follow ; find "$FOO" -name \*.zip -follow ; find "$FOO" -name \*.war -follow)'
fi

FOO=$2
if test "x$FOO" == "x"; then
    FOO=/usr/share/java
fi

eval "$COMMAND" 2>/dev/null | while read i; do
    if (jar tf $i 2>/dev/null | grep $1) > /dev/null 2>&1 ; then
	echo $i
    fi
done

if test "$MODE" != "-l"; then
    find "$FOO" -name '*.class' 2>/dev/null | grep $1
else
    locate \*.class | grep $1
fi

Reply to: