K
Kenneth P. Turvey
In a post to this newsgroup recently I mentioned that I've never seen
source and target used where there was a difference in the values
supplied. A reader on this newsgroup replied indicating that normally
they were different in his application of them.
I thought this was interesting since I would very much like to be able to
target 1.3 or 1.4 class files using source code that included the 1.5
changes, including the new looping construct and the assert keyword (I
know that generics won't work). Even if I couldn't get these later
language constructs, one would expect that the 1.6 compiler would do a
better job than the 1.3 or 1.4 one would.
So I decided to try this out. I couldn't get it to work at all when
applying it to some of my already written source code (and including the
-bootclasspath option), so I thought I would try a simple hello world
example.
This is the class I'm trying to compile:
----
public class Main {
public static void main(String[] args) {
System.out.println("This is a test app");
}
}
----
It can't get much simpler than that.
When I try to compile it and target the 1.5 class file format, this is
what I get:
----
kt@lovelace:~/src/TestApp/src/testapp$ javac -source 1.6 \
-target 1.5 Main.java
javac: source release 1.6 requires target release 1.6
----
Would somebody tell me what magic I need to do to get the Sun 1.6 compiler
to target an earlier version of the class file?
Thank you.
source and target used where there was a difference in the values
supplied. A reader on this newsgroup replied indicating that normally
they were different in his application of them.
I thought this was interesting since I would very much like to be able to
target 1.3 or 1.4 class files using source code that included the 1.5
changes, including the new looping construct and the assert keyword (I
know that generics won't work). Even if I couldn't get these later
language constructs, one would expect that the 1.6 compiler would do a
better job than the 1.3 or 1.4 one would.
So I decided to try this out. I couldn't get it to work at all when
applying it to some of my already written source code (and including the
-bootclasspath option), so I thought I would try a simple hello world
example.
This is the class I'm trying to compile:
----
public class Main {
public static void main(String[] args) {
System.out.println("This is a test app");
}
}
----
It can't get much simpler than that.
When I try to compile it and target the 1.5 class file format, this is
what I get:
----
kt@lovelace:~/src/TestApp/src/testapp$ javac -source 1.6 \
-target 1.5 Main.java
javac: source release 1.6 requires target release 1.6
----
Would somebody tell me what magic I need to do to get the Sun 1.6 compiler
to target an earlier version of the class file?
Thank you.