By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
434,742 Members | 2,026 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 434,742 IT Pros & Developers. It's quick & easy.

javascript to execute java program

P: n/a
I have compile my java program as myjava.class. And I can run as "java
myjava" without any program.
As now, I need to execute myjava.class in javascript. Please shed a
light how to execut "java myjava" in
my javascript. Thanks a million.
Sep 29 '08 #1
Share this Question
Share on Google+
6 Replies


P: n/a
Javascripts runs in the browser you won't be able to do that. You
can't call programs in the server on in the client computer from
javascript.
Sep 29 '08 #2

P: n/a
Sister Ray wrote:
Javascripts runs in the browser you won't be able to do that. You
can't call programs in the server on in the client computer from
javascript.
Utter nonsense.

1. Neither programming language, including ECMAScript implementations
like JavaScript, is restricted to the client or the server.

2. If the Java program is an applet, LiveConnect/XPConnect can be used
to access it from JavaScript.

3. If the Java program is a servlet, a HTTP request can trigger it.
HTTP requests can be initiated with JavaScript using an
external API (e.g., DOM or XHR).
PointedEars
--
Prototype.js was written by people who don't know javascript for people
who don't know javascript. People who don't know javascript are not
the best source of advice on designing systems that use javascript.
-- Richard Cornford, cljs, <f8*******************@news.demon.co.uk>
Sep 29 '08 #3

P: n/a
On Sep 29, 3:41*pm, Thomas 'PointedEars' Lahn <PointedE...@web.de>
wrote:
Sister Ray wrote:
Javascripts runs in the browser you won't be able to do that. You
can't call programs in the server on in the client computer from
javascript.

Utter nonsense.

1. Neither programming language, including ECMAScript implementations
* *like JavaScript, is restricted to the client or the server.

2. If the Java program is an applet, LiveConnect/XPConnect can be used
* *to access it from JavaScript.

3. If the Java program is a servlet, a HTTP request can trigger it.
* *HTTP requests can be initiated with JavaScript using an
* *external API (e.g., DOM or XHR).

PointedEars
--
Prototype.js was written by people who don't know javascript for people
who don't know javascript. People who don't know javascript are not
the best source of advice on designing systems that use javascript.
* -- Richard Cornford, cljs, <f806at$ail$1$8300d...@news.demon.co.uk>
would you please give me some example how to execute the myjava.class
via javascript.
I have tried so many differnt, it doesn't seem working.
Thanks so much.
Sep 29 '08 #4

P: n/a
moongeegee wrote:
Thomas 'PointedEars' Lahn wrote:
>1. Neither programming language, including ECMAScript implementations
like JavaScript, is restricted to the client or the server.

2. If the Java program is an applet, LiveConnect/XPConnect can be used
to access it from JavaScript.

3. If the Java program is a servlet, a HTTP request can trigger it.
HTTP requests can be initiated with JavaScript using an
external API (e.g., DOM or XHR).
[snipped quoted signature]

would you please give me some example how to execute the myjava.class
via javascript.
That depends on where it runs and what the type of program it is.
I have tried so many differnt, it doesn't seem working.
<http://jibbering.com/faq/#FAQ2_3>
Thanks so much.
You are welcome.
PointedEars
--
var bugRiddenCrashPronePieceOfJunk = (
navigator.userAgent.indexOf('MSIE 5') != -1
&& navigator.userAgent.indexOf('Mac') != -1
) // Plone, register_function.js:16
Sep 30 '08 #5

P: n/a
On Sep 30, 2:32*am, Thomas 'PointedEars' Lahn <PointedE...@web.de>
wrote:
moongeegee wrote:
Thomas 'PointedEars' Lahn wrote:
1. Neither programming language, including ECMAScript implementations
* *like JavaScript, is restricted to the client or the server.
2. If the Java program is an applet, LiveConnect/XPConnect can be used
* *to access it from JavaScript.
3. If the Java program is a servlet, a HTTP request can trigger it.
* *HTTP requests can be initiated with JavaScript using an
* *external API (e.g., DOM or XHR).
[snipped quoted signature]
would you please give me some example how to execute the myjava.class
via javascript.

That depends on where it runs and what the type of program it is.
I have tried so many differnt, it doesn't seem working.

<http://jibbering.com/faq/#FAQ2_3>
Thanks so much.

You are welcome.

PointedEars
--
var bugRiddenCrashPronePieceOfJunk = (
* * navigator.userAgent.indexOf('MSIE 5') != -1
* * && navigator.userAgent.indexOf('Mac') != -1
) *// Plone, register_function.js:16
If he's executing the program via the java command, then it's actually
some sort of either desktop or headless application, and neither a
servlet nor an applet. The other question remains "Where does this
application lie?". Is it on the server or the client?

If it's on the client, then I know of no way to execute a java
application via javascript. For you gurus out there who want to chime
in, it would be just like running any other application installed on
the client pc....

If the java application is on the server, then you will have to write
a servlet that executes the java application, and have the javascript
call the servlet to ask it to do so.
Sep 30 '08 #6

P: n/a
Tom Cole wrote:
Thomas 'PointedEars' Lahn wrote:
>moongeegee wrote:
>>Thomas 'PointedEars' Lahn wrote:
1. Neither programming language, including ECMAScript implementations
like JavaScript, is restricted to the client or the server.
2. If the Java program is an applet, LiveConnect/XPConnect can be used
to access it from JavaScript.
3. If the Java program is a servlet, a HTTP request can trigger it.
HTTP requests can be initiated with JavaScript using an
external API (e.g., DOM or XHR).
[snipped quoted signature]
would you please give me some example how to execute the myjava.class
via javascript.
That depends on where it runs and what the type of program it is.
>>I have tried so many differnt, it doesn't seem working.
<http://jibbering.com/faq/#FAQ2_3>
[...]

If he's executing the program via the java command, then it's actually
some sort of either desktop or headless application, and neither a
servlet nor an applet.
ACK, I overlooked the second sentence, probably due bad writing.
The other question remains "Where does this
application lie?". Is it on the server or the client?

If it's on the client, then I know of no way to execute a java
application via javascript. For you gurus out there who want to chime
in, it would be just like running any other application installed on
the client pc....
There is a way, just not an interoperable one.
If the java application is on the server, then you will have to write
a servlet that executes the java application, and have the javascript
call the servlet to ask it to do so.
Correct if you mean "HTTP request" by "call" (why are you reiterating what
was just said?). Another possibility that comes to mind are XML-RPCs.

Please trim your quotes as recommended in the FAQ (see above).
PointedEars
--
Use any version of Microsoft Frontpage to create your site.
(This won't prevent people from viewing your source, but no one
will want to steal it.)
-- from <http://www.vortex-webdesign.com/help/hidesource.htm>
Sep 30 '08 #7

This discussion thread is closed

Replies have been disabled for this discussion.