Results 1 to 11 of 11
  1. #1
    veggieCoder is offline Member
    Join Date
    Jan 2012
    Posts
    6
    Rep Power
    0

    Default Interaction with embedded java applet

    Hi Everyone,

    This is my first post here. I am relatively new to Java (taken classes, but little practical experience). My boss just asked me to find out if a standalone desktop application could send data to one of our java applets in a browser, and then have the applet make a request to a server using that data. I am thinking this is not possible, since the standalone app would not have a way to push data to the browser, and the browser wouldn't have the ability to poll the standalone app. However, that's just me thinking. Does anyone know of a way this could be done, or am I correct that it's not possible?

    Thanks!

  2. #2
    Norm's Avatar
    Norm is offline Moderator
    Join Date
    Jun 2008
    Location
    Eastern Florida
    Posts
    17,616
    Rep Power
    25

    Default Re: Interaction with embedded java applet

    Where are each of these programs (app, applet and server) to execute? Are they all on separate PCs?
    An unsigned applet can only communicate with the server it was loaded from.

  3. #3
    veggieCoder is offline Member
    Join Date
    Jan 2012
    Posts
    6
    Rep Power
    0

    Default Re: Interaction with embedded java applet

    Hi Norm. Thanks for the reply. They would be on the same PC. For example, in a standalone trading application, the user right-clicks on a symbol and chooses an option to send that symbol to a charting applet running in a browser. The charting applet would then update with a chart for that symbol.

  4. #4
    Norm's Avatar
    Norm is offline Moderator
    Join Date
    Jun 2008
    Location
    Eastern Florida
    Posts
    17,616
    Rep Power
    25

    Default Re: Interaction with embedded java applet

    If all the parts are on the same computer, the first question is what are you trying to do and why?
    When you say on the same PC I understand that to mean that there is NO internet connection. ALL of the programs being used are on the same PC.

    Can you explain what you want to do?
    You could have the app be a mini server that the browser would load the HTML page and applet from. The applet and the app could communicate with no problems.

  5. #5
    veggieCoder is offline Member
    Join Date
    Jan 2012
    Posts
    6
    Rep Power
    0

    Default Re: Interaction with embedded java applet

    There is an internet connection. After the standalone app sends the symbol to the browser-based applet, the applet would take that symbol and request data for it from a remote server in the form of an HTTP request that returns XML. So the standalone app would not act as a server. We just want to pass a small amount of text data to the applet. My thinking is that the standalone app would have no distinct process to interact with, since the applet would be running in a browser. But, as I said, I haven't worked much with applets.

  6. #6
    Norm's Avatar
    Norm is offline Moderator
    Join Date
    Jun 2008
    Location
    Eastern Florida
    Posts
    17,616
    Rep Power
    25

    Default Re: Interaction with embedded java applet

    Where is the applet loaded from? A third computer/server?
    An applet with permission could communicate with a local program by using sockets. The applet could open a ServerSocket and the app could connect to the ServerSocket and send data.
    It could be possible to give the applet permission on the PC with the app by changes to the .java.policy file on that PC.

  7. #7
    veggieCoder is offline Member
    Join Date
    Jan 2012
    Posts
    6
    Rep Power
    0

    Default Re: Interaction with embedded java applet

    Ah...that's interesting. I didn't think of a local socket connection. I now have some googling to do ;-) Thanks for the lead.

  8. #8
    veggieCoder is offline Member
    Join Date
    Jan 2012
    Posts
    6
    Rep Power
    0

    Default Re: Interaction with embedded java applet

    I've received some requirements refinements. Turns out it's not necessarily required tht the standalone app interact with a browser-based applet. Just that the standalone app can consume our applet. Many hours of googling indicates I can add a JApplet to a JFrame within the standalone app. But I can't figure out how to have the JApplet reference our remote applet. Is this possible? Is there another/better way to do it? Thanks!

  9. #9
    Norm's Avatar
    Norm is offline Moderator
    Join Date
    Jun 2008
    Location
    Eastern Florida
    Posts
    17,616
    Rep Power
    25

    Default Re: Interaction with embedded java applet

    it's not necessarily required that the standalone app interact with a browser-based applet
    What is the configuration going to be now? Which part are you removing: the app or the applet?


    Putting an applet in a main application does NOT give you any benefits. In fact it requires extra coding on your part to provide the support that the applet normally gets from a browser.

  10. #10
    veggieCoder is offline Member
    Join Date
    Jan 2012
    Posts
    6
    Rep Power
    0

    Default Re: Interaction with embedded java applet

    The configuration is an existing third-party java application into which a client wants to integrate our applet, which is served from a remote server.

  11. #11
    Norm's Avatar
    Norm is offline Moderator
    Join Date
    Jun 2008
    Location
    Eastern Florida
    Posts
    17,616
    Rep Power
    25

    Default Re: Interaction with embedded java applet

    I think sockets may be a good way for the desktop app to communicate with the applet. The applet will require permission to do that.

    It may be possible for the application to load the applet and provide the support that a browser normally does. I have some applets that I run both as applications and as applets.
    Last edited by Norm; 01-12-2012 at 08:23 PM.

Similar Threads

  1. Replies: 12
    Last Post: 07-25-2011, 04:25 PM
  2. Embedded applet in jsp its not working.
    By charmi in forum JavaServer Pages (JSP) and JSTL
    Replies: 0
    Last Post: 06-17-2011, 12:22 PM
  3. GUI problem, interaction in Java!!!
    By lulzim in forum New To Java
    Replies: 1
    Last Post: 05-20-2011, 11:34 PM
  4. Java interaction
    By satimis in forum New To Java
    Replies: 4
    Last Post: 06-30-2010, 06:14 PM
  5. i need a IDE for embedded java
    By santhosh_el in forum AWT / Swing
    Replies: 2
    Last Post: 04-29-2009, 09:23 AM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •