Is there any way to specify explict classpath while using one-jar, my problem is simple, i wanna add external folder to my classpath, is there any way to pass this as a argument or so..
The reply of Mr. Simon for this question is as follows..
The solution should be simple: add the folder to the Class-Path: manifest attribute of the top-level one-jar file. This should augment the classpath for the top-level VM classloader and let it load your classes or resources. I think you can use relative paths if the folder is relative to where you run one-jar from (but not the location of the one-jar jar file, which may be in a different directory). But, beware: there may be classloader inversion issues if classes in the top-level jar files try to instantiate classes which are otherwise inside the one-jar classloader. This sometimes happens with provider architectures such as javax.mail where you specify your provider class as a string: since classes in javax.mail are loaded in the top-level (bootstrap) classloader they are unable to see inside the one-jar, and you will get class-not-found exceptions.
This issue arises when i try to use Openoffice jars in my application, i tried the above approach of Class-Path but it didn't worked for me, so i followed some other workarounds(which is not related to one-jar).
So anyone have the idea of including external jars in one-jar(like openoffice jars in their installation folder).
How did you add the jars? You have to add the full path to each Jar file if you use the META-INF/MANIFEST.MF Class-Path approach, which of course ties your application to the system it is running on, and makes it difficult to distribute.
Reading between the lines, what I'm hearing here is a new feature requirement that would allow One-JAR to scan a given directory for jar files, and automatically add those to the classpath. I would imagine that the directory should be something that would be specified as an environment variable (or registry variable on windows), to make it possible to One-JAR to discover installed external jar files when it arrives on a new system.
Is this correct? If so, this isn't trivial to implement, but the source is open so you might consider trying to solve this problem and contributing the code back to the project.
Yeah that's right, though i tried the method of adding the external jars to MANIFEST.MF still
it fails, exactly that's what the feature i need, sure I'll try to implement that and let you know.
Log in to post a comment.
Sign up for the SourceForge newsletter:
You seem to have CSS turned off.
Please don't fill out this field.