Java Timer, swing  
Author Message
Piet den Dulk





PostPosted: 2004-7-24 17:11:00 Top

java-programmer, Java Timer, swing Dear Java experts,

I'm struggling with timers. I've used javax.swing.Timer in my program. But
when one doesn't have the jre installed, my program doesn't work. It then
gives a class not found exception in the browser. It only works on the sun
virtual machines which you have to download from the website like some jre.
I quess the swing library isn't supported by a lot of virtual machines. But
I'm happy about how the timer works in my program because it makes use of
the actionListener.
Is there some easy solution? Using a simple Timer like the swing version and
let it work on any virtual machine/ jre?

best regards,
Piet den Dulk (Netherlands)




 
samhunt90





PostPosted: 2004-7-24 22:07:00 Top

java-programmer >> Java Timer, swing "Piet den Dulk" <email***@***.com> wrote in message news:<410227bc$0$324$email***@***.com>...
> Dear Java experts,
>
> I'm struggling with timers. I've used javax.swing.Timer in my program. But
> when one doesn't have the jre installed, my program doesn't work. It then
> gives a class not found exception in the browser. It only works on the sun
> virtual machines which you have to download from the website like some jre.
> I quess the swing library isn't supported by a lot of virtual machines. But
> I'm happy about how the timer works in my program because it makes use of
> the actionListener.
> Is there some easy solution? Using a simple Timer like the swing version and
> let it work on any virtual machine/ jre?
>
> best regards,
> Piet den Dulk (Netherlands)

Hi,

Swing is not part of the basic java.* distribution. It's in a java
extension called javax.swing. So, what you may want to do do is
download the swing jar file and included it your classpath.

Good luck,
Sam90
 
Roedy Green





PostPosted: 2004-7-24 22:20:00 Top

java-programmer >> Java Timer, swing On Sat, 24 Jul 2004 11:11:20 +0200, "Piet den Dulk"
<email***@***.com> wrote or quoted :

>I'm struggling with timers. I've used javax.swing.Timer in my program. But
>when one doesn't have the jre installed, my program doesn't work.

No Java program works without the JRE unless it is statically
compiled.

See http://mindprod.com/jgloss/nativecompiler.html

--
Canadian Mind Products, Roedy Green.
Coaching, problem solving, economical contract programming.
See http://mindprod.com/jgloss/jgloss.html for The Java Glossary.
 
 
Roedy Green





PostPosted: 2004-7-24 22:21:00 Top

java-programmer >> Java Timer, swing On 24 Jul 2004 07:06:33 -0700, email***@***.com (Sam) wrote or
quoted :

>Swing is not part of the basic java.* distribution. It's in a java
>extension called javax.swing. So, what you may want to do do is
>download the swing jar file and included it your classpath.

I think what you mean is you are using the bogus MS JVM which supports
only a subset of Java, which does not include Swing. The only
practical solution is to upgrade the JVM.

see http://mindprod.com/jgloss/ie.html

--
Canadian Mind Products, Roedy Green.
Coaching, problem solving, economical contract programming.
See http://mindprod.com/jgloss/jgloss.html for The Java Glossary.
 
 
Tor Iver Wilhelmsen





PostPosted: 2004-7-24 22:39:00 Top

java-programmer >> Java Timer, swing Roedy Green <email***@***.com> writes:

> I think what you mean is you are using the bogus MS JVM which supports
> only a subset of Java, which does not include Swing. The only
> practical solution is to upgrade the JVM.

He could also use the standalone JFC/Swing, if Sun still ship it. It
works well with Microsoft's VM, though there is no reason to keep
using that particular VM that will not be further developed.
 
 
Oscar kind





PostPosted: 2004-7-24 22:59:00 Top

java-programmer >> Java Timer, swing Piet den Dulk <email***@***.com> wrote:
> I'm struggling with timers. I've used javax.swing.Timer in my program. But
> when one doesn't have the jre installed, my program doesn't work. It then
> gives a class not found exception in the browser. It only works on the sun
> virtual machines which you have to download from the website like some jre.
> I quess the swing library isn't supported by a lot of virtual machines. But
> I'm happy about how the timer works in my program because it makes use of
> the actionListener.
> Is there some easy solution? Using a simple Timer like the swing version and
> let it work on any virtual machine/ jre?

Require that your users have a JRE that is at most four years old: Java
1.3 was released on 8 May 2000, and since then the JRE included Swing. The
other easy solution, is to use java.util.Timer, which was also introduced
in Java 1.3.

