jar

Adding a .dll file to a jar

I have a third party library that comes with .dll files that I need in order to run my java jar file. How can I include them in my jar file when I deploy my application? (I am using JSmooth to create an exe file - if that helps anything) NOTE: I have looked at this stackoverflow question, but there's only one answer there, and I don't t...

How can I iterate entries in a URL resource pointing to a folder in a JAR

Hi all, I have a situation where an app I'm writing works fine from the IDE but fails when deployed into a jar. What I see is NULL pointer exception. What I'm trying to do is get a URL resource of a directory and then iterate through the files in that directory. The URL seems to work but I can't find a way to get the files from it. ...

How to ensure loading of classes of external jars when called from an eclipse plugin?

Hi All, I have developed an eclipse plugin which references an external jar present in a external installation directory. So I have added an entry to my bundle classpath as below: Bundle-ClassPath: external:C:\mylib.jar My class loads properly - and the plugin is able to detect a class MyClass present in this external lib. However, t...

WebApplications (.war file) and common jar file.

Hi:) i need to deploy at Tomcat many web applications with a lot of common jars (Jersey jars). I've created WAR file without JARS and added to MANIFEST.MF eg: "Class_Path: .jar .jar". But WebApplications does not work. What I am doing wrong? ...

How do I find out which JAR application is not using?

In our application through the process of developing a lot of JAR files has been collected. How can I filter out those, which are not used by application anymore? On some easy way? ...

Adding implementation without recompiling in Java?

Hey everyone, I'm a college senior with my first real job opportunity (exciting). I'm at the stage now where they need to see a programming example, and they gave me the task of implementing a random number generator service in Java, with two different implementations (one using the built-in stuff and another of my choice). The code is t...

How to access an image from within a JAR

I know this question (or similar ones) has been asked before, but I still don't understand it. I've created a jar that has the following internal structure: JAR file-configuration---codeBehind ---commandLine---gui ---resources Within the resources folder, I have an image that I'd like to use as an icon, but I can't figure out how to ...

Manual setting CLASSPATH with -cp or -classpath does not work as expected

MyClassWithMainMethod.java uses classes of someJar.jar. If I call: java -cp someJar.jar MyClassWithMainMethod I get the exception: Exception in thread "main" java.lang.NoClassDefFoundError: MyClassWithMainMethod Caused by: java.lang.ClassNotFoundException: MyClassWithMainMethod at java.net.URLClassLoader$1.run(URLClassLoader.java:20...

How to access resources in JAR file?

Hi guys. I have a Java project with a toolbar, and the toolbar has icons on it. These icons are stored in a folder called resources/, so for example the path might be "resources/icon1.png". This folder is located in my src directory, so when it is compiled the folder is copied into bin/ I'm using the following code to access the resourc...

Accessing classes in an external Jar

I am having problems having my Java programs see classes that are packaged in an external jar. I am running under Windows 7. I have the classes embedded in a jar called ParserUtilities.jar. I established the path with a CLASSPATH variable using the System utility and the Environment tab. I confirmed that the CLASSPATH is set corre...

Making ANTLR generated class files into one jar file.

With ANTLR, I get some java class files after compilation. And I need to make all the class files into one jar file. I make manifest.mf file that has one line "Main-class: Test" to indicate the main file. I run 'jar cmf manifest.mf hello.jar *.class' to get hello.jar file. But when I try to run 'java -jar hello.jar', I get the followi...

GenJar replacement or update?

"GenJar is a specialized Ant task that builds jar files based on class dependencies rather than simply the contents of a directory" (http://genjar.sourceforge.net/) It is really useful, but the project seems to be un-active since "2003-03-06 GenJar 1.0.2 is released". Is there a new tool for that we should use now? Thanks ...

ResourceBundles outside a jar file

Hello, I'm facing a problem when I need to distribute my java application, created using NetBeans 6.8. I have some translation files made with gettext as class files - made with msgfmt from gettext package with the following script (shell script run under msys - no problems here) PO_FILES=`find . -iname "*_*.po"` rm -f *.class for PO_...

Error when adding Jar to Maven project

I've added a jar to the 'Referenced Libraries' section in Eclipse, which now allows me to see objects from this jar when coding. However when I build with maven, I keep getting The import ____ cannot be resolved errors. How do I fix this? Do I have to add in the pom.xml? I'm trying use smartgwt.jar. Also - What would be the 'proper' wa...

Will using multiple version of a jar in an application cause problems?

Hi, I came across an application in which multiple versions of jar files are included. For instance commons-fileupload-1.8.jar and commons-fileupload-1.6.jar. Would this cause any issues? Thanks, Raghuram ...

Classpath issue with java -jar

Hi, I have an executable jar Client.jar that requires jndi.properties file. Since the jndi properties is not part of the Client.jar, and java -jar ignores the -classpath argument, How can I execute the jar and let it know where the jndi.properties is? Thanks // Edit, error message java -jar Client2.jar Exception in thread "main" ja...

What is the best practice for including third party jar files in a Java program?

I have a program that needs several third-party libraries, and at the moment it is packaged like so: zerobot.jar (my file) libs/pircbot.jar libs/mysql-connector-java-5.1.10-bin.jar libs/c3p0-0.9.1.2.jar As far as I know the "best" way to handle third-party libs is to put them on the classpath in the manifest of my jar file, which wil...

Java: separating JAR versions

I'm developing a Java plugin for an existing Java program. The existing program uses a specific version of eclipse.uml2.* and my plugin does too. Unfortunately I need a newer version for my plugin. In order to run the plugin, I need to export it into a Jar file (with all jars packed). Then the program executes it. But somehow the new ec...

What is the smallest, legal zip/jar file?

I hate generating an exception for things that I can simply test with an if statement. I know that a zero length zip/jar will trigger an exception if you try to access it using the java.util.zip/java.util.jar APIs. So, it seems like there should be a smallest file that these utility APIs are capable of working with. ...

Jad file download link for my website

Hi sir/madam! I am putting up a small website via webs.com for me and my friends that could also be accessible via wap, i.e. mobile internet, and I want to add links to my site that downloads .jar files. I uploaded the files on my site, and links to the .jar files went fine, but I also need links for .jad files (for some mobile phones t...