jar

How to use a file in a jar as javax.net.ssl.keystore?

I'm trying to do something like URL clientks = com.messaging.SubscriptionManager.class.getResource( "client.ks" ); String path = clientks.toURI().getPath(); System.setProperty( "javax.net.ssl.keyStore", path); Where client.ks is a file stored in com/messaging in the jar file that I'm running. The thing that reads the javax.net.ssl.k...

Can I extract a file from a jar that is 3 directories deep?

I have a jar file that has a file named "client.ts" in (when viewing in ZipGenius) "/com/something/messaging". When I do JarFile jarFile = new JarFile("Client.jar"); JarEntry zipFile = jarFile.getJarEntry("client.ts"); It can't find the "client.ts" file. If I package the file in "/resources/" instead it can find it. Does JarFile.getE...

Listing the files in a directory of the current JAR file

I am making a game in JAVA where I want to come up with a list of files in a certain directory in my jar so I can make sure to have a list of those classes to be used in the game. For example say in my jar I have a directory mtd/entity/creep/ I want to get a list of all the .class files in that directory using java code from another...

How to include directory structure in an ant jar file?

I am a bit of an ant newbie, and I'm having trouble making a jar correctly. As an example, say I want to make a jar with my StringUtil class. Using the following ant directive, I can create the jar, but the problem is that the directory structure is lost. It simply puts StringUtil.class in the base directory of the jar. How can I correct...

Difference between classpath and endorsed directory

Does anyone know what the difference is between adding an appropriate JAR-file (eg. Apache XALAN) to a JRE's endorsed directory and adding it to the application's classpath? Is it possible to take a jar-file that can be added to the endorsed lib and instead add it to the classpath? ...

Running Jar file in Windows

I have a "helloworld.jar" file. For running a JAR file I am using a command-line window and executing the following command: java -jar helloworld.jar By using this command I can execute the JAR file. But instead of doing it in a command-line window, I want to execute the JAR file if I double click on the JAR file. I did some Googl...

How do I get just the jar URL from a jar: URL containing a ! and a specific file in the jar?

Hi, I get a jar file url at runtime as: jar:file:/C:/proj/parser/jar/parser.jar!/test.xml How can this be converted to a valid path as: C:/proj/parser/jar/parser.jar. I have already tried using File(URI), getPath(), getFile() in vain... ...

How do I read a resource file from a Java jar file?

I'm trying to access an XML file within a jar file, from a separate jar that's running as a desktop application. I can get the URL to the file I need, but when I pass that to a FileReader (as a String) I get a FileNotFoundException saying "The file name, directory name, or volume label syntax is incorrect." As a point of reference, I h...

invalid header file while using jar for archiving

When i use this cmd line : jar cmf arshad.mf ars.jar *.class i get this error : invalid header field name:Manifest-version This is my manifest file : Manifest-Version: 1.0 Main-Class:t i made the manifest file with notepad in UTF-8 encoding - is there any problem with the manifest ? ...

How to run test cases on a list of slightly different jars ?

I have a list of jar files, all containing slightly different versions of the same system. I want to execute a set of test cases on each jar file while being able to obtain the results for each jar (via RunListener or something like that). I am a bit confused with the class loading problems that are implied. How can I nicely do this ?...

Netbeans 6.5 generates a lib folder when creating a GUI...

How do I create a jar that incorporates the lib folder so I can email a single jar. As it is if I don't include the lib folder and the jar folder the jar will not work. I would like to add the lib folder to the main jar so I only need to send someone a single jar. ...

Passing Parameters to Jar file

How do i pass parameters to a jar file at the time of execution? Thanks, Krisp ...

(Java) How can I override a class using a separate jar?

A customer requires a preview of a new feature of our product. They asked to have that feature sent to them in a jar file (like a patch). There's no problem with including the new classes in said jar file. However, an existing class was modified, which is needed to integrate the new feature. They just want to add this new jar file withou...

How to use classes from .jar files?

I read the Java tutorials on Sun for JAR files, but I still can't find a solution for my problem. I need to use a class from a jar file called jtwitter.jar, I downloaded the file, and tried executing it(since I came to know yesterday that .jar files can be executed by double clicking on them) and Vista gave me an error saying "Failed to ...

Creating a new file using an existing file within a jar

Let's say I have a file called test.txt within the package "com.test.io" within my jar. How would I go about writing a class which retrieves this text file and then copies the contents to a new file on the file system? ...

How do I attach properties files to a jar?

I have a project that uses the serial port, and it requires two files to run, the win32.dll file (which is in the java runtime environment bin folder) and the javax.comm.properties file (which is in the java runtime environment lib folder). When I run the project from eclipse it works, but when I try to build a jar file for distribution,...

How to determine which classes are used by a Java program?

Is there any tool that lists which and when some classes are effectively used by an app or, even-better, automatically trims JAR libraries to only provide classes that are both referenced and used? ...

How do you figure out with Eclipse which JARs depend on which one?

I've trying to use Eclipse JDT AST parsing classes. After including the initial JAR, and sorting out a couple more dependencies, it is with 7+ JARs and I still having NoClassDefFoundError exceptions. This situation arises whenever I'm trying to test libraries with little or no documentation. Trial and error seems a very dumb (and annoyin...

Specifying classpath for classes inside the JAR itself

If I have a class org.foobar.MyClass and want to put it in a JAR file, do I have to put it in the JAR's /org/foobar/ directory, or can I put it in /bin/org/foobar/ and somehow specify /bin/ as classpath inside the JAR itself? ...

Can I get Eclipse File Search to include ivyde jars?

The Eclipse File Search dialog doesn't seem to be playing nicely with my ivyde (2.0.0beta1) dependency jars. That is, my ivyde brings some-dep.jar/some-dep.zip (class/source), but I don't see any way to get my file search (ctrl+h search) to include these resources when searching for text -- so if MAGIC_FLAG appears only in the Magic clas...