From owner-freebsd-java@FreeBSD.ORG Mon Sep 21 22:43:40 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 D00F0106566B for ; Mon, 21 Sep 2009 22:43:40 +0000 (UTC) (envelope-from redchin@gmail.com) Received: from mail-yw0-f178.google.com (mail-yw0-f178.google.com [209.85.211.178]) by mx1.freebsd.org (Postfix) with ESMTP id 850038FC12 for ; Mon, 21 Sep 2009 22:43:40 +0000 (UTC) Received: by ywh8 with SMTP id 8so4184759ywh.14 for ; Mon, 21 Sep 2009 15:43:39 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=domainkey-signature:mime-version:received:in-reply-to:references :date:message-id:subject:from:to:cc:content-type :content-transfer-encoding; bh=RN7b88NjjthKIKCD2felgy3n2l1KHi0wb0OMeyzQpKI=; b=fKXucwT72AKoP2VxIyovLhqCtuyr26BGWzX18a91eU3cweKESwD5gY/Yq1SvmBLH1T /Q+0gYmSPWVQqzyyURUzeScF+Z46Wm1C9uD6k/nU+3hPH07NDD60uAR4PDjfWERKHT27 AEey3GNV2ITUTwir7dbTy00eMKkjYN+H2aiDM= DomainKey-Signature: a=rsa-sha1; c=nofws; d=gmail.com; s=gamma; h=mime-version:in-reply-to:references:date:message-id:subject:from:to :cc:content-type:content-transfer-encoding; b=mY7DPUQ2RoyVVjtDqkMB7BQgBbXV8r2CJhRNqET46RBDayVwFtaCOg7Oy1h+oKyaBe 7AIfaZq9EMh9Z6a9NvHdAbaUgHGLU51bjXJkTHCaiTI/usyG0V37oHoOw6+MTyirTmFp TH85/NHGCMvYWkB6aiVss0hfYihu/GKtg82H4= MIME-Version: 1.0 Received: by 10.90.45.19 with SMTP id s19mr132293ags.100.1253571539116; Mon, 21 Sep 2009 15:18:59 -0700 (PDT) In-Reply-To: References: <200909211306.31039.pieter@degoeje.nl> Date: Mon, 21 Sep 2009 15:18:59 -0700 Message-ID: <1d3ed48c0909211518t57cce0ael7e8676b84d9488f4@mail.gmail.com> From: Kevin Downey To: Ronald Klop Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: quoted-printable Cc: grarpamp , freebsd-java@freebsd.org 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 22:43:41 -0000 -cp and -jar are mutually exclusive. On Mon, Sep 21, 2009 at 2:53 PM, Ronald Klop wrote: > 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: >> >> =C2=A0http://apache.mirrors.redwire.net/commons/cli/binaries/commons-cli= -1.2-bin.zip >> =C2=A0commons-cli-1.2.jar >> >> Then ran this simple thing again: >> =C2=A0java -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. >> =C2=A05987 java =C2=A0 =C2=A0 NAMI =C2=A0"/.../commons-cli.jar" >> >> Playing along and dropping the apparently unneeded -cp arg, I get: >> =C2=A0ln -s commons-cli-1.2.jar commons-cli.jar >> =C2=A0java -jar `pwd`/Azureus4.2.0.8.jar >> =C2=A0Exception in thread "main" java.lang.NoClassDefFoundError: >> org/apache/log4j/Layout >> >> So after downloading and symlinking log4j, this simplification works: >> =C2=A0java -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]: >> =C2=A0unzip Azureus4.2.0.8.jar META-INF/MANIFEST.MF >> then run: >> =C2=A0java -cp `pwd`/jarz/\*:`pwd`/Azureus4.2.0.8.jar >> org.gudy.azureus2.ui.common.Main --ui console >> or move azureus into jarz and run: >> =C2=A0java -cp `pwd`/jarz/\* >> org.gudy.azureus2.ui.common.Main --ui console >> or: >> =C2=A0java -cp jarz/\*:Azureus4.2.0.8.jar >> org.gudy.azureus2.ui.common.Main --ui console >> >> >> The -jar style of that does not work: >> =C2=A0java -cp jarz/\*:Azureus4.2.0.8.jar -jar Azureus4.2.0.8.jar >> =C2=A0Exception in thread "main" java.lang.NoClassDefFoundError: >> org/apache/commons/cli/ParseException >> >> I was eventually hoping for something like: >> =C2=A0java -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. =C2=A0And 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 > directory with jars or use *. > This is the easiest way I know. > > for i in /usr/local/jarz/*.jar; do > =C2=A0CLASSPATH=3D"$CLASSPATH:$i" > done > java -cp "$CLASSPATH" -jar foo.jar > > Ronald. > _______________________________________________ > freebsd-java@freebsd.org mailing list > http://lists.freebsd.org/mailman/listinfo/freebsd-java > To unsubscribe, send any mail to "freebsd-java-unsubscribe@freebsd.org" > --=20 And what is good, Phaedrus, And what is not good=E2=80=94 Need we ask anyone to tell us these things?