Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

When was Swing introduced?

2 views
Skip to first unread message

Andrew Thompson

unread,
Dec 16, 2003, 1:06:13 PM12/16/03
to
In what version of Java was Swing introduced?

I compiled this source with a target of 1.1 w/out complaint
http://www.physci.org/codes/display.jsp?fl=/test/EditableComponents/PrefThin
gs.java

Will 1.1 JVM's actually launch it?
http://www.physci.org/test/EditableComponents/

--
Andrew Thompson
* http://www.PhySci.org/ PhySci software suite
* http://www.1point1C.org/ 1.1C - Superluminal!
* http://www.AThompson.info/andrew/ personal site


Thomas Jollans

unread,
Dec 16, 2003, 1:16:12 PM12/16/03
to

It was introduced with JDK 1.2, but if the JAR file is on the CLASSPATH
(or in the archive attribute of the applet tag) it will work (occording
to "Core JAVA 2 Volume 1"). Right now I don't know where to get the JAR,
but I would try java.sun.com and maybe your Java 2 SDK dir.

Thomas

Andrew Thompson

unread,
Dec 16, 2003, 1:44:43 PM12/16/03
to

"Thomas Jollans" <nos...@jollans.com> wrote in message
news:brni5d$27c$04$1...@news.t-online.com...

> Andrew Thompson wrote:
> > In what version of Java was Swing introduced?
> >
> > I compiled this source with a target of 1.1 w/out complaint
> >
http://www.physci.org/codes/display.jsp?fl=/test/EditableComponents/PrefThin
> > gs.java
> >
> > Will 1.1 JVM's actually launch it?
> > http://www.physci.org/test/EditableComponents/
..

> It was introduced with JDK 1.2,

Do I feel an _absolute idiot_ or what, Thomas!

After my response to you moments ago
I thought harder about this question and
realised I _did_ have a 1.1VM handy
in NN4.78 (I do cross browser testing)

So _I_ tried it [ ..took a dose of my
own medicine ;-) ].

[ Oh, and look, sorry.. I don't actually know
enough about threading to help with _your_
question.. ]

Result (for those interested)
____________________________________________
Netscape Communications Corporation -- Java 1.1.5

Type '?' for options.

Symantec Java! ByteCode Compiler Version 210.065
Copyright (C) 1996-97 Symantec Corporation
java.lang.NoClassDefFoundError: javax/swing/JFrame
at java.lang.ClassLoader.defineClass(Compiled Code)
at netscape.applet.AppletClassLoader.loadClass(Compiled Code)
at netscape.applet.AppletClassLoader.findClass(Compiled Code)
at netscape.applet.AppletClassLoader.loadClass1(Compiled Code)
at netscape.applet.AppletClassLoader.loadClass(Compiled Code)
at java.lang.ClassLoader.loadClassInternal(Compiled Code)
at Launcher.init(Compiled Code)
* at netscape.applet.DerivedAppletFrame$InitAppletEvent.dispatch(Compiled
Code)
at java.awt.EventDispatchThread$EventPump.dispatchEvents(Compiled Code)
at java.awt.EventDispatchThread.run(Compiled Code)
at
netscape.applet.DerivedAppletFrame$AppletEventDispatchThread.run(Compiled
Code)
____________________________________________

Using target 1.1 will happily claim to work
in compiling Swing, introduced in 1.2 (thanks
Thomas) back to 1.1, but then fails when loading.

Somebody was saying recently that the 'target'
option of javac was not what most people
took it to be*, but I was not entirely convinced
until now.

* Ensuring you do not use classes and class
members introduced after a particular Java
version.

Eh. Oh well. It would be nice to have some
tool that _does_ do that.

Phillip Lord

unread,
Dec 16, 2003, 1:39:00 PM12/16/03
to
>>>>> "Andrew" == Andrew Thompson <andr...@bigNOSPAMpond.com> writes:

Andrew> In what version of Java was Swing introduced?

Andrew> I compiled this source with a target of 1.1 w/out complaint
Andrew> http://www.physci.org/codes/display.jsp?fl=/test/EditableComponents/PrefThin
Andrew> gs.java

Andrew> Will 1.1 JVM's actually launch it?
Andrew> http://www.physci.org/test/EditableComponents/

Swing was first released with Java when Java 1.2 came out. However it
was developed while 1.1 was current, and there was a version that
worked under 1.1. Where you would get this version I have no idea.

Phil

Thomas Fritsch

unread,
Dec 16, 2003, 2:29:57 PM12/16/03
to
Phillip Lord schrieb:
I remember the file name was "swingall.jar". May be one can still find it after some googling.

Thomas
______________________________________________________
Thomas <dot> Fritsch <at> ops <dot> de

Chris Smith

unread,
Dec 16, 2003, 2:30:37 PM12/16/03
to
Andrew Thompson wrote:
> In what version of Java was Swing introduced?
>
> I compiled this source with a target of 1.1 w/out complaint
> http://www.physci.org/codes/display.jsp?fl=/test/EditableComponents/PrefThin
> gs.java

Andrew,

The -target option on the javac compiler (and similar options on other
compilers) generally refers only to the class file format that is to be
written. This is not related to the APIs or language features used in
the source code, except for a few language features that require a more
recent target (for example, assertions). There is also a -source
option, which *does* check the source code for compatibility with a
language version, but it does *not* check for compatibility with APIs.
So, for example, an attempt to use the 'assert' keyword with '-source
1.3' would be an error, as would an attempt to define a nested or inner
class with '-source 1.0'.

