0
I have Java SE 1.7.
javac = 1.7.0_79 
java version = "1.7.0_79"
Eclipse = Luna.

I want to compile at 1.6 level. I use an Ant build script.

Ant record directive. Output below:

'-target'
'1.6'
'-g'
'-source'
'1.6'

...
    [javac] warning: [options] bootstrap class path not set in conjunction with -source 1.6
    [javac] Note: Some input files use unchecked or unsafe operations.
    [javac] Note: Recompile with -Xlint:unchecked for details.
    [javac] 1 warning

I get following error:

Unsupported major.minor version 51.0

javac -target 1.6 -source 1.6 at command line works as expected.

The following answers this question:

bootclassloader-stackoverflow

Get the rt.jar from your final destination machine. bootclasspath must point to this rt.jar, somehow.

Community
  • 1
  • 1
Jacob
  • 349
  • 1
  • 2
  • 12
  • What *exact* Eclipse settings did you change? Please show a screenshot. – Jon Skeet Aug 04 '15 at 18:53
  • Duplicate of [Target JRE in Eclipse](http://stackoverflow.com/questions/9092284/target-jre-in-eclipse) – Mick Mnemonic Aug 04 '15 at 18:55
  • Think I asked wrong question. I have an ant script that I am using to build. I need to look at ant, correct? – Jacob Aug 04 '15 at 19:54
  • javac source="1.6" target="1.6" still no good... – Jacob Aug 04 '15 at 19:58
  • javac -target 1.6 -source 1.6 HelloWorld.java. Confirmed from command line that all works as expected using javac 1.7.0_79. Great...Now how to get Ant/Eclipse to the party. – Jacob Aug 04 '15 at 20:51

1 Answers1

0

Somewhere in the ant file there is a javac target.
This has an option "target=
There you set "1.6"

If you have doubts what ant uses, start it with option -v this will ouput all actions to console.

about your warning, see: https://blogs.oracle.com/darcy/entry/bootclasspath_older_source

AlexWien
  • 28,470
  • 6
  • 53
  • 83
  • Youhave another problem, like I have now. There is something unclean e.g JRE and JDK differently at yourmachine: see also http://stackoverflow.com/questions/10382929/how-to-fix-unsupported-major-minor-version-51-0-error – AlexWien Aug 04 '15 at 20:34