Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8230055
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 7, 20262026-06-07T17:00:28+00:00 2026-06-07T17:00:28+00:00

I am trying to use the default-template in my Java project to generate the

  • 0

I am trying to use the default-template in my Java project to generate the launch script, based on the ivy dependencies specified in my project. The issue I am facing is that the ivy dependencies are getting picked up and put in the classpath but the main project jar is not getting included in the classpath.(Which gives a class not found exception while trying to run the script) On further investigation and comparison with other scripts I found that there is a line as.

export RUNTIME_CLASSPATH=""

in my generated script. This should have the path to my projects jar but is not getting populated (ex: export RUNTIME_CLASSPATH="$(dirname $0)/../lib/myproject.jar:")

Where exactly do we specify the project referring itself(calling project) in the script??
I have looked into all other files including the build properties, ivy, ivy settings to no avail.
It would be great If someone could help me find what I am missing.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-07T17:00:31+00:00Added an answer on June 7, 2026 at 5:00 pm

    ANT doesn’t have any standard functionality for generating OS specific launch scripts. What you can do is generate an executable jar which can be launched by running java as follows:

    java -jar demo.jar
    

    The key feature of an executable jar is it’s manifest that specifies both the main class and classpath:

    Manifest-Version: 1.0
    Ant-Version: Apache Ant 1.8.3
    Created-By: 1.6.0_20-b20 (Sun Microsystems Inc.)
    Main-Class: org.demo.App
    Class-Path: lib/slf4j-api-1.6.4.jar lib/slf4j-simple-1.6.4.jar
    

    The following ANT project demonstrates how ivy can assist in the creation of executable jars

    Example

    |-- build.xml
    |-- ivy.xml
    `-- src
        |-- main
        |   `-- java
        |       `-- org
        |           `-- demo
        |               `-- App.java
        `-- test
            `-- java
                `-- org
                    `-- demo
                        `-- AppTest.java
    

    Run the build

    ant clean build
    

    Execute the program

    java -jar build/dist/demo.jar
    

    jar is packaged to use dependencies located in a relative “lib” subdirectory

    build/dist/demo.jar
    build/dist/lib/slf4j-api-1.6.4.jar
    build/dist/lib/slf4j-simple-1.6.4.jar
    

    ivy.xml

    <ivy-module version="2.0">
        <info organisation="com.myspotontheweb" module="demo"/>
    
        <configurations>
            <conf name="compile" description="Required to compile application"/>
            <conf name="runtime" description="Additional run-time dependencies" extends="compile"/>
            <conf name="test"    description="Required for test only" extends="runtime"/>
        </configurations>
    
        <dependencies>
            <!-- compile dependencies -->
            <dependency org="org.slf4j" name="slf4j-api" rev="1.6.4" conf="compile->default"/>
    
            <!-- runtime dependencies -->
            <dependency org="org.slf4j" name="slf4j-simple" rev="1.6.4" conf="runtime->default"/>
    
            <!-- test dependencies -->
            <dependency org="junit" name="junit" rev="4.10" conf="test->default"/>
        </dependencies>
    
    </ivy-module>
    

    build.xml

    <project name="demo" default="build" xmlns:ivy="antlib:org.apache.ivy.ant">
    
        <!--
        ================
        Build properties
        ================
        -->
        <property name="src.dir"          location="src/main/java"/>
        <property name="test.src.dir"     location="src/test/java"/>
        <property name="build.dir"        location="build"/>
        <property name="classes.dir"      location="${build.dir}/classes"/>
        <property name="test.classes.dir" location="${build.dir}/test-classes"/>
        <property name="ivy.reports.dir"  location="${build.dir}/ivy-reports"/>
        <property name="test.reports.dir" location="${build.dir}/test-reports"/>
        <property name="dist.dir"         location="${build.dir}/dist"/>
    
        <property name="jar.main.class" value="org.demo.App"/>
        <property name="jar.file"       value="${dist.dir}/${ant.project.name}.jar"/>
    
        <!--
        ===========
        Build setup
        ===========
        -->
        <target name="init">
            <ivy:resolve/>
    
            <ivy:report todir='${ivy.reports.dir}' graph='false' xml='false'/>
    
            <ivy:cachepath pathid="compile.path" conf="compile"/>
            <ivy:cachepath pathid="runtime.path" conf="runtime"/>
            <ivy:cachepath pathid="test.path"    conf="test"/>
        </target>
    
        <!--
        ===============
        Compile targets
        ===============
        -->
        <target name="compile" depends="init">
            <mkdir dir="${classes.dir}"/>
            <javac srcdir="${src.dir}" destdir="${classes.dir}" includeantruntime="false" debug="true" classpathref="compile.path"/>
        </target>
    
        <target name="compile-tests" depends="compile">
            <mkdir dir="${test.classes.dir}"/>
            <javac srcdir="${test.src.dir}" destdir="${test.classes.dir}" includeantruntime="false" debug="true">
                <classpath>
                    <path refid="test.path"/>
                    <pathelement path="${classes.dir}"/>
                </classpath>
            </javac>
        </target>
    
        <!--
        ============
        Test targets
        ============
        -->
        <target name="test" depends="compile-tests">
            <mkdir dir="${test.reports.dir}"/>
            <junit printsummary="yes" haltonfailure="yes">
                <classpath>
                    <path refid="test.path"/>
                    <pathelement path="${classes.dir}"/>
                    <pathelement path="${test.classes.dir}"/>
                </classpath>
                <formatter type="xml"/>
                <batchtest fork="yes" todir="${test.reports.dir}">
                    <fileset dir="${test.src.dir}">
                        <include name="**/*Test*.java"/>
                        <exclude name="**/AllTests.java"/>
                    </fileset>
                </batchtest>
            </junit>
        </target>
    
        <!--
        =====================
        Build and run targets
        =====================
        -->
        <target name="build" depends="test">
            <ivy:retrieve pattern="${dist.dir}/lib/[artifact]-[revision](-[classifier]).[ext]" conf="runtime"/>
    
            <manifestclasspath property="jar.classpath" jarfile="${jar.file}">
                <classpath>
                    <fileset dir="${dist.dir}/lib" includes="*.jar"/>
                </classpath>
            </manifestclasspath>
    
            <jar destfile="${jar.file}" basedir="${classes.dir}">
                <manifest>
                    <attribute name="Main-Class" value="${jar.main.class}" />
                    <attribute name="Class-Path" value="${jar.classpath}" />
                </manifest>
            </jar>
        </target>
    
        <target name="run" depends="build">
            <java jar="${jar.file}" fork="true"/>
        </target>
    
        <!--
        =============
        Clean targets
        =============
        -->
        <target name="clean">
            <delete dir="${build.dir}"/>
        </target>
    
        <target name="clean-all" depends="clean">
            <ivy:cleancache/>
        </target>
    
    </project>
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I'm trying to use coffeekup as my default template app.set 'view engine', 'coffee' app.register
At the moment I'm trying to figure out how use default and custom settings
Hi I am trying to use NSUserDefaults to save some default values in database.
I'm trying to use Jeditable as an inline editing solution. The default behavior (click
Note: I can't use anything that is default. I am trying to make a
I have a scenario where-in I am trying to use the jQuery template plugin
I am trying to expand my template programming skills and I am facing a
The thing is, I am not (knowing trying to use any default constructor of
I'm trying to use Phil Sturgeon's CodeIgniter Template library , but I can't get
I'm following the Django tutorial . I've been trying to change the default template,

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.