Applet Question

N

Novice

I'm trying to get a simple applet I wrote working in Firefox 7.0.1 but it's
not loading. I was advised to look at the Java Console to see what's going
wrong - such as which class is not loading - but I can't find a Java
Console in Firefox. When I googled, I found a page saying that Firefox 6
and above don't support the Java Console, although they support Java
itself.

I'm guessing that I've messed up my <object> tag but perhaps I am trying to
load from the wrong folder from the server, something that the Java Console
would help with. How do I debug this?

I also tried Internet Explorer 7 but don't see a Java Console there either.
Ditto for Opera 11.50.

Have applets become obsolete? If not, how do I debug them if they work fine
in my development environment?
 
M

markspace

I'm trying to get a simple applet I wrote working in Firefox 7.0.1 but it's
not loading. I was advised to look at the Java Console to see what's going
wrong - such as which class is not loading - but I can't find a Java
Console in Firefox. When I googled, I found a page saying that Firefox 6
and above don't support the Java Console, although they support Java
itself.


The Java console is supported now by the Java plug-in itself. Go to
your Windows Control Panel -> Java and enable the console in the
Advanced tab. You may have to restart FireFox to get this to take effect.

I'm guessing that I've messed up my<object> tag but perhaps I am trying to
load from the wrong folder from the server, something that the Java Console
would help with. How do I debug this?


Other than "try it and see if it works," I haven't found anything.
There might be some clues on the console when it comes up, but I found
most messages there to be of limited value.

Have applets become obsolete? If not, how do I debug them if they work fine
in my development environment?


Not obsolete per se, but I haven't found a lot of support for debugging
deployment problems. Besides copious use of the Mark I eyeball on your
<object> tag and all its parameters, I suggest you make copious use of
logging in the app itself.

It's been a while since I've worked on applets, but I also recall that
the browser seemed to aggressively cache everything I deployed for
testing. This meant that any changes I made wouldn't be picked up by
the browser.

Make sure you are using shift-reload to force a full page reload.
However, this won't help for elements that aren't directly on the page,
like the applet itself, and any descriptors deployed with it -- <jnlp>
for example. Dumping cache directly within FireFox didn't seem to
un-cache everything either.

I eventually just moved all my development to a special directory, and
set every type of "No Cache" directive I could find (via my Apache
webserver) on that directory and its subtree to stop my browser from
trying to cache my test applets. This is the opposite of what you want
for a normal deployment, but seemed to work for development. You may
also have to move everything to a new directory/url to get the browser
to pick up a new set of No Cache directives once you add them.
 
N

Novice

markspace said:
The Java console is supported now by the Java plug-in itself. Go to
your Windows Control Panel -> Java and enable the console in the
Advanced tab. You may have to restart FireFox to get this to take
effect.
Bingo! That is exactly what I needed to know to get the Java Console
working. I didn't realize that the Console was separate from the browser
now. Thank you VERY much for filling me in!
Other than "try it and see if it works," I haven't found anything.
There might be some clues on the console when it comes up, but I found
most messages there to be of limited value.
The Console was very helpful in helping me pinpoint the problem. I wasn't
loading one of the supporting classes that I added recently because I'd
forgotten to add it to the jar.
Not obsolete per se, but I haven't found a lot of support for
debugging deployment problems. Besides copious use of the Mark I
eyeball on your <object> tag and all its parameters, I suggest you
make copious use of logging in the app itself.

It's been a while since I've worked on applets, but I also recall that
the browser seemed to aggressively cache everything I deployed for
testing. This meant that any changes I made wouldn't be picked up by
the browser.

Make sure you are using shift-reload to force a full page reload.
However, this won't help for elements that aren't directly on the
page, like the applet itself, and any descriptors deployed with it --
<jnlp> for example. Dumping cache directly within FireFox didn't seem
to un-cache everything either.

I eventually just moved all my development to a special directory, and
set every type of "No Cache" directive I could find (via my Apache
webserver) on that directory and its subtree to stop my browser from
trying to cache my test applets. This is the opposite of what you
want for a normal deployment, but seemed to work for development. You
may also have to move everything to a new directory/url to get the
browser to pick up a new set of No Cache directives once you add them.
That all sounds like great advice which I shall try to take to heart.
Thanks again!
 
R

Roedy Green

I'm trying to get a simple applet I wrote working in Firefox 7.0.1 but it's
not loading. I was advised to look at the Java Console to see what's going
wrong - such as which class is not loading - but I can't find a Java
Console in Firefox. When I googled, I found a page saying that Firefox 6
and above don't support the Java Console, although they support Java
itself.

Let us split your problem in two. Let's first run somebody else's
Java Applet that is known to work, e.g.

http://mindprod.com/applet/wassup.html

