[ale] Java Classpath quesiton
Michael D. Hirsch
mhirsch at nubridges.com
Thu Feb 13 09:37:42 EST 2003
On Thursday 13 February 2003 08:44 am, cfowler wrote:
> I'm trying to get an applicaiton in one jar file to call a class in
> another. But it complains about a class not being found. The only fix
> I have came up with was to merge the 2 jars into one. Then everything
> works. I'm hoping someone can tell me what I'm doing wrong.
What happens if you just put both jarfiles on the classpath and name the
class to execute explicitly on the commandline?
Michael
> Here is my script:
>
>
> #!/bin/sh
>
> merge() {
> TMPDIR=~/cc.$$
> mkdir $TMPDIR
> cd $TMPDIR
> jar xvf ../target/ConsoleConnection.jar
> jar xvf ../target/CommandCenter.jar
> jar cvmf mainClass ../CC.jar .
> cd ..
> rm -rf $TMPDIR
> return
>
> }
>
> if [ "$1" == "merge" ]
> then
> merge
> exit 0
> fi
>
> PROFILES=~/MachineProfiles.xml
>
> CLASSPATH=$CLASSPATH:.:`pwd`/target/ConsoleConnection.jar
> export CLASSPATH
>
> echo "CLASSPATH: "${CLASSPATH}
> echo "MACHINE PROFILES: "${PROFILES}
>
> java -cp ${CLASSPATH} -jar ./CommandCenter.jar -f ${PROFILES}
>
> Without merging, I get this when I tell the app to use
> ConsoleConnection:
>
> [cfowler at cfowler cfowler]$ ./cc.sh
> CLASSPATH:
> .:/opt/tomcat/common/lib/servlet.jar:.:/home/cfowler/target/ConsoleConne
>ction.jar MACHINE PROFILES: /home/cfowler/MachineProfiles.xml
> Warning: Cannot convert string "MetaCtrl<Key>Insert" to type
> VirtualBinding
> java.lang.NoClassDefFoundError:
> com/outpost/consoleconnection/ConsoleConnection
> at
> com.outpostsentinel.commandcenter.ui.panel.SystemStatusPanel$5.run(Unkno
>wn Source) at java.lang.Thread.run(Thread.java:536)
>
>
>
> Thanks,
> Chris
>
> _______________________________________________
> Ale mailing list
> Ale at ale.org
> http://www.ale.org/mailman/listinfo/ale
_______________________________________________
Ale mailing list
Ale at ale.org
http://www.ale.org/mailman/listinfo/ale
More information about the Ale
mailing list