Solved

Starting application from applet

Posted on 1997-07-22
3
289 Views
Last Modified: 2012-06-27
Hi,
  Is there any way to start an application (on server, of   course) from an applet. I don't want to use RMI. I want
  my application do perform some tranactions based on   applet's input.
  input.
 
0
Comment
Question by:brat072297
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
3 Comments
 

Expert Comment

by:musser
ID: 1223615
You would like to start an application on the same
host as the HTTP Server so that you can have it perform
transactions based on the applets input.
Do you require a response from this application?

It sounds like you could do this using a CGI invokation of
the application. Is this what you had in mind?  You could use
servlets.

Another approach would be to create an application server which runs on the HTTP host and listens on a dedicated port.  The
applet opens a socket on this port and sends a message to the
app server which indicates which application to run.  The application server spawns a process to run the given
application.  Results can be returned a variety of ways.


0
 

Author Comment

by:brat072297
ID: 1223616
I was thinking of CGI, too.
However I don't have any idea how to pass the reslult (vector of
strings) back to the applet (it has to be passed to the applet, because I want it to communicate with JavaScript).
0
 
LVL 1

Accepted Solution

by:
blacklion earned 150 total points
ID: 1223617
You can do it with CGI, servlets and others by connecting to the server from your applet as following:

Vector strings = null;
try
{
  InputStream in = new URL("http://someserver/cgi-bin/some.cgi").
    openStream();
  DataInputStream din = new DataInputStream(in);  
  for (String line = is.readLine(); line != null;)
    {
      strings.addElement (line);
    }
  din.close();
  in.close();
}
catch(MalformedURLException e)
{
  <bad URL>
  strings = null;
}
catch (IOException e)
{
  <error in I/O>
  strings = null;
}

if (strings != null)
  <strings contains output from the server>


You can also use URL.openConnection().getInputStream() and so on.

0

Featured Post

Salesforce Has Never Been Easier

Improve and reinforce salesforce training & adoption using WalkMe's digital adoption platform. Start saving on costly employee training by creating fast intuitive Walk-Thrus for Salesforce. Claim your Free Account Now

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Introduction This article is the last of three articles that explain why and how the Experts Exchange QA Team does test automation for our web site. This article covers our test design approach and then goes through a simple test case example, how …
In this post we will learn different types of Android Layout and some basics of an Android App.
Viewers will learn one way to get user input in Java. Introduce the Scanner object: Declare the variable that stores the user input: An example prompting the user for input: Methods you need to invoke in order to properly get  user input:
This video teaches viewers about errors in exception handling.

724 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question