Also, you can use a simple applet with which users can install the
latest Java version if nescessary. Andrew Thompson has one on his site:
http://www.physci.org/codes/jre.jsp



--
Oscar Kind http://home.hccnet.nl/okind/
Software Developer for contact information, see website

PGP Key fingerprint: 91F3 6C72 F465 5E98 C246 61D9 2C32 8E24 097B B4E2
 
 
Andrew Thompson





PostPosted: 2004-7-24 23:10:00 Top

java-programmer >> Java Timer, swing On Sat, 24 Jul 2004 11:11:20 +0200, Piet den Dulk wrote:

> But when one doesn't have the jre installed,
> my program doesn't work. It then gives a
> class not found exception in the browser.

You have struck a common problem and have fallen
into the usual wrong thinking.

Let me check something..
You are using IE and assume if you can get
your applet to work in IE, it will work on
all browsers (or at least all IE), right?

Wrong. The obsolete 'Java' that is throwing
the exception you are experincing (that you
describe very vaguely *) is no longer installed
in *any* browser, not even IE, fortunately.

* <http://www.physci.org/codes/javafaq.jsp#exact>

Your users will have to download the Java Plug-In
to run Java. In that sense, Java is a Plug-In
just like Flash or the Acrobat Reader.

There are things you can do to ensure the user
is informed that they need Java for your applet,
but you cannot *expect* Java to be installed.
Sometimes the user does not have it and is unable
(as in, is *prevented*) from installing it.

HTH

--
Andrew Thompson
http://www.PhySci.org/ Open-source software suite
http://www.PhySci.org/codes/ Web & IT Help
http://www.1point1C.org/ Science & Technology
 
 
Roedy Green





PostPosted: 2004-7-24 23:11:00 Top

java-programmer >> Java Timer, swing On Sat, 24 Jul 2004 16:58:40 +0200, Oscar kind <email***@***.com> wrote
or quoted :

>Require that your users have a JRE that is at most four years old:

How old is the MS "JRE"? Legally it is not even Java.

--
Canadian Mind Products, Roedy Green.
Coaching, problem solving, economical contract programming.
See http://mindprod.com/jgloss/jgloss.html for The Java Glossary.
 
 
Andrew Thompson





PostPosted: 2004-7-24 23:24:00 Top

java-programmer >> Java Timer, swing On Sat, 24 Jul 2004 16:58:40 +0200, Oscar kind wrote:

> ..Java 1.3 was released on 8 May 2000,
> and since then the JRE included Swing.

Though your comment did not *specifically* state
as much, I will point out that Swing became part
of the Java core classes in Java 1.2 (and was
supposedly available as an external jar for 1.1!).

That is of course, secondary to the point
that java.swing.Timer was introduced in 1.3,
as you noted.

[ ..Great link as well, if I say so myself. ;-) ]

--
Andrew Thompson
http://www.PhySci.org/ Open-source software suite
http://www.PhySci.org/codes/ Web & IT Help
http://www.1point1C.org/ Science & Technology
 
 
Andrew Thompson





PostPosted: 2004-7-24 23:55:00 Top

java-programmer >> Java Timer, swing On Sat, 24 Jul 2004 15:10:35 GMT, Roedy Green wrote:

> On Sat, 24 Jul 2004 16:58:40 +0200, Oscar kind <email***@***.com> wrote
> or quoted :
>
>>Require that your users have a JRE that is at most four years old:
>
> How old is the MS "JRE"? ..

That took some Googling. Unsure, but
I stumbled across this article..
<http://www.javaworld.com/jw-10-1997/jw-10-javalobby.html>

Which states that Java was licenced to MS in
'spring 96', but already had the 'JavaLobby'ists
up in arms by October '97..

--
Andrew Thompson
http://www.PhySci.org/ Open-source software suite
http://www.PhySci.org/codes/ Web & IT Help
http://www.1point1C.org/ Science & Technology
 
 
Roedy Green





PostPosted: 2004-7-25 4:03:00 Top

java-programmer >> Java Timer, swing On Sat, 24 Jul 2004 15:54:56 GMT, Andrew Thompson
<email***@***.com> wrote or quoted :

>> How old is the MS "JRE"? ..

I would like to say something like "MS has not updated the JVM since
XXX, and further the courts ruled it is not even a true Java
implementation. MS has not bundled it since XXX, and in XXXX took it
off their website altogether. The bottom line is, using the MS JVM is
necrophilia. Cut it out. Use the latest Sun JVM."




