Re: I guess I have to violate the license (and I don't feel bad...)

From: Michael Wurm (mwurm_at_sime.com)
Date: 07/23/04


Date: 22 Jul 2004 16:13:12 -0700

Roedy Green <look-on@mindprod.com.invalid> wrote in message news:<il9tf0l977pjhrpebg8nlgpm5ljbvl3dga@4ax.com>...
> >I have to specify my problem clearly:
> >The classes out of javax.sound.midi I have rewritten are
> >"Sequence" and "Track". I cannot subclass "Track" because the
> >constructor is protected and for some reason I can only call
> >is from inside the package (not even from a subclass outside
> >the package).
> >But for actual playback I use a Sequencer provided by sun,
> >which expects javax.sound.midi.Sequence and
> >javax.sound.midi.Track.
>
> [...]
>
> The constructor being "protected" is GOOD. That means a subclass, even
> in a different package, can access it. If you want to access it from
> other classes, they can still do so via your overriding class.

Now, in this point, I was wrong. Actually it is package-scoped, so no
chance outside of it.

> The second problem is frustrating. You can't insert your code in to
> replace any lower level code, unless there is provided an explicit
> hook for it. This is so easy in some other languages, but in Java is
> considered too dangerous.
>
> I wonder if it would be possible to fool it this way.
> [...]
> Has anyone solved this general problem before?

Yes, I solved it.
But it's illegal to distribute projects using this
technique, and that's my actual problem.

Start java like this:
java -Xbootclasspath/p:myruntime MyApp

In the directory "myruntime" can be a structure like this:
javax/sound/midi/Track.class
javax/sound/midi/Sequence.class

The option -Xbootclasspath/p prepends the specified path (should
also work with a jar-file) to the search pathes for runtime classes.
When loading a RT class, java first searches this directory, and if
there is a class with the required name, it is used. Otherwise java
searches in the default place (rt.jar).
With -Xbootclasspath:myruntime you can completely replace the
default RT.

What does the license say about this?

Excerpt from Sun's license
SUPPLEMENTAL LICENSE TERMS - Section B:
[...] Sun grants you a non-exclusive, non-transferable,
limited license without fees to reproduce and distribute the
Software, provided that [...] (iii)
you do not distribute additional software intended to replace
any component(s) of the Software (unless otherwise specified
in the applicable README file) [...]

>From the documentation of the -Xbootclasspath - option:
Note: Applications that use this option for the purpose of
overriding a class in rt.jar should not be deployed as doing
so would contravene the Java 2 Runtime Environment binary code
license.



Relevant Pages

  • Re: Java Timer, swing
    ... Sun let them, they violated the license agreement, they went to court. ... Now you advocate that Microsoft produce a Java 2-compatible VM. ...
    (comp.lang.java.programmer)
  • Re: Java license explanation
    ... >Is Java really opensource or not? ... Actually the license is not as clear as I was thinking. ... corrections provided by Sun, ... acknowledge that the Software may automatically download, ...
    (comp.lang.java.programmer)
  • Re: Java problem
    ... It's too bad that RedHat and Sun can't agree on where java should live. ... packaging would drop in and run or for Sun to package it to match RH's ... That is what most major software vendors will, as they do if you install ...
    (Fedora)
  • Re: question about java
    ... Assuming that we are talking about Java SE here, ... server computers and you want to use the Sun JRE. ... through JRE binary license permits redistribution. ...
    (comp.lang.java.programmer)
  • Re: [SLE] More on the Java Licence
    ... particularly in regards to Red Hat. ... Sun Microsystems' new GNU/Linux-friendly Java license does not go far enough ... It says Sun should have open-sourced Java instead. ...
    (SuSE)