I have created a mail.jar file and mywar.war file. What I need to set into the manifest.mf use the mail.jar as a library?
You don't use a MANIFEST.MF to put a jar in the classpath of a war file. You just put it into WEB-INF/lib in the war file.
Class-Path: ../relative/path_to_/mail.jar
EDIT:
Note: The relative path should be with reference from the directory where your program is starting.
Related
I need a way to include a folders and files inside the META-INF directory when creating a jar using ant task.
Currrently I am using <metainf> tag , which is only including the files but not the folders.
Can anyone please help me.
Add new folder TEMP-INF under src\main\java
Put all the files and folders, which you wish to include in your JAR's META-INF into this newly created TEMP-INF
Now open build.xml file and search for
<jar> </jar> tag
Add <metainf dir="src/main/java/TEMP-INF"/> into <jar></jar>
And its done.
What does it mean when it says to add a file to the classpath? Something like this:
// The configuration file we created. It must be in the classpath.
outEncryptionProps.put(WSHandlerConstants.ENC_PROP_FILE, "client_encryption.properties");
I use GGTS and I have other files other than properties file that I need to add to my project's classpath.
The classpath is a collection of jars and directories that are used to resolve classes and resources. In practice for files like this putting them in the classpath means that you should put it in a directory that's included in the classpath, or a directory whose contents are copied to a classpath folder during compilation.
In Grails you can put non-source files in grails-app/conf, src/java, or src/groovy and they'll be copied into the classpath.
i have a Apache Ant build.xml to create a simple executeable jar file, but this file is very big.
Now i have the idea to build a executeable jar file with my code and have a directory named "lib" with all external jar files.
I think this will reduce the size of my application to 3%.
Thanks for your help.
Kindly suggest how to build exploded jars using Ant task?
Thanks.
An exploded jar is simply a directory which has the same structure as a jar file. Just use copy, for example, to put all the files you want in this directory.
I have a log4j.properties that sit right under the src folder. When I building my war file using ANT tool, the particular properties file wasn't pack inside WEB-INF/classes folder, and it was right under the "root" directory of the war file (if you unwar it). I heard from my colleague mention that this is not correct. May I know is this true? If no, how should I correct it?
THanks #!
Yes, log4j.properties (or any other resource loaded from the classpath) should be at the root of your Java source folder (src/main/java, build/main, src, JavaSource, or however you have your project configured).
In the WAR, it should be under WEB-INF/classes, not at the root (as if you unzipped it).
If this is not the case, being able to see your ANT build file would be very helpful. You should have something like this line configured within your war task:
<classes dir="build/main"/>
As long as you have a build/main/log4j.properties in your Ant basedir, this should work as you're expecting.