Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

build ant jar in eclipse gives error

0 views
Skip to first unread message

Taruna

unread,
Feb 16, 2005, 5:37:12 AM2/16/05
to
Hi

I am having an application in eclipse which starts jetty server.
Application is running fine in eclipse but when i want to take the
application out of eclipse it creates problem.

Means I want to make ant jar inside eclipse. I had build.xml. When I ma
trying to make ant jar it says "Build Successful".

But while running the jar error comes
"Could not find main class. Program will exit."

I tried to run the jar through cmd prompt. It gives error :
java.io.FileNotFoundException: Software\PLC (The system cannot find
cified)
at java.io.FileInputStream.open(Native Method)
at java.io.FileInputStream.<init>(FileInputStream.java:106)
at java.io.FileInputStream.<init>(FileInputStream.java:66)
at sun.tools.jar.Main.run(Main.java:123)
at sun.tools.jar.Main.main(Main.java:904)

How should I go for making the ant jat withing eclipse.

I am having manifest file also.

My project structure is
Jetty
src
wrapper.jetty
java files
jre system library
commons-logging.jar
javax.servlet.jar
org.mortbay.jetty.jar
web
WEB-INF
lib
web.xml
index.html


My build.xml file is:
<?xml version='1.0'?>
<project name="Jetty" default="run" basedir=".">

<!-- set global properties for this build -->

<property name="version" value="8.3"/>

<property name="src" value="src"/>
<property name="build" value="build"/>
<property name="lib" value="lib"/>
<property name="classpath" value="classes"/>
<property name="jarname" value="jetty.jar"/>
<property name="docs" value="docs"/>
<property name="include" value="include"/>
<property name="runclass" value="org.mortbay.http.HttpServer"/>

<target name="init">
<!-- Create the build directory structure used by compile -->
<mkdir dir="${build}" />
<!-- Create the directory for the jar file -->
<mkdir dir="${lib}" />
<!-- Create the directory for the java docs -->
<mkdir dir="${docs}" />
</target>

<target name="compile" depends="init">
<!-- copy all .java files from ${src} to ${build} -->
<copy todir="${build}/">
<fileset dir="${src}" includes="**/*.java"/>
<!-- apply a substitution @version@ with the value of ${version} -->
<filterset>
<filter token="version" value="${version}"/>
</filterset>
</copy>
<!-- run javac to compile the source files -->
<javac srcdir="${build}" destdir="${build}">
<classpath>
<!-- use the value of the ${classpath} property in the classpath -->
<pathelement path="${classpath}"/>
<!-- include all jar files -->
<fileset dir="${include}">
<include name="**/*.jar"/>
</fileset>
</classpath>
</javac>

</target>

<target name="jar" depends="compile">
<!-- make a jar file -->
<jar jarfile="${lib}/${jarname}" basedir="${build}/">
<manifest>
<attribute name="Main-Class" value="org.mortbay.http.HttpServer" />
<attribute name="Class-Path" value="include/**"/>
</manifest>
</jar>

</target>
<!--
<target name="docs" depends="compile">
create javadocs
<javadoc packagenames="wrapper.jetty.*"
sourcepath="${build}"
destdir="${docs}">
</javadoc>

</target>
-->
<target name="run" depends="jar">
<!-- run the class -->
<java classname="${runclass}">
<!-- add a command line arg: <arg value="-h"/> -->
<classpath>
<!-- use the value of the ${classpath} property in the classpath -->
<pathelement path="${classpath}"/>
<!-- include all jar files -->
<fileset dir="${include}">
<include name="**/*.jar"/>
</fileset>
<fileset dir="${lib}">
<include name="**/*.jar"/>
</fileset>
</classpath>
</java>

</target>

<target name="clean">
<!-- Delete the ${build} and ${lib} directory trees -->
<delete dir="${build}"/>
<delete dir="${lib}"/>
<delete dir="${docs}"/>
</target>
</project>


My java files in src folder does not have main class. Basiccaly it should
use jetty jar main class for running

Thank you in advance

Taruna

0 new messages