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

  • Home
  • SEARCH
  • 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 6086225
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 23, 20262026-05-23T11:43:40+00:00 2026-05-23T11:43:40+00:00

I am programmatically using Ant to compile a set of Java files (using the

  • 0

I am programmatically using Ant to compile a set of Java files (using the javac task). On execution of the Java program, I get the error:

Error starting modern compiler

However, when I run the same build.xml from command-prompt instead of through the program, compilation takes place without any problesms.

Another question (http://stackoverflow.com/questions/2577790/error-starting-modern-compiler) seems to suggest that this error is caused when Ant tries to use a different version of javac from the one already loaded into the JVM. However, I am not specifying any particular compiler to be used, and the documentation (http://ant.apache.org/manual/index.html) seems to suggest that it should ideally used the javac loaded into the JVM.

The program works on some machines but fails on others, the only discernable difference between the machines being the environment variables. The program needs to be executed on several different machines, each having slightly varying environment variables. So changing these variables is not an acceptable solution.

I guess what I am looking for is some way to specify to Ant that for the javac task, use the compiler available in the JVM currently.

  • 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-05-23T11:43:40+00:00Added an answer on May 23, 2026 at 11:43 am

    How exactly do you start ant from your java program ?
    Via Java api like

    File buildFile = new File("build.xml");
    Project p = new Project();
    ...
    

    via ant.bat / ant.sh ?
    from IDE like Eclipse ?

    Do you use JDK or JRE (the tools.jar is needed for javac) ?
    Do you use fork=true in the javac task ?
    Do you use the same user for ant via java and ant via commandline ?

    use :
    ant – diagnostics
    ant -debug
    ant -verbose

    <echoproperties prefix="ant"/>
    <echoproperties prefix="java"/>
    

    to get more details.

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

Sidebar

Related Questions

What's the better way to insert cell comments in excel 2007 files programmatically using
I want to create UI elements programmatically without using xib files. All of the
I am trying to set speakerphone on in a call programmatically using audiomanager.setSpeakerphoneOn(true) in
How can I get the wan IP address for my machine programmatically using C#
I've been trying to get into the 'C:\Windows\System32\winevt\Logs' folder programmatically using C# so I
I'm using Ant to build some Java projects. In some, I've got a lib/
How does one create a JAR file programmatically using java.util.jar.JarOutputStream ? The JAR file
I want to run a query programmatically using java on a sql server database
I want to know how to set layout_marginLeft, layout_marginTop, layout_marginBottom programmatically using screen height
I have tried invoking Ant programmatically, but I am encountering this error Exception in

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.