jar

Can you tell on runtime if you're running java from within a jar?

Hi, I have an application that some of my users run from Eclipse, and others run it by using a jar file. I want some actions to be done when running from within the jar, but I don't want them to be done when running from Eclipse. Is there a way to know on runtime whether the current application is running from within a jar? Thanks! ...

Eclipse: How to build an executable jar with external jar?

Hi all, I am trying to build an executable jar program which depends on external jar downloaded. In my project, I included them in the build path and can be run and debug within eclipse. When I tried to export it to a jar, I can run the program but I can't when I try to press a button which includes function calls and classes from the ...

Running jar file with source files in another directory

I would like to run a jar file right from the command line without having to put the jar file in the directory containing my input files. Any ideas on how I can do this if it is possible? ...

Clean way to combine multiple jars? Preferably using ant

I have runtime dependencies on some external jars that I would like to "rejar" into a single jar. These external dependencies are stored in a external_jars directory, and I'd like to be able to not have to list each one out (e.g., to not need to change my build scripts if my dependencies change). Any thoughts? Google gave me a good answ...

How do I copy files into an existing JAR file with Ant?

I have a project that needs to access resources within its own JAR file. When I create the JAR file for the project, I would like to copy a directory into that JAR file (I guess the ZIP equivalent would be "adding" the directory to the existing ZIP file). I only want the copy to happen after the JAR has been created (and I obviously do...

Eclipse Java; export jar, include referenced libraries, without fatjar.

Hi. I need to export jar from my Eclipse Java project and I want to include the referenced libraries. I can't use fatjar for this, which is what everyone seems to recommend. There must be another way of doing this. Does anyone know what this is?! ...

Can you add multiple jars in a jar file and then launch that jar file

I am working on a GUI application and would rather distribute just one jar as opposed to multiple ones. Can you control this with the manifest. ...

How to create a JAR that depends on another JAR?

I'm trying to do a modular application, and I'm having a problem because I have two modules, where one of them depends on the other. For example: module 1 has a class that imports classes from module 2. I've put the following line in my Manifest.txt of module 1: Class-Path: modulo_2.jar ... but I'm getting a error when I create the...

How to create encrypted Jar file?

I am working on project that must need to protect data (revealing code is not main problem) files. We are using Java + Netbeans. Is there any facility that will create jar in encrypted format? We are also using sqlite for database - so putting text file in encrypted format is not proper option for us too. ...

How can I add jars to the classpath when I invoke Jython *without* adding them to $CLASSPATH?

I'd like to do something similar to jython -cp FOO:BAR:BAZ argle.py. If I add FOO, BAR, and BAZ to $CLASSPATH this works. I tried to add them to sys.path at run-time, but that doesn't appear to work for jars. It does work if I add a path to the expanded jars to sys.path at runtime. Is there a simple alternative to exploding the jar file...

Extracting files from a Jar more efficently.

I'm extending a utility class that bundles a set of images and .xml description files. Currently I keep all the files in a directory and load them from there. The directory looks like this: 8.png 8.xml 9.png 9.xml 10.png 10.xml ... ... 50.png 50.xml ... Here's my current constructor. It is lightning fast and does what I need it to...

Best Practice for including 3rd party jars in a core library?

We have a core library that we include as a JAR with all of our web applications to maximize code reuse. Now we'd like to include some functionality through this core library via a 3rd party library (iText). Adding the iText JAR to the core library doesn't work because nested JARs aren't found by the classloader. We don't want to add t...

Diagnosing and improving performance of a java jnlp compared to jar file

Customer X has asked for ways to improve the startup time of a Java process he uses. The problem is, it is not run through a jar file, but rather 'jnlp' (which I am assuming indicates it is a java webstart application) StartUserWorx.jnlp Is there a way to convert this to a JAR file and then have the user invoke the application locally...

Is platform enforced versioning mechanism most sorely needed feature of java?

As developer, I am often interested in new language feature that can make your life easier. For example, java 5 brought generics and annotations to the language, features that can definitely boost your productivity. However, when I look back at close to a decade working on java platform, I find that the versioning related problems are t...

can't get the classpath right

i'm trying to compile this slick2d example (first one) but i can't get it to work. here's the code: import org.newdawn.slick.AppGameContainer; import org.newdawn.slick.BasicGame; import org.newdawn.slick.GameContainer; import org.newdawn.slick.Graphics; import org.newdawn.slick.SlickException; /** * @author panos */ public class Wizar...

Java: Load a resource contained in a jar

In my application I load resources in this manner: WinProcessor.class.getResource("repository").toString(); and this gives me: `file:/root/app/repository (and I replace "file:" with empty string)` This works fine when I run my application from the IDE, but when I run the jar of my application: java -jar app.jar The path become...

how to exclude external jar while creating executable jar in eclipse or commandline?

Hello All, I have written a program in Eclipse IDE which uses BouncyProvider class of BouncyCastle.jar. So to compile my class I added BouncyCastle.jar in my project classpath and it compiles perfectly. Now I want to export my project as Runnable JAR so when I do that from Eclipse, it by default adds the classes of BouncyCastle.jar als...

Deploying .jar file: Why can't I load icon files?

I'm exporting a simple java project that includes two directories; src and Icons. Icons is a directory that contains three .png files. I'm exporting to an executable .jar file using File -> Export. The export works properly and the .jar file contains the Icon directory. But I can't get the correct path for the .png files when the projec...

Executable Jars running very slowly

I've done several projects and packaged them into jar files, but I've noticed that my jar files run much more slowly than in my IDE. I use Eclipse to compile and run my programs. In Eclipse, I have everything working. When I package my project as a runnable Jar and execute it by double-clicking, everything still works. But when I have a...

Do you know good tutorial websites to develop a prePost in Tomcat?

We want to integrate a prepost rutine in our webserver (tomcat). A filter that will capture the post before sent to the user and add a line of code in the html before sent to the user. We are looking for tutorial or any help on this. ...