Welcome to the Java Programming Forums


The professional, friendly Java community. 21,500 members and growing!


The Java Programming Forums are a community of Java programmers from all around the World. Our members have a wide range of skills and they all have one thing in common: A passion to learn and code Java. We invite beginner Java programmers right through to Java professionals to post here and share your knowledge. Become a part of the community, help others, expand your knowledge of Java and enjoy talking with like minded people. Registration is quick and best of all free. We look forward to meeting you.


>> REGISTER NOW TO START POSTING


Members have full access to the forums. Advertisements are removed for registered users.

Results 1 to 8 of 8

Thread: Stop applet from running

  1. #1
    Junior Member
    Join Date
    Mar 2013
    Posts
    5
    Thanks
    1
    Thanked 0 Times in 0 Posts

    Default Stop applet from running

    Greetings

    I have created an web application (jsp-servlet) that trigers some .jar applets
    I print the jars with the HTML tags through a servlet in the jsp.

    Imagine two situations. A anb B.
    Starting with A the jar runs.
    I go to B, the 2nd jar replaces the first.
    When I return back to A, the 2nd jar is removed but the first jar fails to start with a Adding same VBO twice + null pointer exception.

    So I believe I have to stop it after leaving situation A.
    Is there a way to stop the .jar from running from inside the servlet?

    Added stacktrace:

    Adding same VBO twice. Exception in thread "Animation Thread" P3D: Already called beginDraw(). javax.media.opengl.GLException: java.lang.NullPointerException at jogamp.opengl.awt.AWTThreadingPlugin.invokeOnOpenG LThread(AWTThreadingPlugin.jav*​a:98) at jogamp.opengl.ThreadingImpl.invokeOnOpenGLThread(T hreadingImpl.java:196) at javax.media.opengl.Threading.invokeOnOpenGLThread( Threading.java:164) at javax.media.opengl.awt.GLCanvas.maybeDoSingleThrea dedWorkaround(GLCanvas.java:83*​1)


  2. #2
    Super Moderator Norm's Avatar
    Join Date
    May 2010
    Location
    Eastern Florida
    Posts
    25,140
    Thanks
    65
    Thanked 2,720 Times in 2,670 Posts

    Default Re: Stop applet from running

    Can you trace the sequence of events with a bit more detail?
    For example:
    The browser loads an HTML page from a server at a URL
    The user presses some button
    The browser sends a request to the server to execute a jsp page
    the jsp page returns an HTML page with an applet in A.jar to the browser
    ??? then what
    If you don't understand my answer, don't ignore it, ask a question.

  3. #3
    Junior Member
    Join Date
    Mar 2013
    Posts
    5
    Thanks
    1
    Thanked 0 Times in 0 Posts

    Default Re: Stop applet from running

    The browser loads the jsp page from apache server at a URL (localhost).
    The user presses a button.
    The browser sends a request to the server to execute a servlet.
    The servlet prints on the jsp the first applet (A.jar) in a div to the browser.
    The user presses a button (type + search - change values).
    The browser sends a request to the server to execute a servlet.
    The servlet prints on the jsp the second applet (B.jar) in the same div to the browser, replacing the first.

    I believe there is the problem. I have to stop the applet right after the next request is made.

  4. #4
    Super Moderator Norm's Avatar
    Join Date
    May 2010
    Location
    Eastern Florida
    Posts
    25,140
    Thanks
    65
    Thanked 2,720 Times in 2,670 Posts

    Default Re: Stop applet from running

    The servlet prints on the jsp the second applet (B.jar) in the same div to the browser, replacing the first.
    I don't understand what that means. What does "prints on the jsp" mean? Is that a way of saying that the servlet creates an HTML page to return using the jsp code?

    I thought every new HTML page the browser reads replaces the last HTML page the browser was reading. I'm not sure what "same div" means. Is that the html tag: <div?

    Is the stop() or destroy() method of the applet in A.jar called?
    If you don't understand my answer, don't ignore it, ask a question.

  5. #5
    Junior Member
    Join Date
    Mar 2013
    Posts
    5
    Thanks
    1
    Thanked 0 Times in 0 Posts

    Default Re: Stop applet from running

    I am using jQuery to handle the processRequest, so I do not replace the hole page, and I print the result of that (from the servlet) in a HTML <div> tag.

    The A.jar is called from a <script> tag as an <object> tag. Stored in a var called objectElement.

    How can I call the methods from an applet that is called like that?

  6. #6
    Super Moderator Norm's Avatar
    Join Date
    May 2010
    Location
    Eastern Florida
    Posts
    25,140
    Thanks
    65
    Thanked 2,720 Times in 2,670 Posts

    Default Re: Stop applet from running

    Sorry, I don't know anything about jQuery and very little about javascript.
    If you don't understand my answer, don't ignore it, ask a question.

  7. The Following User Says Thank You to Norm For This Useful Post:

    lemanou (March 3rd, 2013)

  8. #7
    Junior Member
    Join Date
    Mar 2013
    Posts
    5
    Thanks
    1
    Thanked 0 Times in 0 Posts

    Default Re: Stop applet from running

    Could you tell me for example, the methods from java would be called like this?

    A.stop(); and A.destroy();

    Thank you for your time.

  9. #8
    Super Moderator Norm's Avatar
    Join Date
    May 2010
    Location
    Eastern Florida
    Posts
    25,140
    Thanks
    65
    Thanked 2,720 Times in 2,670 Posts

    Default Re: Stop applet from running

    Add some println() statements to those methods and do some experiments to see when they are called.
    If you don't understand my answer, don't ignore it, ask a question.

Similar Threads

  1. [SOLVED] Java Applet not running
    By jdcb92 in forum Java Applets
    Replies: 9
    Last Post: May 16th, 2012, 07:48 PM
  2. Error while running Applet
    By rameshiit19 in forum What's Wrong With My Code?
    Replies: 8
    Last Post: August 1st, 2011, 04:02 AM
  3. Running an Applet With JAR file
    By rameshiit19 in forum What's Wrong With My Code?
    Replies: 4
    Last Post: July 20th, 2011, 07:10 AM
  4. I cannot get this loop to stop running. What am I doing wrong??
    By Nismoz3255 in forum Loops & Control Statements
    Replies: 2
    Last Post: May 1st, 2011, 10:28 PM
  5. Replies: 4
    Last Post: April 27th, 2010, 01:18 AM

Tags for this Thread