Re: Target VM Microsoft? or Java Lint to check for MS VM compatibility?

From: Vincent Cate (vince_at_offshore.ai)
Date: 12/22/03


Date: 22 Dec 2003 08:34:55 -0800

Chris Smith <cdsmith@twu.net> wrote in message news:<MPG.1a4e468b2f2c8f0f989850@news.pop4.net>...
> Vincent Cate wrote:
> > I just installed j2sdk1.4.2_03 from Sun on a Linux machine and even
> > here when I compile with "-target 1.1", I can have Vector.add()
> > and it compiles fine (as does under JBuilder).
>
> The "-target" flag doesn't do what you think it does. What you actually
> need to do is download a 1.1 version of Java, and compile with that.

You are right. I did that and it does complain about Vector.add() in
that case. So now I can tell what I should not use for 1.1 JVM
compatibility. Thanks!

In my defense, I quote from the man page for Sun's 1.4 javac:

> -target version
> Generates class files that will work on VMs with the specified version.
> [...] The versions supported are:
>
> 1.1 Ensures that generated class files will be compatible
> with 1.1 and 1.2 VMs.
> [...]

What the man page says "-target" does is not what it really does. The
"will work", "Ensures", and "will be compatible" all don't mean what
they seem to mean.

So now I will compile on 1.4 to make sure I am ok with current Java
(not using anything "deprecated") and then on 1.1 to make sure my code
does not use anything that 1.1 does not have. Not exactly compile
once run anywhere.

Is this what other people do?

   -- Vince



Relevant Pages

  • Q: Java source and directory structure - standard way ?
    ... When I compile I use the -d option on Sun's SDK... ... and places the class files into it. ... Java source. ... code directory structure has been created to mirror the package names. ...
    (comp.lang.java)
  • Re: multiple source files
    ... C++ I would have separate translation units ... I would then compile those translation ... is approached in java because I really don't ... In Java you just compile the source files to class files, ...
    (comp.lang.java.programmer)
  • Re: multiple source files
    ... C++ I would have separate translation units ... I would then compile those translation ... is approached in java because I really don't ... After you get the .class files, you link the .class files into larger execution units called .jar files. ...
    (comp.lang.java.programmer)
  • Re: simple compilaton question
    ... > before I try to compile Main? ... "javac *.java" in each of my java source file directories the first ... with gcj. ... slow to ask for help on mailing lists. ...
    (comp.lang.java.programmer)
  • Re: multiple source files
    ... C++ I would have separate translation units ... I would then compile those translation ... is approached in java because I really don't ... In addition to the others' advice, which cover the primary points, both the "loose" class files and the internal structure of a JAR file follow Java's package structures, and strictures. ...
    (comp.lang.java.programmer)