jar

What is the most elegant solution to managing various Java external libraries?

Perhaps the reason I stalled learning Java until now is because I HATE how Java handles external libraries. I'm stuck keeping them in one place, adding them individually, fixing problems with versioning and every time I move/rename them, and copying and writing the classpath over and over each time I release a Java application. There ha...

Maven Default Separator

Hi All, In a pom.xml, if we are trying to compile and create a JAR, the name will be taken as <artifactId>-<version>.jar Is there a property or setting which can change the default separator '-' to something else? I know that we can rename it after a jar has been created (or by using finalName). I was just wondering whether anyone ...

How to include file in Jar through Ant at specific location

Hi, I've got an ant jar task: <target name="jar"> <jar destfile="${generated.jars.dir}/hello-${environment}.jar"> <fileset dir="${generated.classes.dir}"/> <fileset dir="${environment.dir}/${environment}" includes="config.xml"/> </jar> </target> How can I force the config.xml file to be pushed to a specific director...

multiple JFrames from JAR

I have a Java application that launches multiple windows (JFrames). It works fine when I'm running it from the command line. But after packaging the app in a JAR and running it from the JAR, not all of the windows open. Does anyone know why this could be happening? Is there something about JAR files that prevent opening multiple windows...

Dynamically loading a Jar file will not work; have tried a lot

Hi, my app basically stores a jar file in a "Blob" in mysql and then grabs it through a PHP file. This is not a problem, because doing: $ wget http://path/to/php $ jar tf file.jar shows the classes perfectly fine. I have tried many things, and the farthest I've gotten is when using ClassLoader.loadClass() when I call newInstance() it...

Unwanted jar files in tomcat/lib or WEB-INF/lib

I am currently working on an application which is around a decade old. When I looked in to the jar files which are associated with the application , I can see lots of jars which are not required and lots of different versions of same jar. What are the cons of having unwanted jars in lib. What is the easy way to find and remove them? ...

Can a deployed JBoss web application simply disappear?

A strange problem occurred yesterday on a production system which has been running fine for weeks on a JBoss 4.2.3 application server: the JAR file containing the web application was no longer in the deployment folder (so the clients could no longer access the application). The server is running on a Windows box. There was no indication...

How to restrict the memory usage of Java application packed in a jar (-Xmx doesn't seem to work) on Windows

Hi, I'd want to restrict the maximum heap size for a Java application but it doesn't seem to work. I'm running the application from a jar package through bat in Windows. Bat contents: @Echo off set CLASSPATH=. java -Xmx32m -classpath %CLASSPATH% -jar MyApplication.jar This should restrict the maximum heap size of 32 megabytes. Howeve...

Find text files in Jar

I have an app which has to read from a text file (using FileInputStream). The text file is in the directory structure relative to the class file (eg. "../textdir/text.txt"). When I run it normally (ie specifying the /bin folder containing the .class file in the cp) everything works fine. However, I somehow need to package everything into...

How do I rename files when included in a jar by ant's jar task?

I want to put a set of files that look like this into a jar: yay/my.jar boo/my.jar foo/my.jar bar/my.jar In the process, I want all of them renamed as follows: yay_my.jar boo_my.jar foo_my.jar bar_my.jar I was hoping to use a mapper to accomplish this, but the fileset elements I am using and the jar task don't seem to support it an...

Embedded Jetty looking for files inside its Jar file

Hey people, it's my first question here. I successfully embedded Jetty on a test application. It can serve files without issues. Now I want to know if it's possible for Jetty to serve files that are inside its own Jar file. Does anyone know if that's possible? Thanks! ...

Reading content of a JAR file (at runtime)?

I have read the posts: http://stackoverflow.com/questions/320510/viewing-contents-of-a-jar-file and http://stackoverflow.com/questions/1429172/list-files-inside-a-jar But I, sadly, couldn't find a good solution to actually read a JAR's content (file by file). Furthermore, could someone give me a hint, or point to a resource, where my ...

How to use jarjar from the command-line?

I'm having trouble using jarjar from the command-line to combine a simple Scala program with the scala runtime-library. jarjar correctly detects the dependency: $ java -jar ~/Desktop/saug/jarjar-1.0.jar find jar BCT.jar scala-library.jar /home/schani/Work/scala/bct/BCT.jar -> /home/schani/Work/scala/bct/scala-library.jar Combining th...

Get Caller Absolute Path - Bash Mac OS X Leopard

I am running a jar file from within an app bundle on Mac OS X Leopard. I need to pass into the jar a parameter. The parameter is the absolute path of the file which called the app bundle. I have my short bash script below. I know $0 gives the absolute path to the app bundle itself. Does anyone know how to store in a variable the path I...

Set properties from .properties file in .jar on JVM startup

How can I setup the JVM to automatically load a .properties file in .jar on the classpath on JVM startup? I do not want to configure the properties on the commandline (with -D) but have them in a .properties file. Is there a way to configure this with the help of Maven? ...

Order of JAR loading inside EAR's APP-INF/lib

Will adding a MANIFEST.MF file with Class-Path attribute to META-INF directory inside EAR influence the order of loading of JARs located in APP-INF/lib under WebLogic 8.1? ...

java.util.MissingResourceException when running a jar

Hi All, In order to internationalise my code, I use a property file called MessagesBundle_en_UK.properties which is located in a resource folder called config so that I the following structure: +---src \---com \---proj \---messages Messages.java +---config \-...

How do I make sure only one instance of my program can be executed?

I want my program, a Java executable .jar, to be run just once. I made a program but now I want users not to be able to open more than one instance ....thanks for your time... I've checked the server/client solution and the lock file, but I don't understand them much, I also tried to make them run in NetBeans, with no luck... ...

Find a jar file given the class name?

This must be a very basic question for Java developers, but what is the best way to find the appropriate jar file given a class name? For example, given "com.ibm.websphere.security.auth.WSSubject", how do you track down the appropriate jar file? ("google" is not the answer I'm looking for!) The java docs do not give any hint of the jar...

How to set javadoc path for a jar in a projet using Eclipse

I'm using JUnit 3 in Eclipse Galileo. The junit.jar (located in the project in vendor/lib/) contains both the classes and the javadoc. In my project which I share using CVS, I want the doc to be available for everybody who checks-out the project. So I committed the .classpath file. When adding the javadoc path to the lib using the Eclip...