javascript to execute java program

M

moongeegee

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

Sister Ray

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

Thomas 'PointedEars' Lahn

Sister said:
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
 
M

moongeegee

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, <[email protected]>

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

Thomas 'PointedEars' Lahn

moongeegee said:
Thomas said:
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.

Thanks so much.

You are welcome.


PointedEars
 
T

Tom Cole

moongeegee said:
Thomas said:
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.

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

Thomas 'PointedEars' Lahn

Tom said:
Thomas said:
moongeegee said:
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
 

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

Forum statistics

Threads
474,139
Messages
2,570,805
Members
47,351
Latest member
LolaD32479

Latest Threads

Top