File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
The moose likes Ant, Maven and Other Build Tools and the fly likes running jar file error: Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Engineering » Ant, Maven and Other Build Tools
Bookmark "running jar file error: " Watch "running jar file error: " New topic
Author

running jar file error:

Aiping Zhou
Greenhorn

Joined: Sep 06, 2003
Posts: 24
Hello,
I am new to ant. Thank in advance for any helps.
My problem is I can not run my java file "hello.class" by using the jar file construct by ant build.xml. However I can successfully run it by using my .class file directly.
The error message prompt by ant like this:

Here is my build.xml using my jar to run:

Hoever, it runs fine while I directly run the .class file under my "myclass" folder using the following code:

Any one? Thanks again.
[ February 18, 2004: Message edited by: Aiping Zhou ]
Tony Yan
Ranch Hand

Joined: Apr 10, 2002
Posts: 170
Make sure Hello is spelled right. Case Sensitivity problem?


Tony Yan<br /> <br />IBM Certified Developer XML and Related Technology<br />Sun Certified Web Component Developer For J2EE Platform<br />Sun Certified Programmer For Java 2 Platform
Aiping Zhou
Greenhorn

Joined: Sep 06, 2003
Posts: 24
I tried both, the results are same.
Tony Yan
Ranch Hand

Joined: Apr 10, 2002
Posts: 170
Not sure. First make sure that the jar file in ${build} does contain your hello.class file in the right path ( root if default-packaged). Then, may be trying some different format of java task, like this:
<java classname="test.Main">
<arg value="-h"/>
<classpath>
<pathelement location="dist/test.jar"/>
<pathelement path="${java.class.path}"/>
</classpath>
</java>
 
It is sorta covered in the JavaRanch Style Guide.
 
subject: running jar file error:
 
Similar Threads
Build problem when including third party jars in classpath using ant
ant tomcat dist -wrong file structure specified
Not able run junit test cases from ANT
Howto run specific JUnit tests in ant?
Axis 2 tutorial - client class compliation error