Java Timer, swing


P

Piet den Dulk

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)
 
Ad

Advertisements

S

Sam

Piet den Dulk said:
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
 
R

Roedy Green

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
 
T

Tor Iver Wilhelmsen

Roedy Green said:
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.
 
O

Oscar kind

Piet den Dulk said:
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
 
Ad

Advertisements

A

Andrew Thompson

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
 
A

Andrew Thompson

..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. ;-) ]
 
R

Roedy Green

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."
 
Ad

Advertisements

P

Piet den Dulk

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
 
A

Andrew Thompson

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?
 
A

Andrew Thompson

On Sun, 25 Jul 2004 03:56:16 +0200, Piet den Dulk wrote:

Please do not top-post Piet.. it is most confusing..
...
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..
..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.
 
R

Roedy 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.

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.
 
R

Roedy Green

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.
 
Ad

Advertisements

A

Andrew Thompson

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.
 
A

Andrew Thompson

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)
 
Ad

Advertisements

T

Thomas Weidenfeller

Roedy said:
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
 

Top