Solved

Starting application from applet

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

Secure Your Active Directory - April 20, 2017

Active Directory plays a critical role in your company’s IT infrastructure and keeping it secure in today’s hacker-infested world is a must.
Microsoft published 300+ pages of guidance, but who has the time, money, and resources to implement? Register now to find an easier way.

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
egit plugin on eclipse 8 102
jboss wildfly 10.1 10 437
jsp insert to database example 2 66
Java Inharitance subclass/child extends, reference variable from base/parent class 9 36
For beginner Java programmers or at least those new to the Eclipse IDE, the following tutorial will show some (four) ways in which you can import your Java projects to your Eclipse workbench. Introduction While learning Java can be done with…
Go is an acronym of golang, is a programming language developed Google in 2007. Go is a new language that is mostly in the C family, with significant input from Pascal/Modula/Oberon family. Hence Go arisen as low-level language with fast compilation…
Viewers learn about the “while” loop and how to utilize it correctly in Java. Additionally, viewers begin exploring how to include conditional statements within a while loop and avoid an endless loop. Define While Loop: Basic Example: Explanatio…
This theoretical tutorial explains exceptions, reasons for exceptions, different categories of exception and exception hierarchy.

730 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