• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

Debugging old Java Applet

 
Greenhorn
Posts: 3
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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.
 
Rancher
Posts: 43081
77
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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: 43081
77
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
    Number of slices to send:
    Optional 'thank-you' note:
  • 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.


 
Marshal
Posts: 79239
377
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
    Number of slices to send:
    Optional 'thank-you' note:
  • 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: 79239
377
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
So, does that line throw an IllegalArgumentException if you pass a null?
 
Don't get me started about those stupid light bulbs.
reply
    Bookmark Topic Watch Topic
  • New Topic