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
Solved

Starting application from applet

Posted on 1997-07-22
3
278 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
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

Free Tool: IP Lookup

Get more info about an IP address or domain name, such as organization, abuse contacts and geolocation.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

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

Suggested Solutions

After being asked a question last year, I went into one of my moods where I did some research and code just for the fun and learning of it all.  Subsequently, from this journey, I put together this article on "Range Searching Using Visual Basic.NET …
In this post we will learn how to connect and configure Android Device (Smartphone etc.) with Android Studio. After that we will run a simple Hello World Program.
Viewers learn about the scanner class in this video and are introduced to receiving user input for their programs. Additionally, objects, conditional statements, and loops are used to help reinforce the concepts. Introduce Scanner class: Importing…
This theoretical tutorial explains exceptions, reasons for exceptions, different categories of exception and exception hierarchy.

828 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