From owner-freebsd-java@FreeBSD.ORG Mon Sep 21 21:54:00 2009 Return-Path: Delivered-To: freebsd-java@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 23926106568D for ; Mon, 21 Sep 2009 21:54:00 +0000 (UTC) (envelope-from ronald-freebsd8@klop.yi.org) Received: from smtp-out3.tiscali.nl (smtp-out3.tiscali.nl [195.241.79.178]) by mx1.freebsd.org (Postfix) with ESMTP id DAFCE8FC1A for ; Mon, 21 Sep 2009 21:53:59 +0000 (UTC) Received: from [212.123.145.58] (helo=sjakie.klop.ws) by smtp-out3.tiscali.nl with esmtp (Exim) (envelope-from ) id 1Mpqpa-0000rX-Pe; Mon, 21 Sep 2009 23:53:58 +0200 Received: from 82-170-177-25.ip.telfort.nl (localhost [127.0.0.1]) by sjakie.klop.ws (Postfix) with ESMTP id B58F114426; Mon, 21 Sep 2009 23:53:55 +0200 (CEST) Content-Type: text/plain; charset=us-ascii; format=flowed; delsp=yes To: grarpamp , freebsd-java@freebsd.org References: <200909211306.31039.pieter@degoeje.nl> Date: Mon, 21 Sep 2009 23:53:55 +0200 MIME-Version: 1.0 From: "Ronald Klop" Message-ID: In-Reply-To: User-Agent: Opera Mail/10.00 (FreeBSD) Content-Transfer-Encoding: quoted-printable Cc: Subject: Re: java jar invocation X-BeenThere: freebsd-java@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: Porting Java to FreeBSD List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 21 Sep 2009 21:54:00 -0000 On Mon, 21 Sep 2009 23:09:19 +0200, grarpamp wrote: >> BTW, Azureus (Vuze) is also in ports. Also you might want to >> install java/jdk16 instead of diablo-jre16 > > I figure it's better for me to learn the hard way before trying > ports. The goal is openoffice. Yeah, hard :) > > So I found the commons here and pulled the jar file out of it: > http://apache.mirrors.redwire.net/commons/cli/binaries/commons-cli-1.2= -bin.zip > commons-cli-1.2.jar > > Then ran this simple thing again: > java -cp `pwd`/commons-cli-1.2.jar -jar `pwd`/Azureus4.2.0.8.jar > > And I got the same error. But the access time on commons-cli-1.2.jar > wasn't bumped, so I ktrace'd it. > 5987 java NAMI "/.../commons-cli.jar" > > Playing along and dropping the apparently unneeded -cp arg, I get: > ln -s commons-cli-1.2.jar commons-cli.jar > java -jar `pwd`/Azureus4.2.0.8.jar > Exception in thread "main" java.lang.NoClassDefFoundError: > org/apache/log4j/Layout > > So after downloading and symlinking log4j, this simplification works: > java -jar Azureus4.2.0.8.jar --ui console > > > The closest I can get so far to having the libs in one dir without > symlinks and calling the app from elsewhere is to hunt up Main-Class > in [Thanks AR]: > unzip Azureus4.2.0.8.jar META-INF/MANIFEST.MF > then run: > java -cp `pwd`/jarz/\*:`pwd`/Azureus4.2.0.8.jar > org.gudy.azureus2.ui.common.Main --ui console > or move azureus into jarz and run: > java -cp `pwd`/jarz/\* > org.gudy.azureus2.ui.common.Main --ui console > or: > java -cp jarz/\*:Azureus4.2.0.8.jar > org.gudy.azureus2.ui.common.Main --ui console > > > The -jar style of that does not work: > java -cp jarz/\*:Azureus4.2.0.8.jar -jar Azureus4.2.0.8.jar > Exception in thread "main" java.lang.NoClassDefFoundError: > org/apache/commons/cli/ParseException > > I was eventually hoping for something like: > java -cp /usr/local/jarz -jar /usr/local/bin/app.jar > > >> you are now running a jre compiled for FreeBSD-7.0 > > Yes. Hopefully we'll have a current java from the foundation for > 8.0 when it comes out. And to keep current I want to figure out > how to build from Sun's java sources sometime. If that doesn't > work, I'll try ports. You have to add all jars to the classpath explicitly. You can't specify a= =20 directory with jars or use *. This is the easiest way I know. for i in /usr/local/jarz/*.jar; do CLASSPATH=3D"$CLASSPATH:$i" done java -cp "$CLASSPATH" -jar foo.jar Ronald.