Running a Java application from web browser

Hi,
I'm not sure if this is the right place to put this, and it probably isn't, but I don't really know what else to do at the moment.
I have a problem. I've written all these nice and pretty Java applications that do all this complicated junk that makes me proud. However...I have no idea how to actually run those applications.
I've looked at guides on Java applets, Java Web Start, Java Server Pages, etc, and I still am not sure. JSP looked like the best option, until I figured out I can't use it with my web server. So, I've pretty much hit a wall here.
If anyone could shed some light on this, I would be very appreciative. All I want is for a certain application to run when a user clicks a button on a simple HTML page. That's all I want...yet it seems so hard.
Is there a simple way to do this, or do I need to use JWS or something and configure all these JARs and JNLP and classpaths and everything under the sun (no pun intended)?
Again, I apologize if there is a better forum for this; I am just very confused right now and feel like I've hit a brick wall. If anyone can give me any advice, or point me in a good (easy) direction, I would truly be grateful.

If anyone could shed some light on this, I would be
very appreciative. All I want is for a certain
application to run when a user clicks a button on a
simple HTML page. That's all I want...yet it seems so
hard. There's a lot of hidden details that make it so hard. What computer will run the application when the button is clicked? If the application will run on the client computer (within the web browser) there has to be a mechanism for allowing arbitrary code to be downloaded, verified and executed on any number of different target platforms. This is the problem that Java Applets address. Mostly this is a security issue, since a simple HTML page being able to run arbitary code without user interaction or approval is going to cause the world to be overrun by computer virii. There's also the multi-platform issue, but in many cases that can be avoided by requiring the client to use a single platform (the MS approach).
If the application will run on the server, then the client code is much less difficult, as only a basic web browser is needed, and the server code is complicated, since it needs to keep track of multiple clients at the same time and process data in a request-response fashion.
From the end-user's point-of-view, it certainly is simple though. Press the button and voila!
"Any technology which is distinguishable from magic is insufficiently advanced"
Brian