There is a ton of information on that page on what to do if the Applet
won't run, including switching browsers. To engage the console, see
http://mindprod.com/jgloss/console.html
--
Roedy Green Canadian Mind Products
http://mindprod.com
It should not be considered an error when the user starts something
already started or stops something already stopped. This applies
to browsers, services, editors... It is inexcusable to
punish the user by requiring some elaborate sequence to atone,
e.g. open the task editor, find and kill some processes.
 
R

Roedy Green

Have applets become obsolete? If not, how do I debug them if they work fine
in my development environment?

You don't debug them in a browser. You debug them as applications,
and once they work, run them as Applets in various browsers to test
them.
see http://mindprod.com/jgloss/hybrid.html

See http://mindprod.com/jgloss/applet.html
http://mindprod.com/jgloss/japplet.html
for additional hints.
Forget that <object nonsense. It is not needed. It just creates a
massive opportunity for error. The old <applet tags work fine in any
browser that supports Java. It is sadistic to impose that sort of crap
on newbies.
--
Roedy Green Canadian Mind Products
http://mindprod.com
It should not be considered an error when the user starts something
already started or stops something already stopped. This applies
to browsers, services, editors... It is inexcusable to
punish the user by requiring some elaborate sequence to atone,
e.g. open the task editor, find and kill some processes.
 
N

Novice

Let us split your problem in two. Let's first run somebody else's
Java Applet that is known to work, e.g.

http://mindprod.com/applet/wassup.html

There is a ton of information on that page on what to do if the Applet
won't run, including switching browsers. To engage the console, see
http://mindprod.com/jgloss/console.html

Thank you but now that I've got the Java Console to come up, I can see that
my <object> tag is working fine. I'm simply missing some classes in my jar.

Thank you for documenting the steps involved in getting the Java Console to
work in various browsers. As long as I can remember that you have that,
I'll be set as long as use those browsers.
 
R

Roedy Green

but I can't find a Java
Console in Firefox.

You turn it on and off with the Java Control Panel. See Control
Panel, programs, Java, advanced.
--
Roedy Green Canadian Mind Products
http://mindprod.com
It should not be considered an error when the user starts something
already started or stops something already stopped. This applies
to browsers, services, editors... It is inexcusable to
punish the user by requiring some elaborate sequence to atone,
e.g. open the task editor, find and kill some processes.
 
N

Novice

You don't debug them in a browser. You debug them as applications,
and once they work, run them as Applets in various browsers to test
them.
see http://mindprod.com/jgloss/hybrid.html

See http://mindprod.com/jgloss/applet.html
http://mindprod.com/jgloss/japplet.html
for additional hints.

Thank you. I will take that into consideration for the next applet I
develop.
Forget that <object nonsense. It is not needed. It just creates a
massive opportunity for error. The old <applet tags work fine in any
browser that supports Java. It is sadistic to impose that sort of crap
on newbies.

It's good to know that the <applet> tag is still supported. I recently
switched to using XHTML 1.0 and when I first noticed that the applet no
longer worked - after not having tried it for some time - I thought it
might be the <applet> tag that was the problem. Apparently, that tag is
deprecated in XHTML 1.0 so I commented out the <applet> tag and tried to
write an appropriate <object> tag. Luckily, <object> worked fine once I
fixed a typo but I couldn't tell that it was working until I got the Java
Console to work; that informed me that I was simply missing some classes in
my jar. That led to my next question, which I see you've already
answered....
 
J

John B. Matthews

I eventually just moved all my development to a special directory, and
set every type of "No Cache" directive I could find (via my Apache
webserver) on that directory and its subtree to stop my browser from
trying to cache my test applets. This is the opposite of what you want
for a normal deployment, but seemed to work for development. You may
also have to move everything to a new directory/url to get the browser
to pick up a new set of No Cache directives once you add them.

This reminds me of a technique due to Andrew Thompson: Add the applet
tag as a comment at the beginning of the source file where appletviewer
can find it:

//<applet code="Hello.class" width=400 height=200></applet>

Then do something like this:

javac Hello.java; if [ $? -eq 0 ]; then appletviewer Hello.java; fi

<http://download.oracle.com/javase/7/docs/technotes/tools/windows/appletviewer.html>
 
N

Nasser M. Abbasi

Thank you but now that I've got the Java Console to come up, I can see that
my<object> tag is working fine. I'm simply missing some classes in my jar.

That seems to be the most common problem with running applets.

I find that it is a hit and miss if an applet will run or not.
Most errors I get when trying an applet on the net are missing
class type errors.

This seems strange to me, since I would think there should be by
now a way to make sure all classes that are needed to run the
applet are packaged before deploying the applet.

--Nasser
 
R

Roedy Green

This seems strange to me, since I would think there should be by
now a way to make sure all classes that are needed to run the
applet are packaged before deploying the applet.

