ant task to remove files from a jar

Have you tried using the zipfileset task? <jar destfile=”stripped.jar”> <zipfileset src=”full.jar” excludes=”files/to/exclude/**/*.file” /> </jar> Example <property name=”library.dir” value=”dist” /> <property name=”library.file” value=”YourJavaArchive.jar” /> <property name=”library.path” value=”${library.dir}/${library.file}” /> <property name=”library.path.new” value=”${library.dir}/new-${library.file}” /> <target name=”purge-superfluous”> <echo>Removing superfluous files from Java archive.</echo> <jar destfile=”${library.path.new}”> <zipfileset src=”${library.path}” excludes=”**/ComicSans.ttf” /> </jar> <delete file=”${library.path}” /> <move file=”${library.path.new}” tofile=”${library.path}” /> </target>

How to write a Java program which can extract a JAR file and store its data in specified directory (location)?

Adapt this example: How to extract Java resources from JAR and zip archive Or try this code: Extract the Contents of ZIP/JAR Files Programmatically Suppose jarFile is the jar/zip file to be extracted. destDir is the path where it will be extracted: java.util.jar.JarFile jar = new java.util.jar.JarFile(jarFile); java.util.Enumeration enumEntries = jar.entries(); while (enumEntries.hasMoreElements()) { java.util.jar.JarEntry … Read more

I am getting “java.lang.ClassNotFoundException: com.google.gson.Gson” error even though it is defined in my classpath

In case of a JSP/Servlet webapplication, you just need to drop 3rd party JAR files in /WEB-INF/lib folder. If the project is a Dynamic Web Project, then Eclipse will automatically take care about setting the buildpath right as well. You do not need to fiddle with Eclipse buildpath. Don’t forget to undo it all.

Create cross platform Java SWT Application

I’ve just run into the same problem. I haven’t tried it yet, but I plan to include versions of swt.jar for all platforms and load the correct one dynamically in the start of the main method. UPDATE: It worked. build.xml includes all jars: <zipfileset dir=”/home/aromanov/workspace/foo/lib” includes=”swt_linux_gtk_x86.jar”/> <zipfileset dir=”/home/aromanov/workspace/foo/lib” includes=”swt_macosx_x86.jar”/> <zipfileset dir=”/home/aromanov/workspace/foo/lib” includes=”swt_win32_x86.jar”/> <zipfileset dir=”/home/aromanov/workspace/foo/lib” includes=”swt_linux_gtk_x64.jar”/> … Read more

How do I install a test-jar in maven?

You don’t need to install them manually. Maven will do this for you when executing: mvn clean install You need a configuration along the lines of: … <build> <plugins> <plugin> <groupId>org.apache.maven.plugins</groupId> <artifactId>maven-jar-plugin</artifactId> <version>2.2</version> <executions> <execution> <goals> <goal>test-jar</goal> </goals> </execution> </executions> </plugin> </plugins> </build> … Then, later on in your other module where you’ll need to … Read more

Hata!: SQLSTATE[HY000] [1045] Access denied for user 'divattrend_liink'@'localhost' (using password: YES)