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 8097823
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 5, 20262026-06-05T21:53:05+00:00 2026-06-05T21:53:05+00:00

I have a situation where we wrap a jar with JSmooth to get an

  • 0

I have a situation where we wrap a jar with JSmooth to get an suitable exe file.

This has traditionally been built by ant, and as part of our general mavenification the current, short-term solution has been to use maven-antrun-plugin to set a property and invoke ant.

Unfortunately this approach fails when building on Unix (as there is no X11 display available) and the solution is to invoke the JVM with -Djava.awt.headless=true. I would like to do this in my pom.xml but cannot identify where to do this.

<plugin>
    <artifactId>maven-antrun-plugin</artifactId>
    <version>1.7</version>
    <executions>
        <execution>
            <phase>package</phase>
            <configuration>
                <target>
                    <!-- create one-jar and exefy it -->
                    <property name="maven.project.build.finalName" value="${project.build.finalName}" />
                    <!-- note: fails on headless Linux for now -->
                    <ant />
                </target>
            </configuration>
            <goals>
                <goal>run</goal>
            </goals>
        </execution>
    </executions>
</plugin>

It is ok to fork a new JVM directly but not to rely on platform specifics.

How can I do this correctly?

  • 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-05T21:53:07+00:00Added an answer on June 5, 2026 at 9:53 pm

    The ant manual has a section titled “Running Ant via Java” that shows how to do just what you want. A slightly tweaked version of their example is reproduced below:

    <java
            classname="org.apache.tools.ant.launch.Launcher"
            fork="true"
            failonerror="true"
            dir="${basedir}"
            taskname="headless-ant"
    >
        <classpath>
            <pathelement location="${ant.home}/lib/ant-launcher.jar"/>
        </classpath>
        <arg value="-buildfile"/>
        <arg file="${ant.file}"/>
        <arg value="-Dbasedir=${basedir}"/>
        <jvmarg value="-Djava.awt.headless=true"/>
    </java>
    

    If you put that snippet in place of the <ant> element in your snippet, it should do the trick.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

i have situation like this: class IData { virtual void get() = 0; virtual
I have situation like this: user submits form with action='/pay' in '/pay' I have
Pseudo-situation: have a class (let's say BackgroundMagic ), and it has Start() and Stop()
Finding myself in the situation where I have a method with this signature void
I have a unique situation with setStringValue: and hoping someone could clear this up:
Situation: I have a wrapper panel UserControl like this (namespaces and visual details removed
I have situation like this: <ul> <li> <a href=#>Link 1</a> <ul> <li><a href=>Sub link</a></li>
I know many have asked this question, but I think my situation is a
I have a situation that I can not wrap my head around at the
I have the following situation: in the main file I do setContentView(R.layout.main); which looks

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.