ant « jar « Java I/O Q&A

1. Files not extracted from .jar file when run

I have updated my ant build.xml file to include a new file and a new folder. After creating the .jar I check if they exist in the jar by 'unzip\extract', ...

2. Problem running a Jar file

I've compiled a java project into a Jar file, and am having issues running it. When I run:

java -jar myJar.jar
I get the following error
Could not find the main class: myClass
The class file ...

3. making a .jar file with source and project structure?

I wonder if this is possible with ant and java: I have a Java project which looks like this:


4. ant's java task can't find a jar in the jre/lib/ext directory

I put "stax-utils.jar" in the extensions directory ([JAVA_HOME]/jre/lib/ext), but ant's java task can't find it, giving:

java.lang.NoClassDefFoundError: javanet/staxutils/IndentingXMLStreamWriter
Strangely, it works for compilation: ant's javac task can find it. The problem is ...

5. ant, jar files, and Class-Path oh my

I am trying to rearchitect my build technique for creating Java jar files which depend on common 3rd party jar files. (GlazedLists, Apache Commons, etc.) I had been chucking them all into ...

6. How to Create a runnable jar that uses external jar files in dynamic locations

I've programmed an application that take about 300 kilobytes. The jar files that it uses (library) take about 10 megz. These library jar files are used in other applications I wrote and ...

7. How to jar java source files from different (sub-)directories?

Consider the following directory structure:

I want to produce a source jar with the following contents:
I know I could use a fileset for each source directory. But is there an easy solution using ...

8. How can I check a signed jar file using Ant?

I sign jar files with the Ant signjar task and now I want to test before deploy. I can check with

jarsigner -verify sbundle.jar 
but I do not know if it ...

9. How to make an Ant task to sign and pack200 all my JAR files?

My JAR files must be signed for a webstart application. It would be nice to also have them packed to minimize the download time. I'm trying to configure an Ant task ...

10. ant: handling jar whose contents have file permissions 000

I am trying to overwrite the default icon of installer JAR created by IzPack, with one from my application:

<jar update="yes"
  <zipfileset src="${pwd}/dist/app.jar" includes="com/izforge/izpack/panels/**"/>
  <zipfileset src="${pwd}/dist/app.jar"

11. Where can I find the keystore file?

I created a keystore using keytool, but the thing is, we're using a JDK remotely ( and I don't have write priviledges on the server ). I noticed that ant has ...

12. Add an ant target to run a class from within a jar file

I have a jar file with multiple executable classes, how can I run the main method of a using an ant target ? Thanks

13. What is the cause for the failure: "jarsigner: attempt to rename {file} to {file}.org failed" when signing jars with ant?

I am getting the error:

[signjar] jarsigner: attempt to rename C:\workspace\line_editor\lib\icon.jar to C:\workspace\line_editor\lib\icon.jar.orig failed
when attempting to self sign a set of jars with ant ...

14. Ant script to Find a jar file given the class name?

how to find the name of jar which contains the specific class through ant script?

15. Manage duplicate jar files using ant and ivy

HI, I am using ant build script to build my java app and utilizing Ivy to manage its dependency. As my application is dependent/subset of other application(Main App), when running it, I ...

16. Ant buildfile not able to put jar file in classpath when running other jar file

I'm new to Ant buildfiles, and I've managed to set up my buildfile to create my build directory structure, compile all my files, and jar them into an jar with a ...

17. Java Packaging/Building Common Techniques Jar File Specifically

I looked through the site at all the common posts but my question differs slightly: What is the best practice for packing a simple Java application that has many other jar files ...

18. Build an executable jar file with Ant tool

I'm developing swing based application in java at the end i want a executable jar file for this project.I'm developing with the NetBeans IDE it will create a jar file but ...

19. ANT: sort files in generated jar

We use ANT to create jar files. In order to create 100% reliable builds (no matter on what machine they are generated), we want the files in the generated jar files ...

20. ANT problem with jar file

I am having a problem producing a working jar file. I would like to end up with a jar file that can run itself by using the command java -jar myjar.jar So ...

21. Exclude test class directory for archiving in Ant

I have created a java library project. The binaries are available at <project-dir>/bin. The test classes are available at <project-dir>/bin/com/myproject/test. I need to exclude archiving of my test classes. So, I ...

22. How to Setup an ANT file to create a JAVA JAR that is containing/packaging this calculator?

I already made a running program which is calculator in IntelliJ IDEA and make a test and it goes fine. My problem is that how to setup an ANT file to ...

23. How to encrypt a .jar file

I'm working in a project where we need to encrypt the .jar file so no one can access to the .class files which inside the jar file.... is there any java ...

24. Problem locating a file in a jar file

I am a Apache Ant novice and I have created a Java application that contains, among many files, a file. The location of this file is in the root and ...

25. How can ant compile-and-jar byte-identical jar files, i.e. so MD5 matches unless .java (and thus .class) changes?

Summary How can you make ant repeatedly generate byte-identical jar files from the same .class files? Background Our build process does the following:

  1. gets web-services-definition (wsdl) files from another application's source repository
  2. runs wsdl2java to ...

26. add jar files into classpath in ant build.xml

27. arguments for a jar file in ant

28. adding jar files to ant target

Like I said, it's all in the documentation. There's little point me telling you exactly what to do, because you clearly don't know what you're doing with Ant yet. You'll only be back here 10 more times saying "ok, now what?". Do yourself a favour, go read the documentation, or one of the millions of Ant tutorials kicking about t'internet. Or ...

29. modifying an existing jar file using ant

31. ant not creating jar file

32. Jar File/Apache Ant

I have written a java program and my professor has requested that i send him an appropriate jar file, or ant file. I tried creating a jar file, but it didn't seem to run properly, does anyone know anything about ant? I am using eclipse and it seems to have ant built in.