--
Canadian Mind Products, Roedy Green.
Coaching, problem solving, economical contract programming.
See http://mindprod.com/jgloss/jgloss.html for The Java Glossary.
 
 
Piet den Dulk





PostPosted: 2004-7-25 9:56:00 Top

java-programmer >> Java Timer, swing thank you both for your help.

But I want to work it on a microsoft VM as wel . This because I want to
amaze other people with my creation. I try to create a little game which I
want to show a couple of friends of mine. And often they don't know anything
about virtual machines anyway. If I should create a company program then it
would be wise to install the newest JRE versions.
Should it be enough to put the swing jar file in the classpath directory
like the statement of roudy green? I try tommorow right away. And if I use
the jar file would it slowdown the program download or is it a minimum of
overhead? Won't the Java standard timer be sufficient enough to use?
Allthough I don't know how it works because the swing is very easy because
one thread schedules it's timers. So the swing is easy but if the java timer
is also advisable then maybe I should study how it works.

Best regards,
Piet den Dulk


"Tor Iver Wilhelmsen" <email***@***.com> schreef in bericht
news:email***@***.com...
> Roedy Green <email***@***.com> writes:
>
> > I think what you mean is you are using the bogus MS JVM which supports
> > only a subset of Java, which does not include Swing. The only
> > practical solution is to upgrade the JVM.
>
> He could also use the standalone JFC/Swing, if Sun still ship it. It
> works well with Microsoft's VM, though there is no reason to keep
> using that particular VM that will not be further developed.


 
 
Andrew Thompson





PostPosted: 2004-7-25 12:14:00 Top

java-programmer >> Java Timer, swing On Sat, 24 Jul 2004 20:02:57 GMT, Roedy Green wrote:

> On Sat, 24 Jul 2004 15:54:56 GMT, Andrew Thompson
> <email***@***.com> wrote or quoted :
>
>>> How old is the MS "JRE"? ..
>
> I would like to say something like "MS has not updated the JVM since
> XXX, and further the courts ruled it is not even a true Java
> implementation. MS has not bundled it since XXX, and in XXXX took it
> off their website altogether. The bottom line is, using the MS JVM is
> necrophilia. Cut it out. Use the latest Sun JVM."

I liked the way that was going until the reference
to sex with corpses, do you think you might tweak it
..a bit?

--
Andrew Thompson
http://www.PhySci.org/ Open-source software suite
http://www.PhySci.org/codes/ Web & IT Help
http://www.1point1C.org/ Science & Technology
 
 
Andrew Thompson





PostPosted: 2004-7-25 12:24:00 Top

java-programmer >> Java Timer, swing On Sun, 25 Jul 2004 03:56:16 +0200, Piet den Dulk wrote:

Please do not top-post Piet.. it is most confusing..

> "Tor Iver Wilhelmsen" <email***@***.com> schreef in bericht
> news:email***@***.com...
>> Roedy Green <email***@***.com> writes:
>>
>>> I think what you mean is you are using the bogus MS JVM which supports
>>> only a subset of Java, which does not include Swing. The only
>>> practical solution is to upgrade the JVM.
>>
>> He could also use the standalone JFC/Swing, if Sun still ship it. It
>> works well with Microsoft's VM, though there is no reason to keep
>> using that particular VM that will not be further developed.
..
> But I want to work it on a microsoft VM as wel .

You had better work fast then, it is disappearing
at an astounding rate, partially thanks to tools
specifically designed to uninstall it..
<http://www.physci.org/jvmclean.jsp>

>..This because I want to
> amaze other people with my creation.

What? You assume all IE's have the MSVM? Wrong!
All other browsers come with Java? Wrong again!

>.. I try to create a little game which I
> want to show a couple of friends of mine. And often they don't know anything
> about virtual machines anyway.

They don't need to, there are versioning techniques
you can use, show some sense and I will go into
greater detail.

>If I should create a company program then it
> would be wise to install the newest JRE versions.
> Should it be enough to put the swing jar file in the classpath directory
> like the statement of roudy green?

The gent's name is Roedy (and names generally
start with Upper Case). But it is less
practical to load the 'Swing' jar in a number
of your friend's machines than get them to install
the modern, (and self updating) Java.

As an aside, Oscar mentioned that Timer was introduced
in Java 1.3, therefore it will *not* be in the Swing Jar,
which was incorporated into the main rt.jar in 1.2
and thereafter ignored AFAIU.

> the jar file would it slowdown the program download or is it a minimum of
> overhead?

