• Post Reply Bookmark Topic Watch Topic
  • New Topic

Debugging old Java Applet  RSS feed

 
jay james
Greenhorn
Posts: 3
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I'm tasked with re-creating a tutorial:
http://www.olympusmicro.com/primer/java/lasers/electroncycle/index.html

I must create a javascript version that runs with the aid of HTML and CSS.

I need to debug some old Java files and understand how variables are manipulated.

The main file I'm converting to javascript is electrons.java, and it uses the content of Electron.java, Wave.java, and others.

I'd like to debug this applet in the appletviewer, possibly using Jswat if it's useful: https://code.google.com/p/jswat/

I am nearly finished with the conversion, but they're slight differences in my version that I can't understand without debugging the original java src files.

I know my first step is to download what I need:

I'm running Windows 7 Enterprise 64-bit

I have Java Version 7:



All the java files to run the applet are here: https://dl.dropboxusercontent.com/u/24488452/electroncycleSRC.zip
The file "index.html" is what will open the applet

My First Question: How do I open my applet in the appletviewer?

Thanks for any direction you're able to give. I work at the biggest Magnet lab in the world located in Tallahassee,FL and we have over 300 of these tutorials to convert from java to javascript, so your guidance is greatly appreciated.
 
Ulf Dittmer
Rancher
Posts: 42972
73
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Welcome to JavaRanch.

How do I open my applet in the appletviewer?

Open a a command line window in the directory where index.html is, and type "appletviewer index.html". This assumes that appletviewer is in your PATH, but it generally is after you've installed the JDK. After that, you can add System.out.println statements throughout the code, and their outout will appear in the command line window.
 
Ulf Dittmer
Rancher
Posts: 42972
73
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I'm not sure if it's possible to debug applets running in appletviewer using JSwat (an excellent debugger, by the way, which I love), because additional runtime parameters need to be passed in for that, and I'm not sure if the appletviewer executable can handle that. It can be used with the "jdb" debugger (suing "appletviewer -debug"), but command line debugging isn't much fun...
 
jay james
Greenhorn
Posts: 3
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Wow, thanks for such quick feedback!!

I have downloaded the JDK, I also copied a command prompt to my folder where the java applets files are located, I'm getting an error in the command prompt related to an image..

First here's how everything is setup:

JDK INSTALL


appletviewer location


Applet Location & Errors


I think I know what the issue may be:
This applet is currently running live at: http://www.olympusmicro.com/primer/java/lasers/electroncycle/index.html
Since i'm trying to debug it I will need to some how remove these connections that it's attempting to make and hopefully will be left with enough to study...

Here's the error from the command prompt:



Also, here is how this applet is currently being called online:



Hopefully someone has time to explain this error, thanks.


 
Campbell Ritchie
Marshal
Posts: 56530
172
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
We'd need to see the line where the exception occurs. Precede that by a line which prints the image, so as to confirm it isn't null.
 
jay james
Greenhorn
Posts: 3
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I found the first one: :
It's at: http://grepcode.com/file/repository.grepcode.com/java/root/jdk/openjdk/6-b14/sun/net/spi/DefaultProxySelector.java

My real concern here is how to cut off the connections to sun.net and sun.awt , it seems that in my index.html the electrons.class file must be attempting to use sun.net and sun.awt

Also can't find the DefaultProxySelector.java, HttpURLConnection.java, URLImageSource.java, InputStreamImageSource.java, or ImageFetcher.java all of which are listed in my errors.

Right now the applet is trying to communicate over the internet, but I don't need that functionality at all, I just need to test it on my system.
 
Campbell Ritchie
Marshal
Posts: 56530
172
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
So, does that line throw an IllegalArgumentException if you pass a null?
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!