However, using javax.swing.JFrame is valid with any combination of -
source and -target, because it's always assumed that if an API is not
available, you could be planning on providing it yourself through a
standard extension, internal implementation, or some other means.

--
www.designacourse.com
The Easiest Way to Train Anyone... Anywhere.

Chris Smith - Lead Software Developer/Technical Trainer
MindIQ Corporation

Andrew Thompson

unread,
Dec 16, 2003, 2:38:55 PM12/16/03
to
"Chris Smith" <cds...@twu.net> wrote in message
news:MPG.1a490b47e...@news.pop4.net...

> Andrew Thompson wrote:
> > In what version of Java was Swing introduced?
> >
> > I compiled this source with a target of 1.1 w/out complaint
> >
http://www.physci.org/codes/display.jsp?fl=/test/EditableComponents/PrefThin
> > gs.java
>
> Andrew,
>
> The -target option on the javac compiler (and similar options on other
> compilers) generally refers only to the class file format that is to be
> written.
<snip explanation so simple even I could understand>

OK, got it (finally). I think..

Thanks all. :-)


Tor Iver Wilhelmsen

unread,
Dec 16, 2003, 4:40:39 PM12/16/03
to
"Andrew Thompson" <andr...@bigNOSPAMpond.com> writes:

> In what version of Java was Swing introduced?

As part of the JRE? In 1.2.0 beta something. Prior to that, two
incarnations (at least) existed for 1.1.x JREs, namely JFC/Swing 1.0.3
and JFC/Swing 1.1.1. They were separate downloads back then.

Note that the older Swing implementations share package trees with
newer when it comes to the Windows and Motif L&Fs, so you can't run
apps containing those Swing versions in 1.2 or later with those L&Fs.

Michael Borgwardt

unread,
Dec 17, 2003, 2:54:54 AM12/17/03
to
Chris Smith wrote:
> However, using javax.swing.JFrame is valid with any combination of -
> source and -target, because it's always assumed that if an API is not
> available, you could be planning on providing it yourself through a
> standard extension, internal implementation, or some other means.

Of course, the API must be accessible to the compiler during compilation.
Using this, it *is* possible to test for API compatibility by telling the
compiler to use the standard API of an older JDK release instead of the
default one.

Andrew Thompson

unread,
Dec 17, 2003, 7:29:00 AM12/17/03
to

"Michael Borgwardt" <bra...@brazils-animeland.de> wrote in message
news:brp24e$5j6a6$2...@ID-161931.news.uni-berlin.de...

I do not quite understand, Michael. If the 'target'
option of javac is related to the class file format,
how do you specify to compile against a particular
API release?

Is it something in the javac command that I missed,
changing classpaths external to javac ..how?

Michael Borgwardt

unread,
Dec 17, 2003, 7:53:38 AM12/17/03
to
Andrew Thompson wrote:

> I do not quite understand, Michael. If the 'target'
> option of javac is related to the class file format,
> how do you specify to compile against a particular
> API release?
>
> Is it something in the javac command that I missed,
> changing classpaths external to javac ..how?

Look in the documentation for "Cross-Compilation Options".
It lists -target, -bootclasspath and -extdirs.
Using the normal -classpath option is not sufficient
because it would then still find the API classes of the
compiler's own SDK.

Phillip Lord

unread,
Dec 17, 2003, 7:33:51 AM12/17/03
to
>>>>> "Thomas" == Thomas Fritsch <i.don...@spam.com> writes:

Thomas> Phillip Lord schrieb:

>>>>>>> "Andrew" == Andrew Thompson <andr...@bigNOSPAMpond.com>
>>>>>>> writes:
>>>>>>>

>>
Andrew> In what version of Java was Swing introduced?
>>
Andrew> I compiled this source with a target of 1.1 w/out complaint
Andrew> http://www.physci.org/codes/display.jsp?fl=/test/EditableComponents/PrefThin
Andrew> gs.java
>>
Andrew> Will 1.1 JVM's actually launch it?
Andrew> http://www.physci.org/test/EditableComponents/
>>
>> Swing was first released with Java when Java 1.2 came
>> out. However it was developed while 1.1 was current, and there
>> was a version that worked under 1.1. Where you would get this
>> version I have no idea. Phil

>>

Thomas> I remember the file name was "swingall.jar". May be one can
Thomas> still find it after some googling.

Probably so.

It's worth remembering that in Java 1.1 days Swing was in a different
package, under com.sun.swing I think. When 1.2 came out all the
packages need renaming.

Cheers

Phil

Chris Smith

unread,
Dec 17, 2003, 12:27:06 PM12/17/03
to

Yes, definitely, and I should have mentioned this. My comments apply
only to the use of -source and -target, not to compiling with a
different JDK or with a different bootclasspath.

Jon A. Cruz

unread,
Jan 5, 2004, 3:13:12 PM1/5/04
to
Phillip Lord wrote:
> Probably so.
>
> It's worth remembering that in Java 1.1 days Swing was in a different
> package, under com.sun.swing I think. When 1.2 came out all the
> packages need renaming.


Actually, it was initially developed under a different packaging. Well
before (6 or 9 months +) 1.2 was officially released, the 1.1 version of
Swing was changed to have consistent naming. Thus, applications could be
written that would run unchanged on both.

0 new messages