Genjar handle that for me, even when I include hundreds of classes. It
does it is less than a second. I used to do it manually, and run Jet
to tell me if I had left anything out, round and round. Ant has
another big advantage - compiling multiple classes much faster than
Javac. It loads javac into RAM once and reuses it. Ant is rather
tedious to get going, but once it works, everything zooms. I don't
write ANT directly. I have a Java program that stomps out ant scripts
given just a few basic facts about the project. It is highly tuned to
the way I do things, What you might do is look at some of myscripts,
prune them, then use Quoter to turn them into Java Strings and compose
your own stomper.

--
Roedy Green Canadian Mind Products
http://mindprod.com
It should not be considered an error when the user starts something
already started or stops something already stopped. This applies
to browsers, services, editors... It is inexcusable to
punish the user by requiring some elaborate sequence to atone,
e.g. open the task editor, find and kill some processes.
 
A

Arne Vajhøj

Have applets become obsolete?

They are still fully supported by Java.

They are no longer widely used on WWW.

AJAX JavaScript, Flash, SilverLight etc. has taken that
market.

They are still occasionally used for signed code with
privileges on client PC.

Arne
 
N

Nasser M. Abbasi

They are still fully supported by Java.

They are no longer widely used on WWW.

AJAX JavaScript, Flash, SilverLight etc. has taken that
market.

They are still occasionally used for signed code with
privileges on client PC.

Arne

Hello;

I keep reading things like the above. But when I search
the net to find any real simulations done using the above,
I am not able to find anything close to the quality I find
using Java applets.

Take a look at this web page:

http://www.falstad.com/mathphysics.html

Amazing stuff. in JDK 1.1, and still runs very well,
and very fast. And other web sites like the above exist.

Anything close to the above using Javascript? All what I've seen
so far with HTML5/Javascript are toy applications.

btw, Mathematica now allows one to make an 'applet' that
runs in a browser, using a plugin (free), just like a Java
applet. No need to download anything.

So, for simulation that needs to run on inside a browser, and in
particular for scientific applications, I think that is the best choice
now for me. But Mathematica is commercial product and closed source,
and that can be an issue to some.

Check the Mathematica demonstration web site for many Mathematica
'applets':

http://demonstrations.wolfram.com/

--Nasser
 
A

Arne Vajhøj

I keep reading things like the above. But when I search
the net to find any real simulations done using the above,
I am not able to find anything close to the quality I find
using Java applets.

Take a look at this web page:

http://www.falstad.com/mathphysics.html

Amazing stuff. in JDK 1.1, and still runs very well,
and very fast. And other web sites like the above exist.

Anything close to the above using Javascript? All what I've seen
so far with HTML5/Javascript are toy applications.

btw, Mathematica now allows one to make an 'applet' that
runs in a browser, using a plugin (free), just like a Java
applet. No need to download anything.

So, for simulation that needs to run on inside a browser, and in
particular for scientific applications, I think that is the best choice
now for me. But Mathematica is commercial product and closed source,
and that can be an issue to some.

Check the Mathematica demonstration web site for many Mathematica
'applets':

http://demonstrations.wolfram.com/

You could do the same things in Flash or SL.

And they can also do some rather amazing stuff in JS today.

Example:

http://haxpath.squarespace.com/imported-20100930232226/2011/10/28/broadwayjs-h264-in-javascript.html

If they can decode video then i think they can show math stuff
as well.

Arne
 
R

Roedy Green

Anything close to the above using Javascript?

I am baffled by the appeal of JavaScript.

I find it being used on the web to write code that works with only
one browser.

I believe it has no sandbox, so it is beloved of websites that want to
install Trojans.

It is passed around in fluffy text form.

It is not OO.

Read up on how you write extensions to browsers, email programs, IDEs
and the like. Instead of using some sane language like Java, they
either concoct some ad hoc monstrosity, or use JavaScript. What are
they thinking?

Java has one major drawback. The run time takes a long time to load,
so browsers procrastinate. This gives the impression that Java itself
in painfully slow. Perhaps if it got lazily but most of the time
pre-emptively loaded that problem would go away.

Google uses JavaScript for its ads. The damn things often take
minutes to load, while the fool browser refuses to get on with
rendering the page. I have plans in the works to use macros to
temporarily remove them while compose, and insert them at the last
second before upload. However that does help my visitors any.

I written to Google asking them to implement their ads in a way that
will not hang browsers. They did not respond.


--
Roedy Green Canadian Mind Products
http://mindprod.com
Capitalism has spurred the competition that makes CPUs faster and
faster each year, but the focus on money makes software manufacturers
do some peculiar things like deliberately leaving bugs and deficiencies
in the software so they can soak the customers for upgrades later.
Whether software is easy to use, or never loses data, when the company
has a near monopoly, is almost irrelevant to profits, and therefore
ignored. The manufacturer focuses on cheap gimicks like dancing paper
clips to dazzle naive first-time buyers. The needs of existing
experienced users are almost irrelevant. I see software rental as the
best remedy.
 
