File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Classpath problem in Ant build

 
Ross Howard Miller
Greenhorn
Posts: 11
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi,

So I am able to build this fine then when I run my target encrypt i am able to enter my two inputs then I get an error that it is unable to load my lib.

 
Peter Johnson
author
Bartender
Posts: 5852
7
Android Eclipse IDE Ubuntu
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Seems to me like it should work, provided you have all of the necessary JAR files in the lib directory. Could you please post the Ant build output, specifically the output for the encrypt target.

Also, try running Ant with the -v option to see if you get any extra information. It might help if you posted that output here.
 
Carol Enderlin
drifter
Ranch Hand
Posts: 1364
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
From the Ant manual - Jar task , in the Jar File Execution section.

When using the jar attribute, all classpath settings are ignored according to Sun's specification.



From the specification link :

-jar
Execute a program encapsulated in a JAR file. The first argument is the name of a JAR file instead of a startup class name. In order for this option to work, the manifest of the JAR file must contain a line of the form Main-Class: classname. Here, classname identifies the class having the public static void main(String[] args) method that serves as your application's starting point. See the Jar tool reference page and the Jar trail of the Java Tutorial for information about working with Jar files and Jar-file manifests.

When you use this option, the JAR file is the source of all user classes, and other user class path settings are ignored.


Note that the jar file's manifest can specify jars to be in the classpath, see Tutorial on jar file classpath
 
Peter Johnson
author
Bartender
Posts: 5852
7
Android Eclipse IDE Ubuntu
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Carol, good eye! I completely missed that Ross was running the JAR!
 
It is sorta covered in the JavaRanch Style Guide.
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic