Thanks a lot for your help.
Best,
Haoyu
AFIK, no. But, remember that 'Java' and 'Java Applet' are different things.
And 'Java' doesn't support something like 'Java Applet'.
Just don't get confused by the names. Browsers have embedded a 'Java Applet'
interpreter. You can't execute Java there.
. Facundo
> #- I am in the process to choose which to learn. Java or
> #- Python? I was told that
> #- Python is much more neat. But I am not sure about its
> #- functionality. Can it
> #- support something like Java Applet? If so, I will learn this one.
>
> AFIK, no. But, remember that 'Java' and 'Java Applet' are different
> things. And 'Java' doesn't support something like 'Java Applet'.
Excuse me? A Java applet is built with Java. Perhaps you are thinking of
Javascript?
> Just don't get confused by the names. Browsers have embedded a 'Java
> Applet' interpreter. You can't execute Java there.
Of course you can, that's the whole point!
Anyway, to answer the original question, browsers don't have a built-in
Python runtime, but that doesn't really matter as you can use JPython to
construct a Java applet from Python sources.
Take a look here for more information:
<URL:http://www.jython.org/applets/>
Remember that this has the same drawbacks as with Java applets - not all
user-agents (browsers) support them, and it's often a better idea to do
things on the server.
--
Jim Dabell
> AFIK, no. But, remember that 'Java' and 'Java Applet' are different things.
> And 'Java' doesn't support something like 'Java Applet'.
>
> Just don't get confused by the names. Browsers have embedded a 'Java Applet'
> interpreter. You can't execute Java there.
>
I think that here is some confusion.
A "Java Applet" as to my best knowledge *is* Jave, but it runs in a very
limited sandbox that prevents it from doing bad things to the machine
where the browser runs.
If you *really* need that sort of thing (that is, run custom code in a
clients browser) Java will be your best bet as it is the only approach
that is somewhat cross-platform.
Another possibility to run code in a browser would be ActiveX (which is
only available on Windows) or writing Browser-PlugIns (which are
platform and browser dependent).
My recommendation to the original poster would be to learn both :-)
best regards
Werner
[Jim Dabell]
> Of course you can, that's the whole point!
>
> Anyway, to answer the original question, browsers don't have a built-in
> Python runtime,
Actually, that's not strictly true. The win32all windows extensions
install a python interpreter COM object, which can used as a scripting
plugin with the Windows Scripting Host (WSH), meaning that one can
embed python in an HTML page, in the same manner as Javascript.
Documentation is here:
http://www.python.org/windows/win32com/ActiveXScripting.html
However, your script will only run on Internet Explorer browsers that
have python *registered* as a scripting language. Which is possibly
not a problem on an Intranet, where one can make's one's users install
the plugin, but is unlikely to have widespread support on the
Internet.
The "install" vs. "register" distinction is necessary because
registering python as a scripting language opens up some serious
security holes. Because python doesn't currently have a restricted
execution ("sandbox") environment similar to java applet-playing
plugins, python scripts embedded in pages displayed by Internet
Explorer have pretty much total control over the users machine. The
first report of that, with details of some potential attacks, can be
found here:-
http://groups.google.com/groups?hl=en&lr=&ie=UTF-8&selm=3C44A774.5DFCDE15%40computerbytesman.com
> you can use JPython to
> construct a Java applet from Python sources.
An excellent solution.
I would recommend to the OP to consider learning *both* java and
python at the same time, by learning jython. Others may strongly
disagree however.
regards,
--
alan kennedy
-----------------------------------------------------
check http headers here: http://xhaus.com/headers
email alan: http://xhaus.com/mailto/alan
#- > AFIK, no. But, remember that 'Java' and 'Java Applet' are different
#- > things. And 'Java' doesn't support something like 'Java Applet'.
#-
#- Excuse me? A Java applet is built with Java. Perhaps you
#- are thinking of
#- Javascript?
You're fully right.
MY mistake, sorry.
. Facundo
. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
ADVERTENCIA
La información contenida en este mensaje y cualquier archivo anexo al mismo, son para uso exclusivo del destinatario y pueden contener información confidencial o propietaria, cuya divulgación es sancionada por la ley.
Si Ud. No es uno de los destinatarios consignados o la persona responsable de hacer llegar este mensaje a los destinatarios consignados, no está autorizado a divulgar, copiar, distribuir o retener información (o parte de ella) contenida en este mensaje. Por favor notifíquenos respondiendo al remitente, borre el mensaje original y borre las copias (impresas o grabadas en cualquier medio magnético) que pueda haber realizado del mismo.
Todas las opiniones contenidas en este mail son propias del autor del mensaje y no necesariamente coinciden con las de Telefónica Comunicaciones Personales S.A. o alguna empresa asociada.
Los mensajes electrónicos pueden ser alterados, motivo por el cual Telefónica Comunicaciones Personales S.A. no aceptará ninguna obligación cualquiera sea el resultante de este mensaje.
Muchas Gracias.
I think Mozilla supports this too (PyXPCOM).
> have python *registered* as a scripting language. Which is possibly
> not a problem on an Intranet, where one can make's one's users install
> the plugin, but is unlikely to have widespread support on the
> Internet.
[...]
I suppose you could write an ActiveX control to distribute CPython.
Writing a Java applet with Jython is the sane way to do it, of course
(security and amount of data to be transferred to the client).
John
> Batista, Facundo wrote:
[...]
> If you *really* need that sort of thing (that is, run custom code in a
> clients browser) Java will be your best bet as it is the only approach
> that is somewhat cross-platform.
[...]
And, just to hammer the point home for the OP, Jython will let you
write Java applets.
Jython is a implementation of Python -- Python and Jython are the same
language -- but, at the same time, Jython code compiles to Java class
files (which, of course, depend on a runtime library, itself written
in Java), and so Jython *is* Java in an important sense.
It's been said many times that it's easier to program Java in Python
(Jython in particular) than it is in Java.
John
Thanks for the link,
Josef
Dear Facundo,
I think you mean Java Script here, right? I feel Java Applet is an
important application of Java. Thanks for your reply.
Haoyu
There have been at least rudimentary marriages of Flash and
Python. I suspect the two could get along quite well. I
don't know whether someone has already done this.
--
Cameron Laird <cla...@phaseit.net>
Business: http://www.Phaseit.net
One rudimentary marriage -- some might call it a weekend fling --
exists in Twisted, where the (experimental?) LivePage feature
supports having ActionScript code in a zero-width Flash movie
sending client-side events through a socket opened to the
server, to allow dynamic interfacing of server-side Python code
and client-side events. Updates in the other directly are
supported as well, so that the server can cause arbitrary
Javascript code to be executed in the client...
It's pretty, uh, "twisted". (Even more so is that the IE version
of this seems to require some VBScript glue in the web page, to
interface Flash to Javascript. Let's see, that's four languages
interfaced together just to handle your onClick events. :-)
-Peter
Thanks a lot for your replies. I get somewhat clarified. Anyway, I will
begin learning Python and Jython. And I will also learn Java when needed.
All the best,
Haoyu