You clients would need to download the entire
jar before any Swing component appears on their
screen.

--
Andrew Thompson
http://www.PhySci.org/ Open-source software suite
http://www.PhySci.org/codes/ Web & IT Help
http://www.1point1C.org/ Science & Technology
 
 
Roedy Green





PostPosted: 2004-7-25 13:47:00 Top

java-programmer >> Java Timer, swing On Sun, 25 Jul 2004 04:24:02 GMT, Andrew Thompson
<email***@***.com> wrote or quoted :

>The gent's name is Roedy (and names generally
>start with Upper Case). But it is less
>practical to load the 'Swing' jar in a number
>of your friend's machines than get them to install
>the modern, (and self updating) Java.

downloading swing each time is an act of desperation. It will take a
very long time and will not work nearly as well as installing a proper
java. Insisting on using the MS JVM is necrophilia.
--
Canadian Mind Products, Roedy Green.
Coaching, problem solving, economical contract programming.
See http://mindprod.com/jgloss/jgloss.html for The Java Glossary.
 
 
Roedy Green





PostPosted: 2004-7-25 13:49:00 Top

java-programmer >> Java Timer, swing On Sun, 25 Jul 2004 04:13:53 GMT, Andrew Thompson
<email***@***.com> wrote or quoted :

>I liked the way that was going until the reference
>to sex with corpses, do you think you might tweak it
>..a bit?

We need some drama to make the point emotionally. People have kept
this fool thing around far to long. It is like that woman who had her
husband pickled in alcohol.

--
Canadian Mind Products, Roedy Green.
Coaching, problem solving, economical contract programming.
See http://mindprod.com/jgloss/jgloss.html for The Java Glossary.
 
 
Andrew Thompson





PostPosted: 2004-7-25 14:03:00 Top

java-programmer >> Java Timer, swing On Sun, 25 Jul 2004 05:48:35 GMT, Roedy Green wrote:

> On Sun, 25 Jul 2004 04:13:53 GMT, Andrew Thompson
> <email***@***.com> wrote or quoted :
>
>>I liked the way that was going until the reference
>>to sex with corpses, do you think you might tweak it
>>..a bit?
>
> We need some drama to make the point emotionally. People have kept
> this fool thing around far to long. It is like that woman who had her
> husband pickled in alcohol.

Huh!?! ..I no longer consume mass media,
Roedy, you just reminded me (one of the
many reasons) why.

--
Andrew Thompson
http://www.PhySci.org/ Open-source software suite
http://www.PhySci.org/codes/ Web & IT Help
http://www.1point1C.org/ Science & Technology
 
 
Roedy Green





PostPosted: 2004-7-25 14:29:00 Top

java-programmer >> Java Timer, swing On Sun, 25 Jul 2004 06:02:52 GMT, Andrew Thompson
<email***@***.com> wrote or quoted :

>
>Huh!?! ..I no longer consume mass media,

Not mass media, a book called Soiled Doves, about the history of
prostitution in the old West.


--
Canadian Mind Products, Roedy Green.
Coaching, problem solving, economical contract programming.
See http://mindprod.com/jgloss/jgloss.html for The Java Glossary.
 
 
Andrew Thompson





PostPosted: 2004-7-25 16:00:00 Top

java-programmer >> Java Timer, swing On Sun, 25 Jul 2004 06:29:05 GMT, Roedy Green wrote:
> On Sun, 25 Jul 2004 06:02:52 GMT, Andrew Thompson wrote or quoted :

>>Huh!?! ..I no longer consume mass media,
>
> Not mass media, a book called Soiled Doves, about the history of
> prostitution in the old West.

OooK.. I have never bothered with much history
(not more recent than 20-30 millenia, in any case)
and especially not with the history of prostitution
in the old west, so ..again I missed it. (And
again, ..thankfully)

--
Andrew Thompson
http://www.PhySci.org/ Open-source software suite
http://www.PhySci.org/codes/ Web & IT Help
http://www.1point1C.org/ Science & Technology
 
 
Thomas Weidenfeller





PostPosted: 2004-7-26 17:39:00 Top

java-programmer >> Java Timer, swing Roedy Green wrote:
> I would like to say something like "MS has not updated the JVM since
> XXX,

For some value of "not updated". MS has from time to time fixed security
problems in the VM. They "just" didn't update the language to some
decent standard.

I would simply refer people to MS' own statement about their VM on

http://www.microsoft.com/mscorp/java/

Why should "we" waste time by trying to explain to people how MS let
their own customers and users down?


/Thomas