Page 1 of 1

Debugging Applet

Posted: Wed May 13, 2015 1:41 am
by sderrick
I can debug the applet running it stand alone, but debugging it in the browser is giving me fits!

I have setup my JVM to run with the parameters:
-agentlib:jdwp=transport=dt_socket,address=localhost:8000

I've set up Netbeans to listen on socket 8000

I launch Firefox, the java console opens and Netbeans stops in the function

public AWTEvent getNextEvent() throws InterruptedException

I hit run, a bunch of libraries load, then the java console closes, and the debugger is disconnected.

Than another java console opens. and the oxygen applet loads up without being connected to the debugger?

Re: Debugging Applet

Posted: Wed May 13, 2015 11:20 am
by Radu
Hi Scott,

My guess would be to check that the architecture of the Java VM used to start the applet in the browser (32 or 64 bit) is the same with the architecture of the Java VM used from Netbeans to connect to the applet.
I'm not sure this is the problem though. At some point I profiled a started applet using the JProfiler application and I kind of had the same crashes because of this mismatch in JVM architecture between the JVM which was started and the JVM which tries to connect to it.

Regards,
Radu

Re: Debugging Applet

Posted: Wed May 13, 2015 4:13 pm
by sderrick
Why does the java console start up show a slew of jars loading, then shut down, then another console start up? It does this whether netbeans is running or not.

Why are there two instances of the java console? I think that is the clue.

both consoles show at the top
Java Plug-in 11.45.2.14
Using JRE version 1.8.0_45-b14 Java HotSpot(TM) 64-Bit Server VM
User home directory = /home/scott
Also if I have just built the applet, I get the security dialog right after the first console shuts down and the second console appears. I still get two consoles on the subsequent starts ups when I don't get the security dialog.

I put a system.out message in the applet init function and it displays in the second java console not the first?

Oh, Also I get two java loading splash's, first one with the first console, then it goes away when the first console goes away. Then new console and now splash, then that changes to the progress loader in the applet.

My java version
java -version
java version "1.8.0_45"
Java(TM) SE Runtime Environment (build 1.8.0_45-b14)
Java HotSpot(TM) 64-Bit Server VM (build 25.45-b02, mixed mode)
Neatbeans shows its using the same, but I don't think this has anything to do with Netbeans.
Java: 1.8.0_45; Java HotSpot(TM) 64-Bit Server VM 25.45-b02
Runtime: Java(TM) SE Runtime Environment 1.8.0_45-b14
Scott

Re: Debugging Applet

Posted: Wed May 13, 2015 4:23 pm
by Radu
Hi Scott,

This has always been like this. My hunch for this is that the JNLP file has specific memory and other settings for the JVM like:

Code: Select all

<j2se java-vm-args="-Xmx256m -XX:MaxPermSize=80m" version="1.6+"
href="http://java.sun.com/products/autodl/j2se"/>
So first a JVM is started which starts downloading and reading the JNLP but because the JNLP has specific JVM settings, a new JVM is started with those specific settings and then this second JVM is actually used for the applet while the first one is killed.

A link to a similar discussion:

http://www.coderanch.com/t/516230/JNLP- ... e-launched

Regards,
Radu

Re: Debugging Applet

Posted: Fri May 15, 2015 2:26 am
by sderrick
As always Radu you are spot on....

I had changed the height and width in the applet tag, which was causing the jvm to launch another session....

Scott