jar

On the fly class loading with jars

I've got a ClassLoader extending class with following method @Override public Class<?> findClass(String className) throws ClassNotFoundException { try { /** * Get a bytecode from file */ byte b[] = fetchClassFromFS(pathtobin + File.separator + className.replaceAll("\\.", escapeSeparator(F...

Advantages/disadvantages of building one huge jar as opposed to several smaller?

I have seen programs like http://one-jar.sourceforge.net/ and http://fjep.sourceforge.net/index.html promote rolling your application jar and any dependencies into a single, executable jar. What are the main reasons for/against doing this? ...

How can I use jar libraries in Android compiled with packages that Android doesn't have

I need to import a couple of jars that where compiled under the full implementation of java. I know that Android doesn't use all the packages that java has to offer. My question is: Is it possible to import them without creating errors? Is there a tool that can convert jars to android jars? if so, can some examples be provided. Any help ...

Minimizing jar dependency sizes

Hello, an application I have written uses several third party jars. Sometimes only a small portion of the entire 50kB to 1.7mB jar is used - one or two function calls or classes. What is the best way to reduce the jar sizes. Should I download the sources and build a jar with just the classes I need? What existing tools can help automa...

Open file; try filesystem first, then JARs

I'm trying to have my application load a resource (binary file) transparently: If the file exists under the current directory, open it. If not, try looking in the current JAR file if applicable. If not, try looking in other JAR files. (This is optional and I don't mind explicitly specifying which JAR files.) So far I know of File which...

When will the "jar" command refuse to add a class to a .jar file?

Hi. I have 204 total classes (most of the classes are inner classes). For months, I have been building fine with SCons (SCons just calls the jar command). For some reason, it stopped adding the last inner class for a particular class. For example, suppose I have the following classes: class1 class2 class3 class4 class5 class6 ... cl...

What's the best way to manage dependencies with CounterClockwise/Eclipse?

I have a dependency on clj-record in my CounterClockwise project. What's the best way to manage this? Copy the source code or compile to a JAR and add it as a referenced library? ...

Load fonts out of JAR-file and create AWT font (works) and register iText font (does not work)

Hello! I tried to write an applet that is able to create a PDF with an embedded font. Everything works as long as it is not in an JAR file. The following code part shows that I first create the AWT Font (which works fine with and without beeing stored in a JAR-file). Then I want to register an iText (5.0.3) font. But here comes the err...

Set classpath in manifest.mf to access config files outside an executable jar.

I'm building an executable jar for a maven java project I have. It works great but I have a problem in that I want my config directory to live outside the jar so that I can change things easily if needed. I've got to the point where I have the jar being built without the config include and the the config directory is placed in the same ...

Get resource from jar

I have jar with files: myJar/res/endingRule.txt myJar/wordcalculator/merger/Marge.class In Marge.java I have code: private static final String ENDINGS_FILE_NAME = "res/endingRule.txt"; .... InputStream inputStream = getClass().getClassLoader().getResourceAsStream(ENDINGS_FILE_NAME); ..... But after this inputStream is null. How to...

way to merge jars in maven ?

Hi, I have a maven project which uses the shade plugin to create a jar from several projects. In addition it is possible with this plugin to create a source jar from these several projects. For legacy reason we need to have one jar which contains classes and sources, so the combination of the two jars created by the shade plugin. Wha...

What happens if a Jar is updated while it is still being used by a JVM?

I know that, under typical conditions, a class is only loaded once. I also know that classes are immutable. Thus, once the class is loaded, it cannot be changed unless it is reloaded (which typically doesn't happen). Does the same thing hold true for Jars? What happens if a Jar is updated while a JVM is still running that had previously...

Where is the source code for the jar program ?

Where is the source code of the Jar program ? Specifically, looking for a way to implement the jar uvf feature to update or append to an existing archive. Looking at this bug report, there seems to be no hope of doing this from the regular Java JAR/ZIP API. ...

ant : jar and zipfileset - copy files from one JAR into another

I am currently doing this: <jar update="yes" jarfile="${pwd}/dist/${release}_installer.jar"> <zipfileset src="${pwd}/dist/app.jar" includes="com/izforge/izpack/panels/**"/> <zipfileset src="${pwd}/dist/app.jar" includes="com/xyz/img/logo.png"/> </jar> My existing installer JAR gets updated to include the file...

How to serve jar files over http with JBoss

Hi, The title is a little bit general so let me give you some background: Our application consists of: A client-side swing executable (core.jar) which downloads modules (jar files) via http The modules which provide the GUI and initiate server interaction (war files) And the server infrastructure (war files) which host modules (jars ...

Not able to copy jar to an absolute path

I am trying to copy Demo.jar file (generated by an ant task) on my desktop(or any directory specified by it's absolute path on my XP machine). I am specifying absolute path in a properties file and reading it on the fly. The problem is I am not able to read this absolute path properly, where I want my Demo.jar to be copied. Absolute pa...

Java: can't load applications.properties

Hello, I have a basic executable JAR with manifest.txt containg the MainClass and some other jar dependencies. I wanted to move my config file, "application.properties" outside the jar into a directory where it's easy to configure/maintain. The java code does a simple ResourceBundle.getBundle('application.props') to load it. I have a...

Java method parameter names from a JAR file in Eclipse

Hello. I created a Java library with an ant file to build it into a JAR. When I use this JAR file from another Java project, the method parameter names appear as in Eclipse method hint/autocomplete: arg0, arg1, arg... for instance, the method: void publishStatus(String jobId, int count); appears as: void publishStatus(Str...

How can I get the function sinatures from a jar file?

In Eclipse or NetBeans, when you "control + click" into a function, you can at least see its entire signature, even if it's in a jar file. I am wonderging if it's possible to write a tool to pull out all the function signatures from a jar file. Is there any API for this? I know jDepend seems to offer functions for this. However, I beli...

Is there an easy to install generic JMX browser anywhere?

I am looking for something which is just a single jar file prerably and I can run with: java -jar jarname.jar ...