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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 30, 20262026-05-30T06:27:13+00:00 2026-05-30T06:27:13+00:00

NOTE: Please do not comment on all the perils of cross-compiling. Thank you. I

  • 0

NOTE: Please do not comment on all the perils of cross-compiling. Thank you.


I have a situation where we need to have Java 6 source compiled for a Java 5 JVM (to be sure that JAX-WS usage is correct). Previously we have done this with ant ant script (which apparently can), but after migrating to Maven we have found that it ends up with javac complaining:

$ javac -source 1.6 -target 1.5
javac: source release 1.6 requires target release 1.6

Is there any Java distribution for Linux (Ubuntu 11.10, x86) where the javac can do this?


EDIT: It appears not, as the limitation is in javac which is the same. The solution (which made this need go away) was to change from the default javac compiler to the eclipse compiler in maven-compiler-plugin.


EDIT: I’ve found that the Eclipse compiler generates byte code for anonymous inner classes that the javadoc utility disagrees with. I am preparing a bug report for this issue.

  • 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-30T06:27:15+00:00Added an answer on May 30, 2026 at 6:27 am

    According to the documentation (Java 5, Java 6), the Oracle SDK should be able to do this when you follow the instructions in the Cross-Compilation Example.

    Java 6 should support any version between 1.3 to 1.6 as -target; it doesn’t say anything what happens when you use generics and other “compatible” features in the source. The compiler should be able to strip them.

    Another culprit in the game might be javac: The compiler might be able to handle this set of arguments but the command line tool might take offense.

    In this case, write your own command line using the Java Compiler API. That might allow to pull of some tricks that you can’t achieve otherwise.

    You can also try the Eclipse compiler (see “Using the batch compiler“).

    This might fail because of how Java works: Java X code can run on Java Y as long as X <= Y. So while you can easily compile Java 1.4 code for a Java 6 VM, the reverse is not always true.

    If everything else fails, write a preprocessor that reads the source and strips unsupported elements (like @Override on interfaces). As long as you compile the code with the annotations once in a while with Java 6, the converted code should be safe as well (unless your code stripper has a bug …)

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

Sidebar

Related Questions

Please note this is not a question about online/hosted SVN services. I am working
Please note that this is not homework and i did search before starting this
Please note: This is a question about the Eclipse plugin Subversive , and not
(Please note that I have seen a similar question on StackOverflow recently, however I
PLEASE NOTE, I have found a work around which actually works out better for
Below I have 2 css codes for a div, please note that the first
(Note, the code below are just examples. Please don't comment on the why this
Update: Please note I am not asking what a salt is, what a rainbow
[Please note that this is a different question from the already answered How to
Please note that I did ask this on Super User and received absolutely no

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.