jar

How should I load Jars dynamically at runtime?

Why is it so hard to do this in Java? If you want to have any kind of module system you need to be able to load jars dynamically. I'm told there's a way of doing it by writing your own ClassLoader, but that's a lot of work for something that should (in my mind at least) be as easy as calling a method with a jar file as its argument. A...

Using Java JAR file in .NET

What options/methods/software are available to convert a JAR file to a managed .NET assembly? Please provide all commercial and non-commercial methods in the answer. These don't include solutions which require Java to be installed on the host machine. ...

Modify an xml files in a jar file with Java

I currently am tasked with updating an XML file (persistance.xml) within a jar at a customers site. I can of course unjar the file, update the xml, then rejar the file for redeployment. I would like to kind these command line operations in a Swing App so that the person doing it does not have to drop to the command line. Any thoughts ...

Find minimal necessary java classpath

Is there a tool to detect unneeded jar-files? For instance say that I have myapp.jar, which I can launch with a classpath containing hibernate.jar, junit.jar and easymock.jar. But actually it will work fine using only hibernate.jar, since the code that calls junit.jar is not reachable. I realize that reflection might complicate things,...

What's the best way to distribute Java applications?

Java is one of my programming languages of choice. I always run into the problem though of distributing my application to end-users. Giving a user a JAR is not always as user friendly as I would like and using Java WebStart requires that I maintain a web server. What's the best way to distribute a Java application? What if the Java a...

Java: Easiest way to merge a release into one jar-file

Hi, I wonder if someone knows of a tool or script which easily merges a bunch of jar-files into one .jar. A bonus would be to easily set the main-file manifest and make it executable. The concrete case is a java restructured text tool: http://jrst.labs.libre-entreprise.org/en/user/functionality.html I would like to run it with someth...

How do you create a MANIFEST.MF that's available when you're testing and running from a jar in production?

I've spent far too much time trying to figure this out. This should be the simplest thing and everyone who distributes Java applications in jars must have to deal with it. I just want to know the proper way to add versioning to my Java app so that I can access the version information when I'm testing, e.g. debugging in Eclipse and runn...

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', and they are there. But when executing the .jar neither the folder or the file gets extracted. Am I missing a step? ...

Jar file naming conventions

Are there any industry standard conventions for naming jar files? ...

How do I create a jar file, which includes xml and html files?

Hi, I am trying to create a jar file which includes some class and java files needed, but I also would like to include some extra xml, xsl, html, txt (README) files. I am using Eclipse on Windows XP. Is there an easy way for me to set up a directory structure and package all my files into a jar? ...

Is there a tool to discover if the same class exists in multiple jars in the classpath?

If you have two jars in your classpath that contain different versions of the same class, the classpath order becomes critical. I am looking for a tool that can detect and flag such potential conflicts in a given classpath or set of folders. Certainly a script that starts: classes=`mktemp` for i in `find . -name "*.jar"` do echo "...

Can i update a signed jar using an ANT Task?

Hi I am trying to deploy an application using webstart. I have a requirement to update a jar which is signed before i actually deploy( basically to update the IP/Port info). I am trying to use ANT to update the jar. Is there are way to achive this? Thanks in advance for any help/suggestions ...

Classloader issues - How to determine which library versions (jar-files) are loaded

Hi there, I've just solved another I-though-I-was-using-this-version-of-a-library-but-apparently-my-app-server-has-already-loaded-an-older-version-of-this-library-issue (sigh). Does anybody know a good way to verify (or monitor) whether your application has access to all the appropriate jar-files, or loaded class-versions? Thanks in a...

Creating non-reverse-engineerable java programs

The title is essentially the question. Does anyone know of a way to deploy a Java program in a format that is not reverse-engineer-able? I know how to convert my application into an executable jar, but I want to make sure that the code cannot be reverse engineered, or at least, not easily. Obfuscation of the source code doesn't count.....

Linking an external .jar from an Xcode java project?

How do I link an external .jar into my Xcode java project? That is, have it in the classpath during compilation and execution. I'm using Xcode 3.0 and this seems to have changed since 2.4. ...

Adding a JAR to an Eclipse Java library

How do you add a JAR file to an already existing Java library in Eclipse? Note that this is not a user library. That is, if you look at the Java Build Path for a Java project and click on the Libraries tab, you will see the list of libraries used by the project. If you expand a given library, you will see a list of JAR files included ...

How to specify JVM argument for Maven built executable JAR

When using Maven to build an executable JAR, how do I specify the JVM arguments that are used when the JAR is executed? I can specify the main class using <mainClass>. I suspect there's a similar attribute for JVM arguments. Specially I need to specify the maximum memory (example -Xmx500m). Here's my assembly plugin: <plugin> <a...

How to load a jar file at runtime

Hi, I was asked to build a java system that will have the ability to load new code (expantions) while running. How do I re-load a jar file while my code is running? or how do I load a new jar? Obviously, since constant up-time is important, I'd like to add the ability to re-load existing classes while at it (if it does not complicate ...

Component-Information from JAR-File possible?

I would like to set up a web application with good modularity and would like to use an AJAX Toolkit/Framework like GWT or ZK for its VIEW. Component information should be load from various modules-JAR. Which AJAX Toolkit/Framework is able to do this? ...

compiling only part of the source tree with ant

Say I have my sources in my src/ tree (and possibly in my test/ tree). Say I would like to compile only part of that tree. The reasons why I might want to do that are various. Just as an example, I might want to create the smallest possible jar (without including certain classes), or I might want the fastest compile time for what I am co...