Re: target release conflicts with default source release




Thomas Hawtin wrote:
Doug Pardee wrote:
Redbeard wrote:
I'm trying to compile some code to release 1.4 because it needs to run
on some older Mac's that don't have Java 5. But I keep getting the
error message "target release conflicts with default source release 1.5"

Add "-source 1.4" to the javac command line.

You should also use -bootclasspath.

Consider this source code.

class Target {
public static void main(String[] args) {
new StringBuffer().append(new StringBuffer());
}
}

$ /usr/java/j2sdk1.4.2_11/bin/javac Target.java
$ ~/1.3/jdk1.3.1_18/jre/bin/java Target
Exception in thread "main" java.lang.NoSuchMethodError
at Target.main(Target.java:3)
$ /usr/java/j2sdk1.4.2_11/bin/javac -bootclasspath
~/1.3/jdk1.3.1_18/jre/lib/rt.jar Target.java
$ ~/1.3/jdk1.3.1_18/jre/bin/java Target
$

Tom Hawtin
--
Unemployed English Java programmer
http://jroller.com/page/tackline/
Thanks! My code compiled OK with just -source added, but some other
code might not. This will save me having to ask a similar question
again.

.



Relevant Pages

  • Re: java 1.5 on 1.4.2
    ... you can compile Java 1.5 source code to a 1.4 class file. ... Code and Target JVM versions you require. ...
    (comp.lang.java.programmer)
  • Re: target builder tools for embedded-like system
    ... > compactflashtype box that will support a single java ... developments that I could use Linux for but couldn't find any nice simple ... If your target is intel ... scripts, compile the source code, format the compact flash, install the ...
    (comp.os.linux.embedded)
  • Re: How to read unbuffered stdout of a new process?
    ... you can insert a native program between Java ... and the target that connects to the target using a pty, ... running the target in debug mode and intercepting console ... Gordon Chaffee's Windows port of "Expect" as a guide for ...
    (comp.lang.java.programmer)
  • Re: I hate Java
    ... In comp.lang.java.advocacy, Thomas Hawtin ... I didn't say Java. ... It has problems representing something as trivial ... for programming multi-layer enterprise systems nowadays? ...
    (comp.lang.java.advocacy)
  • Re: ghostscript damages bookmarks
    ... export and import bookmarks), that can be used to fix damaged outlines. ... Java Development Kit ... Copy outlines from one PDF file to another. ... // Initialize source and target objects. ...
    (comp.text.pdf)