Search...
FAQs
Subscribe
Pie
FAQs
Recent topics
Flagged topics
Hot topics
Best topics
Search...
Search within Java in General
Search Coderanch
Advance search
Google search
Register / Login
Post Reply
Bookmark Topic
Watch Topic
New Topic
programming forums
Java
Mobile
Certification
Databases
Caching
Books
Engineering
Micro Controllers
OS
Languages
Paradigms
IDEs
Build Tools
Frameworks
Application Servers
Open Source
This Site
Careers
Other
Pie Elite
all forums
this forum made possible by our volunteer staff, including ...
Marshals:
Campbell Ritchie
Ron McLeod
Paul Clapham
Tim Cooke
Devaka Cooray
Sheriffs:
Liutauras Vilda
paul wheaton
Rob Spoor
Saloon Keepers:
Tim Moores
Stephan van Hulst
Tim Holloway
Piet Souris
Mikalai Zaikin
Bartenders:
Carey Brown
Roland Mueller
Forum:
Java in General
How to package and run my application?
Bin Smith
Ranch Hand
Posts: 514
1
I like...
posted 10 years ago
Number of slices to send:
Optional 'thank-you' note:
Send
Hello!
I have project in which there is
ant
file given below. I need somehow to run main class from command-line.
But I don't know how to modify this ant file to tell it include Main-Class property in MANIFEST.MF file which should be in swarm.jar.
<project name="USGS VHP" default="help" basedir="."> <description>USGS VHP Main Build File</description> <property name="root" location="." /> <property name="classdir" value="classes" /> <property name="contrib" value="http://volcanoes.usgs.gov/software/contrib" /> <target name="help"> <echo> Available targets: help -- displays this help information init -- clean -- deletes lib/*.jar files touch -- touch *.java in source tree contrib -- download the contrib library (use before building) build -- build the USGS codebase (use after checkout *) </echo> </target> <target name="init"> </target> <target name="clean"> <delete> <fileset dir="${root}/lib/" includes="*.jar" /> </delete> </target> <target name="touch"> <touch> <fileset dir="${root}/../" includes="**/*.java" /> </touch> </target> <target name="contrib" depends="init" description="Download the contrib libraries"> <mkdir dir="${root}/contrib" /> <get src="${contrib}/colt.jar" dest="${root}/contrib/colt.jar" /> <get src="${contrib}/comm.jar" dest="${root}/contrib/comm.jar" /> <get src="${contrib}/commons-collections-3.2.1.jar" dest="${root}/contrib/commons-collections-3.2.1.jar" /> <get src="${contrib}/fissuresIDL-1.0.jar" dest="${root}/contrib/fissuresIDL-1.0.jar" /> <get src="${contrib}/fissuresImpl-1.1.13.jar" dest="${root}/contrib/fissuresImpl-1.1.13.jar" /> <get src="${contrib}/fissuresUtil-1.0.18.jar" dest="${root}/contrib/fissuresUtil-1.0.18.jar" /> <get src="${contrib}/forms-1.0.7.jar" dest="${root}/contrib/forms-1.0.7.jar" /> <get src="${contrib}/jai_codec.jar" dest="${root}/contrib/jai_codec.jar" /> <get src="${contrib}/jai_core.jar" dest="${root}/contrib/jai_core.jar" /> <get src="${contrib}/jnlp.jar" dest="${root}/contrib/jnlp.jar" /> <get src="${contrib}/JSAP-2.1.jar" dest="${root}/contrib/JSAP-2.1.jar" /> <get src="${contrib}/jtransforms-2.4.jar" dest="${root}/contrib/jtransforms-2.4.jar" /> <get src="${contrib}/log4j-1.2.13.jar" dest="${root}/contrib/log4j-1.2.13.jar" /> <get src="${contrib}/looks-2.0.4.jar" dest="${root}/contrib/looks-2.0.4.jar" /> <get src="${contrib}/mysql.jar" dest="${root}/contrib/mysql.jar" /> <get src="${contrib}/rrd4j-2.0.5.jar" dest="${root}/contrib/rrd4j-2.0.5.jar" /> <get src="${contrib}/JavaSeedLite.jar" dest="${root}/contrib/JavaSeedLite.jar" /> <get src="${contrib}/seedCodec-1.0.6.jar" dest="${root}/contrib/seedCodec-1.0.6.jar" /> <get src="${contrib}/servlet.jar" dest="${root}/contrib/servlet.jar" /> <get src="${contrib}/seisFile-1.5.2.jar" dest="${root}/contrib/seisFile-1.5.2.jar" /> <get src="${contrib}/slf4j-api-1.7.1.jar" dest="${root}/contrib/slf4j-api-1.7.1.jar" /> <get src="${contrib}/slf4j-log4j12-1.7.1.jar" dest="${root}/contrib/slf4j-log4j12-1.7.1.jar" /> <get src="${contrib}/javassist.jar" dest="${root}/contrib/javassist.jar" /> <get src="${contrib}/thymeleaf-2.0.13.jar" dest="${root}/contrib/thymeleaf-2.0.13.jar" /> <get src="${contrib}/ognl-2.6.7.jar" dest="${root}/contrib/ognl-2.6.7.jar" /> <get src="${contrib}/oscache-2.1-mod2.jar" dest="${root}/contrib/oscache-2.1-mod2.jar" /> <get src="${contrib}/seedlink_lite_1.2.1.jar" dest="${root}/contrib/" /> <get src="${contrib}/seedlink_lite_src_1.2.1.jar" dest="${root}/contrib/" /> <get src="http://repo1.maven.org/maven2/com/h2database/h2/1.3.173/h2-1.3.173.jar" dest="${root}/contrib/h2.jar" /> </target> <target name="build" depends="init" description="Build USGS codebase"> <!-- Order is important. Some projects depend on others. --> <ant target="jar" inheritAll="false" antfile="${root}/../Util/build.xml" /> <ant target="jar" inheritAll="false" antfile="${root}/../Math/build.xml" /> <ant target="jar" inheritAll="false" antfile="${root}/../Net/build.xml" /> <ant target="jar" inheritAll="false" antfile="${root}/../Plot/build.xml" /> <ant target="jar" inheritAll="false" antfile="${root}/../Pinnacle/build.xml" /> <ant target="jar" inheritAll="false" antfile="${root}/../VDX/build.xml" /> <ant target="jar" inheritAll="false" antfile="${root}/../Valve3/build.xml" /> <ant target="jar" inheritAll="false" antfile="${root}/../Earthworm/build.xml" /> <ant target="jar" inheritAll="false" antfile="${root}/../Winston/build.xml" /> <ant target="jar" inheritAll="false" antfile="${root}/../Swarm/build.xml" /> </target> <target name="jar" depends="build" description="Create one large jar file"> <jar destfile="${root}/lib/usgs.jar"> <fileset includes="**/**.class" dir="${root}/../Util/${classdir}" /> <fileset includes="**/**.class" dir="${root}/../Earthworm/${classdir}" /> <fileset includes="**/**.class" dir="${root}/../Math/${classdir}" /> <fileset includes="**/**.class" dir="${root}/../Net/${classdir}" /> <fileset includes="**/**.class" dir="${root}/../Pinnacle/${classdir}" /> <fileset includes="**/**.class" dir="${root}/../Plot/${classdir}" /> <fileset includes="**/**.class" dir="${root}/../Swarm/${classdir}" /> <fileset includes="**/**.class" dir="${root}/../Valve3/${classdir}" /> <fileset includes="**/**.class" dir="${root}/../VDX/${classdir}" /> <fileset includes="**/**.class" dir="${root}/../Winston/${classdir}" /> </jar> </target> </project>
Finally I need to create windows batch file that will run main class in swarm.jar?
Thank you!
To earn money on java go to upwork.com
Saif Asif
Ranch Hand
Posts: 439
I like...
posted 10 years ago
Number of slices to send:
Optional 'thank-you' note:
Send
There is a manifest tag that you can use in your parent jar tag. Look at snippet below
<target name="jar"> <mkdir dir="build/jar"/> <jar destfile="build/jar/FinalJarNameHere.jar" basedir="build/classes"> <manifest> <attribute name="Main-Class" value="com.package.YourMainClassHere"/> </manifest> </jar> </target>
As for the batch file , I would first like you to try it out yourself and post whatever you have tried here and then I will guide you along the way !
Muhammad Saif Asif Mirza
OCJA(5/6) OCJP(6) OCJWCD(6)
You’ll find me in my office. I’ll probably be drinking. And reading this tiny ad.
We need your help - Coderanch server fundraiser
https://coderanch.com/wiki/782867/Coderanch-server-fundraiser
reply
reply
Bookmark Topic
Watch Topic
New Topic
Boost this thread!
Similar Threads
configuration details of commons-configuration
Building Seam projects in Eclipse
ant build is taking 90 minutes taking to build weblogic portal ear file
problem in making jar and war based on the 'src' package hierarchy!
BUILD FAILED in Build.xml
More...