java - bundled executable jar file - couldnot find main class -


i trying execute jar file startuputil.jar it's giving error of couldnot find , load main class. looked @ other similar question , tried couldnot figure out wrong.

my structure created startuputil.jar

->com.ihc.startup.util.startupservice

->meta-inf/manifest.mf

the content of manifest is:

manifest-version: 1.0 ant-version: apache ant 1.9.2 created-by: 1.7.0_79-b15 (oracle corporation) main-class: com.ihc.startup.util.startupservice class-path: c:\users\tgupta12\workspace_new\ihc_startup\lib\bson-3.0.1  .jar c:\users\tgupta12\workspace_new\ihc_startup\lib\mongodb-driver-3  .0.1.jar c:\users\tgupta12\workspace_new\ihc_startup\lib\mongodb-driv  er-core-3.0.1.jar c:\users\tgupta12\workspace_new\ihc_startup\classes 

here build.xml

<?xml version="1.0" encoding="utf-8"?> <project name="startup" default="build" basedir=".">     <property file="./build.properties" />      <path id="lib-classpath">         <fileset dir="${libapp.dir}">             <include name="*.jar"/>         </fileset>         <pathelement path="${bin.dir}"/>     </path>      <target name="build" description="compile main source tree java files">         <echo message="  build startup utility" />         <mkdir dir="${bin.dir}"/>          <echo message="  compiling source files" />         <javac destdir="${bin.dir}" source="${versionjdk}" target="${versiontarget}" debug="true"              deprecation="false" optimize="false" failonerror="true" includeantruntime="false">             <src path="${src.dir}"/>             <classpath refid="lib-classpath"/>         </javac>         <echo message="  ...compilation of source files ok" />          <echo message="  generating jar startup - startuputility.jar" />         <delete file="${out.dir}/${startup-util-name}" />         <!-- convert classpath flat list/string -->         <pathconvert property="lib.classpath" pathsep=" ">             <path refid="lib-classpath" />             <!--<flattenmapper />-->         </pathconvert>          <jar destfile = "${out.dir}/${startup-util-name}" basedir = "${bin.dir}" includes = "**/*">             <manifest >                 <attribute name="class-path" value="${lib.classpath}" />                 <attribute name="main-class" value="com.ihc.startup.util.startupservice"/>             </manifest>         </jar>         <echo message="  ...jar created startup" />      </target>  <target name="run" depends="build">     <java jar="${out.dir}/${startup-util-name}" fork="true"/> </target> 

below build.properties file:

#directories build.dir=build src.dir=src libapp.dir=lib out.dir=out web.dir=webcontent/web-inf bin.dir=classes webcontent.dir=webcontent  #file name war-file-name=startupservice.war startup-util-name=startuputil.jar  #target properties versionjdk=1.7 versiontarget=1.7 

when tries execute target run gives

error: not find or load main class com.ihc.startup.util.startupservice

i suspect problem can't find dependencies, means can't load main class. i've never seen absolute filenames given in manifest before, nor convinced how you're breaking lines (although may valid). given how unportable use absolute filenames, suggest use relative ones.

change manifest just:

manifest-version: 1.0 ant-version: apache ant 1.9.2 created-by: 1.7.0_79-b15 (oracle corporation) main-class: com.ihc.startup.util.startupservice class-path: bson-3.0.1.jar mongodb-driver-3.0.1.jar mongodb-driver-core-3.0.1.jar 

then put jar files in same directory startuputil.jar.


Comments

Popular posts from this blog

javascript - Bootstrap Popover: iOS Safari strange behaviour -

Magento/PHP - Get phones on all members in a customer group -

session - Logging Out Using PHP -