Return-Path: Delivered-To: apmail-ant-user-archive@www.apache.org Received: (qmail 83868 invoked from network); 16 Jul 2004 07:58:52 -0000 Received: from hermes.apache.org (HELO mail.apache.org) (209.237.227.199) by minotaur-2.apache.org with SMTP; 16 Jul 2004 07:58:52 -0000 Received: (qmail 15694 invoked by uid 500); 16 Jul 2004 07:58:39 -0000 Delivered-To: apmail-ant-user-archive@ant.apache.org Received: (qmail 15619 invoked by uid 500); 16 Jul 2004 07:58:38 -0000 Mailing-List: contact user-help@ant.apache.org; run by ezmlm Precedence: bulk List-Unsubscribe: List-Subscribe: List-Help: List-Post: List-Id: "Ant Users List" Reply-To: "Ant Users List" Delivered-To: mailing list user@ant.apache.org Received: (qmail 15604 invoked by uid 99); 16 Jul 2004 07:58:38 -0000 X-ASF-Spam-Status: No, hits=0.0 required=10.0 tests= X-Spam-Check-By: apache.org Received: from [194.42.245.4] (HELO pegasus.axiomsystems.com) (194.42.245.4) by apache.org (qpsmtpd/0.27.1) with ESMTP; Fri, 16 Jul 2004 00:58:35 -0700 X-MimeOLE: Produced By Microsoft Exchange V6.0.5762.3 content-class: urn:content-classes:message MIME-Version: 1.0 Content-Type: text/plain; charset="iso-8859-1" Content-Transfer-Encoding: quoted-printable Subject: RE: Java task - jar woes but classname goes Date: Fri, 16 Jul 2004 08:58:29 +0100 Message-ID: X-MS-Has-Attach: X-MS-TNEF-Correlator: Thread-Topic: Java task - jar woes but classname goes Thread-Index: AcRq4nt58k/83H0mQw6SQmWN8UxKpwAJ3lnw From: "Keith Hatton" To: "Ant Users List" X-Virus-Checked: Checked X-Spam-Rating: minotaur-2.apache.org 1.6.2 0/1000/N Hi Geoff, >From the JDK Tool docs: java -jar ... "When you use this option, the JAR file is the source of = all user classes, and other user class path settings are ignored." If you want to launch an application using java -jar, then build that = jar file with a Class-Path entry in its manifest. Hope this helps Keith -----Original Message----- From: Geoff Capper [mailto:geoffcapper@ozemail.com.au] Sent: 16 July 2004 04:11 To: Ant Users List Subject: Java task - jar woes but classname goes Hi, I'm not sure if I'm having a problem with my understanding of java or of = ant at this stage (or maybe just understanding in general), and I hope=20 that someone can point me in the right direction. My problem is as = follows: Background: Ant: 1.6.1 Java: 1.4.2_04 In my build script I have "compile-app", "run-build" and "run-app"=20 tasks. I am using external jars from Hibernate, so for each of these=20 tasks I specify a classpath, for "compile-app" it is simply the main=20 Hibernate jar, for the other two it is a fileset of everything within my = lib/ directory matching *.jar, which includes the main Hibernate jar. Problem: If I run "run-build" everything works fine. If I run "run-app" with a "classname" attribute, having included the=20 application jar in the classpath everything works fine. If I run "run-app" with a "jar" attribute for the application jar=20 (jarred using ant with a mainclass manifest element) I get a=20 NoClassDefFoundError for one of the Hibernate classes. I am running with the debug arg, and the output from ant says the jar is = on the classpath. The classpath isn't changed when I use either=20 jar/classname, so to my mind it seems I shouldn't have this problem. I feel sure I have done something stupid, or misunderstood something=20 somewhere, but I cannot figure out what. My apologies if this is the=20 same as all the other classpath issues, but I seem to have exhausted all = of the possibilities presented in other emails on that topic, such as=20 duplicate jars etc. I have included some of the debug stuff below. Thanks for any help, Geoff Partial output of failed build: run-app: Executing 'C:\j2sdk1.4.2_04\jre\bin\java.exe' with arguments: '-classpath' 'D:\prjAgraria\lib\Agraria.jar;D:\prjAgraria\lib\ext\ant-1.5.3.jar;D:\prj= Agraria\lib\ext\ant-optional-1.5.3.jar;D:\prjAgraria\lib\ext\c3p0-0.8.4.5= .jar;D:\prjAgraria\lib\ext\cglib-full-2.0.1.jar;D:\prjAgraria\lib\ext\com= mons-collections-2.1.jar;D:\prjAgraria\lib\ext\commons-dbcp-1.1.jar;D:\pr= jAgraria\lib\ext\commons-lang-1.0.1.jar;D:\prjAgraria\lib\ext\commons-log= ging-1.0.3.jar;D:\prjAgraria\lib\ext\commons-pool-1.1.jar;D:\prjAgraria\l= ib\ext\concurrent-1.3.2.jar;D:\prjAgraria\lib\ext\connector.jar;D:\prjAgr= aria\lib\ext\dom4j-1.4.jar;D:\prjAgraria\lib\ext\ehcache-0.7.jar;D:\prjAg= raria\lib\ext\hibernate2.jar;D:\prjAgraria\lib\ext\hsqldb.jar;D:\prjAgrar= ia\lib\ext\jaas.jar;D:\prjAgraria\lib\ext\jboss-cache.jar;D:\prjAgraria\l= ib\ext\jboss-common.jar;D:\prjAgraria\lib\ext\jboss-jmx.jar;D:\prjAgraria= \lib\ext\jboss-system.jar;D:\prjAgraria\lib\ext\jcs-1.0-dev.jar;D:\prjAgr= aria\lib\ext\jdbc2_0-stdext.jar;D:\prjAgraria\lib\ext\jgroups-2.2.1.jar;D= :\prjAgraria\lib\ext\jta.jar;D:\prjAgraria\lib\ext\junit-3.8.1.jar;D:\prj= Agraria\lib\ext\log4j-1.2.8.jar;D:\prjAgraria\lib\ext\odmg-3.0.jar;D:\prj= Agraria\lib\ext\oscache-2.0.jar;D:\prjAgraria\lib\ext\proxool-0.8.3.jar;D= :\prjAgraria\lib\ext\swarmcache-1.0rc2.jar;D:\prjAgraria\lib\ext\xalan-2.= 4.0.jar;D:\prjAgraria\lib\ext\xerces-2.4.0.jar;D:\prjAgraria\lib\ext\xml-= apis.jar' '-jar' 'D:\prjAgraria\lib\Agraria.jar' The ' characters around the executable and arguments are not part of the command. java.lang.NoClassDefFoundError: net/sf/hibernate/HibernateException Exception in thread "main" Partial output of successful build: run-app: Executing 'C:\j2sdk1.4.2_04\jre\bin\java.exe' with arguments: '-classpath' 'D:\prjAgraria\lib\Agraria.jar;D:\prjAgraria\lib\ext\ant-1.5.3.jar;D:\prj= Agraria\lib\ext\ant-optional-1.5.3.jar;D:\prjAgraria\lib\ext\c3p0-0.8.4.5= .jar;D:\prjAgraria\lib\ext\cglib-full-2.0.1.jar;D:\prjAgraria\lib\ext\com= mons-collections-2.1.jar;D:\prjAgraria\lib\ext\commons-dbcp-1.1.jar;D:\pr= jAgraria\lib\ext\commons-lang-1.0.1.jar;D:\prjAgraria\lib\ext\commons-log= ging-1.0.3.jar;D:\prjAgraria\lib\ext\commons-pool-1.1.jar;D:\prjAgraria\l= ib\ext\concurrent-1.3.2.jar;D:\prjAgraria\lib\ext\connector.jar;D:\prjAgr= aria\lib\ext\dom4j-1.4.jar;D:\prjAgraria\lib\ext\ehcache-0.7.jar;D:\prjAg= raria\lib\ext\hibernate2.jar;D:\prjAgraria\lib\ext\hsqldb.jar;D:\prjAgrar= ia\lib\ext\jaas.jar;D:\prjAgraria\lib\ext\jboss-cache.jar;D:\prjAgraria\l= ib\ext\jboss-common.jar;D:\prjAgraria\lib\ext\jboss-jmx.jar;D:\prjAgraria= \lib\ext\jboss-system.jar;D:\prjAgraria\lib\ext\jcs-1.0-dev.jar;D:\prjAgr= aria\lib\ext\jdbc2_0-stdext.jar;D:\prjAgraria\lib\ext\jgroups-2.2.1.jar;D= :\prjAgraria\lib\ext\jta.jar;D:\prjAgraria\lib\ext\junit-3.8.1.jar;D:\prj= Agraria\lib\ext\log4j-1.2.8.jar;D:\prjAgraria\lib\ext\odmg-3.0.jar;D:\prj= Agraria\lib\ext\oscache-2.0.jar;D:\prjAgraria\lib\ext\proxool-0.8.3.jar;D= :\prjAgraria\lib\ext\swarmcache-1.0rc2.jar;D:\prjAgraria\lib\ext\xalan-2.= 4.0.jar;D:\prjAgraria\lib\ext\xerces-2.4.0.jar;D:\prjAgraria\lib\ext\xml-= apis.jar' 'au.capper.agraria.AppRunner' The ' characters around the executable and arguments are not part of the command. Building an AppRunner Ending Main --------------------------------------------------------------------- To unsubscribe, e-mail: user-unsubscribe@ant.apache.org For additional commands, e-mail: user-help@ant.apache.org --------------------------------------------------------------------- To unsubscribe, e-mail: user-unsubscribe@ant.apache.org For additional commands, e-mail: user-help@ant.apache.org