A

Arne Vajhøj

I am baffled by the appeal of JavaScript.

Maybe you know too little about JavaScript.
I find it being used on the web to write code that works with only
one browser.

Most JavaScript developers are capable of writing JavaScript that
works in multiple browsers.
I believe it has no sandbox, so it is beloved of websites that want to
install Trojans.

It has a security model preventing it from accessing PC disk.
It is passed around in fluffy text form.

It would not make much difference to compile it to byte code.
It is not OO.

It is object oriented (but also uses other paradigms especially
prototype based).
Read up on how you write extensions to browsers, email programs, IDEs
and the like. Instead of using some sane language like Java, they
either concoct some ad hoc monstrosity, or use JavaScript. What are
they thinking?

JavaScript is one of the most widely used languages.

Almost all web pages today uses JavaScript. It is starting to be
used in smartphone apps (phonegap etc.). It will be used in
desktop apps (MS Metro and JavaFX). It is even used a little
bit server side (node.js).

A language that can be used for many different things with a
huge number of available programmers. That is very attractive.

Actually I don't "like" JavaScript either, but "like" means
nothing.

Arne
 
A

Andrew Thompson

I am baffled by the appeal of JavaScript.

(Sigh) I've said most of this before, to you, but..
 I find it being used on the web to write code that works with only
one browser.

'Feature detection' is the solution to that problem. It is not the
fault of JS that programmers don't know how to use it.
I believe it has no sandbox, so it is beloved of websites that want to
install Trojans.

The only real aspect of JS that was a security threat AFAIU is the
ability of IE to use it to load ActiveX objects. The solution is
to switch to another browser. That was a long time ago, though,
and I have not bothered to keep up on the security of IE, since I
don't use it.
It is passed around in fluffy text form.

Obfuscated JS can be pretty small, especially compared to the 20-30Kb
images that will typically be embedded in a web page. Further,
scripts
are typically cached by browsers. Use one script of 4Kb in 100
pages,
and the user downloads just 4Kb of script.
It is not OO.

It is prototyped OO.

http://en.wikipedia.org/wiki/Prototype-based_programming
Read up on how you write extensions to browsers, email programs, IDEs
and the like. Instead of using some sane language like Java, they
either concoct some ad hoc monstrosity, or use JavaScript. ..

I won't comment on that situation, but instead one I am working with
right now. I want to offer the user of a collection of web pages,
the
ability to do an intelligent 'full-text search' on content in the
pages.

To offer this, I use JavaHelp. While it is possible to put a JHelp
component into a Java applet, the JHelp component would then display
the search results in a JavaHelp navigator component, and the content
in the JavaHelp content viewer - not what I want for a number of
reasons.

The first problem with that is the hits themselves. Show them in
JavaHelp and the links provide no sense of history with 'visited /
unvisited', colors - which can be important for trawling around
through a lot of hits.

The second problem is the content viewer (a JEditorPane) and its
lack of support for much of the embedded content that might be
located (which might use Flash or other applets etc.).

By grabbing the links from the the search applet using JavaScript,
and writing them directly to the browser window, both problems are
solved.

While it is true that an applet can manipulate the DOM of a web page,
it is like trying to change the rings of a car engine - through the
tail-pipe (to rip a common joke about Gynecologists).

...And it usually fails when JS is disabled, anyway. ;)
 
N

Nasser M. Abbasi

They are still fully supported by Java.

They are no longer widely used on WWW.

AJAX JavaScript, Flash, SilverLight etc. has taken that
market.

hi;

fyi,

it looks like Flash is sliding away?

"November 9, 2011 03:53 PM ET"

"Adobe's decision to stop Flash Player development for mobile browsers
will likely be repeated for browsers on the desktop, just not anytime soon,
analysts said today"

http://www.computerworld.com/s/arti...esktop_inevitable_but_years_away_say_analysts

May be time to start learning HTML5? I wonder if one can do OO in HTML5 ;)

--Nasser
 
A

Arne Vajhøj

it looks like Flash is sliding away?

"November 9, 2011 03:53 PM ET"

"Adobe's decision to stop Flash Player development for mobile browsers
will likely be repeated for browsers on the desktop, just not anytime soon,
analysts said today"

http://www.computerworld.com/s/arti...esktop_inevitable_but_years_away_say_analysts

May be time to start learning HTML5? I wonder if one can do OO in HTML5 ;)

Flash never really made it into mobile browsers.

So this decision is somewhat more recognizing fact than a change
of direction.

Flash will live for many years in desktop browsers.

Eventually it will disappear there too.

Technology changes over time.

Arne
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,769
Messages
2,569,582
Members
45,065
Latest member
OrderGreenAcreCBD

Latest Threads

Top