Similar Messages

  • Running a Java application from a Swing GUI

    Hi,
    I was wondering if there is a simple way to run a Java application from a GUI built with Swing. I would presume there would be, because the Swing GUI is a Java application itself, technically.
    So, I want a user to click a button on my GUI, and then have another Java application, which is in the same package with the same classpaths and stuff, run.
    Is there a simple way to do this? Do any tutorials exist on this? If someone could give me any advice, or even a simple "yes this is possible, and it is simple" or "this is possible, but difficult" or "no this is not possible" answer, I would appreciate it. If anyone needs more information, I'll be happy to provide it.
    Thanks,
    Dan

    I don't know if it is possible to run the main method from another Java app by simply calling it...
    But you could just copy and paste the stuff from your main method into a new static method called something like runDBQuery and have all the execution run from there.
    How does that sound? Is it possible?
    What I'm suggeting is:
    Original
    public class DBQuery{
    public static void methodA(){
    public static void doQuery(){
    methodA();
    public static void main(String[] args){
    // Your method calls
    //Your initializing
    doQuery();
    }Revised:
    public class DBQuery{
    public static void methodA(){
    public static void doQuery(){
    methodA();
    public static void doMyQuery(){
    // Your method calls
    //Your initializing
    doQuery();
    // No main needed!!
    //public static void main(String[] args){
    // Your method calls
    //doQuery();
    //}

  • Running a java application from a java application

    hello ,
    please who knows how i can run a java application 'B' from inside another java application 'A' and get the error messages (if any) from the application 'B'

    how are you executing application B from application A? Please explain the java code you are using?

  • Running a Java application from a web page?

    Hi
    Could anyone please tell me how do i launch a java application (which is not an applet) by clicking a button on a web page?
    Does the application have to be converted to .exe? And if so how do i do it?
    The application is on my PC not on a server.
    Thanking u in advance for ur help.

    Hi dins19
    Java WebStart is a pretty good technology for that purpose. Installing and launching a Java application on a local machine has always been a burdensome task. JWS really remedies that. The cool thing about JWS is that it works for both web and client applications. The technology introduces a new file format called jnlp which tells a program called "Java Web Start Application Manager" where the resources, typically a single jar file, are located. Check out
    http://java.sun.com/products/javawebstart/
    for a nifty demo.
    Hope this has been of some help.
    Morten Hjerl-Hansen

  • Launching Java applications from web pages

    Hi there,
    Do you know how to launch Java applications (not applets) from web pages ? Thank you.
    Berk Can Celebisoy

    Do you know how to launch Java applications (not applets) from web pages ? Thank you.
    you can setoff a java servlet from a webpage.Is that what you are talking about ??? activeateing a server side app ????

  • Error when running "Run as" Java application from NWDS

    Dear All,
    I am trying to run the following .java proggie...
    Thanks for that. By the way, I am now trying to compile the following .java program.....
    Created on 01-Oct-2007
    To change the template for this generated file go to
    Window>Preferences>Java>Code Generation>Code and Comments
    @author chris.jackson
    To change the template for this generated type comment go to
    Window>Preferences>Java>Code Generation>Code and Comments
    import com.sap.lcr.api.cimclient.CIMClient;
    import com.sap.lcr.api.cimclient.CIMClientHandle;
    import com.sap.lcr.api.cimclient.CIMOMClient;
    import com.sap.lcr.api.cimclient.ClientFactory;
    import com.sap.lcr.api.sapmodel.SAP_AppServJCODestination;
    import com.sap.lcr.api.sapmodel.SAP_JCODestination;
    import com.sap.lcr.api.sapmodel.SAP_JCODestinationAccessor;
    import com.sap.lcr.api.sapmodel.SAP_MsgServJCODestination;
    import com.sap.mw.jco.JCO;
    import com.tssap.dtr.client.lib.protocol.URL;
    public class sldpoke {
    public void main() {
    ClientFactory factory = ClientFactory.newInstance();
    try {
    final URL url = new URL("http://ex1d002a.eu.unilever.com:58300/sld/cimom");
    String sldUsername = "cjacks01";
    String sldPassword = "password";
    CIMOMClient cimomClient = factory.createClient (url, sldUsername, sldPassword);
    CIMClient cc = new CIMClient(cimomClient);
    CIMClientHandle cch = (CIMClientHandle) cc;
    SAP_JCODestinationAccessor jcoAccessor = new SAP_JCODestinationAccessor(cc);
    SAP_JCODestination[] jcoDestinations = jcoAccessor.enumerateSAP_JCODestinationInstances();
    JCO.Client jcoClient = null;
    String user = null;
    String pwd = null;
    // iterate over all destinations
    for (int i = 0; i < jcoDestinations.length; i++)
    SAP_JCODestination jcoDestination = jcoDestinations;
    user = jcoDestination.getLogonUser();
    pwd = jcoDestination.getLogonPwd();
    if (jcoDestination instanceof SAP_AppServJCODestination)
    SAP_AppServJCODestination jcoDest = (SAP_AppServJCODestination) jcoDestination;
    jcoClient = JCO.createClient(jcoDest.getLogonBCClient(),
    user,
    pwd,
    jcoDest.getLogonLanguage(),
    jcoDest.getAppServHost(),
    jcoDest.getAppServNumber());
    else if (jcoDestination instanceof SAP_MsgServJCODestination)
    SAP_MsgServJCODestination jcoDest = (SAP_MsgServJCODestination) jcoDestination;
    jcoClient = JCO.createClient(jcoDest.getLogonBCClient(),
    user,
    pwd,
    jcoDest.getLogonLanguage(),
    jcoDest.getMsgServHost(),
    jcoDest.getSAPSystemName(),
    jcoDest.getLogonGroup());
    } catch (Exception e) {
    and I am getting the message "The selection does not contain a main type". The class contains a 'main' function so I am at a loss as to what the problem is. Any ideas how I progress?
    Kind Regards
    Chris Jackson.

    Hi! Jakson,
       to run a Stand-alone Java application, we must have one main() method like...
    public static void main(String args[]){ }
    i can't see this main() method on your appliation.
    regards,
    Mithileshwar

  • Running a java application from different directory

    I have the file in my
    c:/Folder/Program.java
    I want to compile and run it from D:/ (drive)i.e from different directory.
    Thanks in advance,
    Praveen.

    javac -cp c:\Folder c:\Folder\Program.java
    java -cp c:\Folder Program

  • Calling Java application from servlet

    Hi !
    I'm trying to run a Java application from within a servlet with Tomcat 4. I'm using the Runtime.getRuntime ().exec () method. So the application is run in a different JVM as a subprocess of the servlet. I use ObjectInputStream and ObjectOutputStream and a serializable object to enable communication between the servlet and the application.
    I tested the application and the serializable object with another Java application that works as the caller and it works fine. However, replacing the caller application with the servlet I get a StreamCorruptedException. The structure of the caller application and the servlet is the same.
    My questions are:
    - Is there something I should configure in Tomcat to create a subprocess ?
    - What is the cause of the StreamCorruptedException ? How do I get it with the servlet and not with the application ?
    - Should I use an environment with the call to Runtime.getRuntime ().exec () ? How do I use it ?
    - Is the called application forced to run in my servlet's context ?
    - Is there a better way to do this ?
    Thanks to all

    Here's my code:
    1. The serializable object:
    // Object Obj
    import java.io.*;
    public class Obj implements Serializable
    public int n;
    public Obj ()
    n = 0;
    public Obj (int n)
    this.n = n;
    public String toString ()
    return getClass ().getName () + " -> (n = " + n + ")";
    2. The application Sub (subprogram)
    // Application Sub
    import java.io.*;
    public class Sub
    private static File f;
    private static FileWriter fw;
    public static void main (String [] args)
    throws IOException, InterruptedException, ClassNotFoundException
    ObjectInputStream ois;
    ObjectOutputStream oos;
    Obj obj;
    ois = new ObjectInputStream (System.in);
    obj = (Obj) ois.readObject ();
    f = new File ("Sub.txt");
    fw = new FileWriter (f);
    fw.write (obj.toString ());
    fw.close ();
    oos = new ObjectOutputStream (System.out);
    oos.writeObject (obj);
    ois.close ();
    oos.close ();
    3. The application AMain (caller application)
    // Application AMain
    import java.io.*;
    class AMain
    private static File f;
    private static FileWriter fw;
    public static void main (String [] args)
    throws IOException, ClassNotFoundException
    Runtime r;
    Process p;
    ObjectInputStream ois;
    ObjectOutputStream oos;
    Obj obj, obj2;
    r = Runtime.getRuntime ();
    p = r.exec ("java Sub");
    oos = new ObjectOutputStream (p.getOutputStream ());
    obj = new Obj (5);
    oos.writeObject (obj);
    oos.flush ();
    B.comunica (obj);
    System.out.println ("AMain sends to Sub: " + obj.toString ());
    try
    p.waitFor ();
    catch (InterruptedException e)
    System.out.println ("Subprogram was interrupted");
    System.out.println (e.toString ());
    ois = new ObjectInputStream (p.getInputStream ());
    System.out.print ("Sub sends to AMain: ");
    obj2 = (Obj) ois.readObject ();
    System.out.println (" " + obj2.toString ());
    oos.close ();
    ois.close ();
    p.destroy ();
    4. The servlet SMain (the calling servlet)
    // Servlet SMain
    import javax.servlet.*;
    import javax.servlet.http.*;
    import java.sql.*;
    import java.io.*;
    import java.util.*;
    public class SMain extends HttpServlet
    public void doPost (HttpServletRequest req, HttpServletResponse res)
    throws ServletException, IOException
    Runtime r;
    Process p;
    ObjectInputStream ois;
    ObjectOutputStream oos;
    Obj obj, obj2;
    int state, i;
    res.setContentType ("text/html");
    ServletOutputStream out = res.getOutputStream ();
    out.println ("<html>");
    out.println ("<head><title>Sub</title></head>");
    out.println ("<body>");
    out.println ("Invoking subprogram...");
    out.println ("<br>");
    try
    r = Runtime.getRuntime();
    p = r.exec ("java -cp .;c:\\Programs\\Apache~1.0\\webapps\\SMain\\WEB-INF\\classes Sub");
    out.println ("...invoked<br>");
    oos = new ObjectOutputStream (p.getOutputStream ());
    obj = new Obj (5);
    oos.writeObject (obj);
    oos.flush ();
    out.println ("<br>SMain sends to Sub: " + obj.toString () + "<br>");
    try
    p.waitFor ();
    catch (InterruptedException e)
    out.println ("<br>Subprogram was interrupted<br>");
    out.println ("<br>" + e.toString () + "<br>");
    state = p.exitValue ();
    out.println ("<br>Subprogram state: " + state + "<br>");
    ois = new ObjectInputStream (p.getInputStream ());
    out.print ("<br>Sub sends to SMain: ");
    obj2 = (Obj) ois.readObject ();
    p.destroy ();
    catch (SecurityException e)
    out.println ("<br>SecurityException<br>");
    out.println ("<br>" + e.toString () + "<br>");
    catch (IOException e)
    out.println ("<br>IOException<br>");
    out.println ("<br>" + e.toString () + "<br>");
    catch (Exception e)
    out.println ("<br>Exception<br>");
    out.println ("<br>" + e.toString () + "<br>");
    out.println ("</body>");
    out.println ("</html>");
    So, as you can see, both application AMain and servlet SMain invoke application Sub and pass it the serializable object Obj. Oddly enough, application AMain works fine whereas servlet SMain throws a StreamCorruptedException exception.
    johnpoole said:
    �It's hard to guess what would cause the exception without seeing code, but the interaction between the processes would differ from that between two applications, because the servlet process is started with a different class loader. I'm not sure which one the jvm started by the call would use.�
    How can I enforce that a System classloader be used in the call to Runtime.getRuntime ().exec () ? (I mean by System classloader a classloader equals to the one applications are launched from console).
    johnpoole said
    �Is there a reason why you aren't starting the second process manually and then connecting to it on a port?�
    The idea is providing a Web interface for an application running in the server. The servlet is used to restrict access to this application but once access is granted (passing the servlet) the application should not be constrained.

  • Is it possible to run a java application within a web browser?

    Hello everyone here! I have a question about running a java application within a web browser and I would appreciate it very much if anyone here can give me some answers.
    I have a standalone java application written with AWT. Basically this free application lets users to select spectral lines from a big file based on some criteria and plot those selected lines. Yes, it is a very simple application. Now I want to run this application within a web browser so that users don't need to download the application from the ftp site and thus don't need to install in their machine. Is it possible to run this application within browser? If yes, can we get the same plotting function as we run the application separately and where should I start out?
    Thanks in advance!
    kuilian

    Please see the signed applet discussion group for details of how to avoid the applet security restrictions. You can sign the applet, or use the policy file containing {AllPermission} for testing purposes (though not suitable for widespread deployment).
    Regards
    Matthew

  • How to open a java application from a web page?

    Friends
    I am in a situation to open a java application from a web page. I wrote a applet and placed a button on it. Onclicking of that button i con't open my java application. plz help me to open a userdefined application from web page.
    Ramesh
    e-Brahma technologies

    http://java.sun.com/products/javawebstart/index.jsp

  • Calling a java application from j2ee web application

    Hi,
    I have a j2ee application in which i am making a call to a jar file which is a java application.
    Runtime a4 = Runtime.getRuntime();
    Runtime a = Runtime.getRuntime();
    String cmd[] = new String[14];
    cmd[0] = "cmd";
    cmd[1] = "/c";
    cmd[2] = "start";
    cmd[3] = "javaw";
    cmd[4] = "-jar";
    cmd[5] = CATALINA_HOME+"\\webapps\\AveksaTesting\\AveksaTestingJava\\dist\\AveksaTestingJava.jar";
    cmd[6] = SERVER_TESTS;
    cmd[7] = COLLECTOR_TESTS;
    cmd[8] = SYSTEM_TESTS;
    cmd[9] = CREATE_ORACLE;
    cmd[10] = DB_NAME;
    cmd[11] = DB_DUMP;
    cmd[12] = email;
    cmd[13] = isMIGRATE;
    try{
    java.lang.Process p = a.exec(cmd);
    Now in the called java application, i am first shutting down the tomcat server by calling shutdown.bat script and then starting it using startup.bat. But the problem i am facing is when i restart the server from java application, it says address already in use(i.e. port 8445 on which tomcat is runninng).
    Id i just call the java application and do the same operation it works fine. I guess when i am calling java from j2ee application, j2ee still has some threads holding java and not shutting down tomcat properly.
    Can anyone suggest me what can be done in this case. I have to call a java application from j2ee and restart the tomcat server many times.
    Thanks in advance
    -Vikram

    Annoyingly crossposted.
    http://forum.java.sun.com/thread.jspa?threadID=730657

  • Java update 2012-006 did not remove Java plugin from any browser

    I successfully installed Java update 2012-006 via Software Update on my iMac running OS X Lion 10.7.5 (German) and it updated the Java runtime to version 1.6.0_37 and removed the Java Preferences application as expected, but it did not remove the Java plugin from any browser!
    Safari and Firefox can still use the Java plugin as before.
    I repaired permissions, rebooted, manually downloaded Java update 2012-006 and successfully installed it again without any change to the Java plugin: it is still present on my system and fully functional from any browser!
    The web is full with messages from users missing the Java plugin after installing this update - but I could not find anything about the plugin not being removed!
    Is anyone experiencing the same behaviour under Lion? I thought this would happen only under Snow Leopard...
    What should I do now? Can I really trust this "successfull installation" of Java update 2012-006 on my system?
    Thanks,
    Michael

    Thanks - I will keep the symlink in place and I won't touch the Deploy bundle, because I need the plugin in Safari and I don't need Oracle's Java 7 for now...
    If the plugin is supposed to stay in the Deploy bundle, this could help others who miss the plugin - they could just recreate the symlink, right?
    To summarize I think we can state, that the Java update 2012-006 for Lion and Mountain Lion sometimes leaves the symlink in /Library/Internet Plugins/ untouched.
    The circumstances that lead to this behaviour are still unknown.
    The install log in Console shows that the scripts to create links and to delete obsolete files ran okay, but there was an error with the "postinstall" script. In spite of this the installation succeeded:
    Oct 20 16:24:52 michaels-imac Installer[284]: Java für OS X 2012-006  Installation Log
    Oct 20 16:25:56 michaels-imac _securityagent[305]: Running Install Scripts . . .
    Oct 20 16:25:56 michaels-imac _securityagent[307]: Begin script: createlinks
    Oct 20 16:25:56 michaels-imac _securityagent[309]: End script: createlinks
    Oct 20 16:25:56 michaels-imac _securityagent[310]: Begin script: deleteObsoleteFiles
    Oct 20 16:25:56 michaels-imac _securityagent[314]: End script: deleteObsoleteFiles
    Oct 20 16:25:56 michaels-imac _securityagent[318]: Running Install Scripts . . .
    Oct 20 16:25:56 michaels-imac _securityagent[320]: Begin script: postinstall.sh
    Oct 20 16:25:56 michaels-imac installd[295]: postinstall: launchctl: Error unloading: com.apple.mrt.uiagent
    Oct 20 16:25:56 michaels-imac installd[295]: postinstall: com.apple.mrt.uiagent: Invalid argument
    Oct 20 16:25:56 michaels-imac installd[295]: postinstall: launchctl: Error unloading: com.apple.mrt.uiagent
    Oct 20 16:25:56 michaels-imac installd[295]: postinstall: launchctl: Error unloading: com.apple.mrt
    Oct 20 16:25:56 michaels-imac _securityagent[334]: End script: postinstall.sh
    Oct 20 16:25:56 michaels-imac installd[295]: Installed "Java für OS X 2012-006" ()
    Oct 20 16:25:56 michaels-imac Installer[284]: Displaying 'Install Succeeded' UI.
    Does anybody know what "com.apple.mrt.uiagent" and "com.apple.mrt" stands for?
    Obviously the "postinstall" script provides an invalid argument (at least on my system).
    I have no idea if this is related to the Java Plugin symlink not being removed...

  • Closing an application and web browser at same time at runtime

    Does anyone have any ideas of code that addresses that problem of closes the web browser at runtime when the application closes?
    I've been converted about 140+ forms and 300+ reports to 10g from 6i client/server and I've got all the forms converted but now that I've got it up on a website at runtime, I'm documenting all these application issues that I just haven't had time to research.
    It sounded like I do write some Java Beans, based on some threads I've read. But I didn't fully understand.
    Any help is appreciated.
    Regards,
    Chris

    Ok, I was able to do it when I hard-coded to the http://servername:port in the web.show_document. My question is: I have a windows and Linux (Development and Test server). All 3 are different servers. How can I make it to where I don't have to hard-code the server name. I've put the html page in the ORACLE_HOME/forms/java folder. The application and web browser closes just fine when I hard-code the server name in the web.show_document command. Is there a way I can get around this where I don't have to hard-code the name, but still access it from the same path on all 3 servers?
    web.show_document(http://servername:port/forms/java/closewebbrowser.htm, -self)

  • Un-embed applet on oracle 10g forms from web browser

    Hi all,
    I want to ask how can i seperately open my applet from web browser in oracle 10g forms. To be more precise to my question, i dont want to use my applet in web browser. It should be opened in new window i.e. applet window.
    Regards,
    Qasim Javaid Malik

    If you want to run forms without the IE browser (hidden)
    Try this
    To open web forms just like client server with a hidden IE window, I have invented two methods.
    ****** make seperateFrame = True on formsweb.cfg ******
    Method 1
    <job id="SYMA">
    <script language="VBScript">
    Const SW_HIDE = 0
    Const High = 128
    strComputer = "."
    strCommand = "C:\Program Files\Internet Explorer\IEXPLORE.EXE http://symphony-devl.atradiusnet.com/forms/frmservlet?config=syma"
    Set objWMIService = GetObject("winmgmts:" _
    & "{impersonationLevel=impersonate}!\\" _
    & strComputer & "\root\cimv2")
    ' Configure the Notepad process to show a window
    Set objStartup = objWMIService.Get("Win32_ProcessStartup")
    Set objConfig = objStartup.SpawnInstance_
    ' Create Notepad process
    Set objProcess = objWMIService.Get("Win32_Process")
    intReturn = objProcess.Create _
    (strCommand,Symphony, objConfig, intProcessID)
    If intReturn <> 0 Then
    Wscript.Echo "Process could not be created." & _
    vbNewLine & "Command line: " & strCommand & _
    vbNewLine & "Return value: " & intReturn
    Else
    Wscript.Echo "Process created." & _
    vbNewLine & "Command line: " & strCommand & _
    vbNewLine & "Process ID: " & intProcessID
    End If
    </script>
    </job>
    Method 2
    <job id="SYMA">
    <script language="VBScript">
    dim objShell
    set objShell = CreateObject("InternetExplorer.Application")
    objShell.ShellExecute "C:\Program Files\Internet Explorer\IEXPLORE.EXE", "http://ws-79767.atradiusnet.com:8890/forms/frmservlet?config=localJpi", "", "open",0
    </script>
    </job>
    Change the URL as appropriate, it's fantasitic .... !!!!!!
    Any questions let me know ...... !

  • Help required - running a Java program from the command line

    Hi,
    I have a small non-graphical Java application, packaged into a Jar file. My program relies on classes in another (external) Jar file.
    When I run the application from the IDE, everything works fine. However, when I try to run the application from the command line, I keep getting a NoClassDefFoundError for classes in the external jar.
    Both the application jar file and the external jar file are in my root directory (C:\).
    My command line call is as follows:
    java -cp c:MyExternalLib.jar -jar MyApp.jar
    Any help greatly appreciated.
    Thanks,
    Walter

    hi,
    set classpath=%classpath%;c:\myjar.jar;
    here i have specified myjar.jar file as an example u give ur location.after setting the classpath run ur java application.
    java mypgm
    this will solve ur problem
    regards,
    Ganesh

Maybe you are looking for