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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 13, 20262026-06-13T19:46:15+00:00 2026-06-13T19:46:15+00:00

Possible Duplicate: Override the compiler attribute in an Ant javac task In Ant, how

  • 0

Possible Duplicate:
Override the compiler attribute in an Ant javac task

In Ant, how exactly do I use the build.compiler option, or the <javac> task‘s compiler attribute?

I tried setting compiler="javac1.5", but when I opened the resulting class-file in a hex editor, the class version was still shown as 32 hex (version 1.6) — until I set JAVA_HOME to point to my JDK 1.5 installation. (Until then, it had been pointing to my JDK 1.6 installation.) So it seems like JAVA_HOME supersedes the compiler attribute — in which case, what is the purpose of that attribute?

The source and target attributes do seem to work correctly; when I specify the target version, the resulting class-file does have the right version.

  • 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-13T19:46:17+00:00Added an answer on June 13, 2026 at 7:46 pm

    The purpose of the attribute is to be able to choose something like gcj or jikes instead of the standard JDK compiler. javac1.5 (and javac1.6 etc.) is just an alias for modern, the standard compiler, and is defined simply to support the rule that the default value of build.compiler is javac1.x with x matching the running JDK (so the default is modern on 1.3 and higher and classic on 1.2 and below).

    If you want to compile classes that will run on 1.5 then you need to use source="1.5" target="1.5" and also set the bootstrap classpath to point to a 1.5 class library, to ensure you aren’t calling methods that were introduced in 1.6 or later.

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

Sidebar

Related Questions

Possible Duplicate: When do you use Java’s @Override annotation and why? From the javadoc
Possible Duplicate: PHP - override existing function I want to use mocking to unit
Possible Duplicate: When do you use Java's @Override annotation and why? My question is
Possible Duplicate: When do you use Java's @Override annotation and why? Java, What does
Possible Duplicate: How to merge a branch into another with override option in git
Possible Duplicate: When do you use Java’s @Override annotation and why? Is there any
Possible Duplicate: When do you use Java's @Override annotation and why? Newbie question -
Possible Duplicate: problem in ant build invalid target release Having issues building my project
Possible Duplicate: Java: Always override equals? should I override equals function for any class
Possible Duplicate: Overriding vs Virtual In C++, whether you choose to use virtual or

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.