PDA

View Full Version : Downloading a java applet.



Jason2gs
05-05-2007, 11:11 PM
There's a nice little applet here that I'd like to try and get on my machine, if possible.

http://www.eigelb.at/HP/Links/SpecialEffects/Grappa/DelayedTrace/

I did take a look at the view source and got that the actual file for that is this:

http://www.eigelb.at/HP/Links/SpecialEffects/Grappa/DelayedTrace/GrappaDTO.jar

I went there, downloaded the file, and extracted it. Most, if not all, of the files it gave me were CLASS files. I Googled CLASS files, and sure enough, they're related to Java.

That wound me up there, asking:

What am I supposed to do to make sense out of these files? Is it possible to download a Java applet? I've gotten SWFs before, but not Java applets.

Please write back,

Mike.

regecks
05-05-2007, 11:43 PM
Java applets are class files stuck into a jar file.

You need to use a tool such as JAD (http://www.kpdus.com/jad.html) to get the source code of the applet:

// Decompiled by Jad v1.5.8g. Copyright 2001 Pavel Kouznetsov.
// Jad home page: http://www.kpdus.com/jad.html
// Decompiler options: packimports(3)

import java.applet.Applet;
import java.applet.AppletContext;
import java.awt.*;
import java.awt.event.*;
import java.net.MalformedURLException;
import java.net.URL;
import java.util.Random;

public class a extends Applet
implements Runnable
{
class b extends MouseMotionAdapter
{

public void mouseMoved(MouseEvent mouseevent)
{
_fldint = mouseevent.getX();
_fldfor = mouseevent.getY();
if(_fldfor > _flddo - 21 && _fldint > _fldbyte - 83)
{
if(!_fldcase)
{
setCursor(new Cursor(12));
_fldcase = true;
}
} else
if(_fldcase)
{
setCursor(new Cursor(0));
_fldcase = false;
}
}

public void mouseDragged(MouseEvent mouseevent)
{
_fldint = mouseevent.getX();
_fldfor = mouseevent.getY();
}

b()
{
}
}

class a extends MouseAdapter
{

public void mousePressed(MouseEvent mouseevent)
{
_fldint = mouseevent.getX();
_fldfor = mouseevent.getY();
a.this.a = true;
if(a.this.a && _fldfor > _flddo - 21 && _fldint > _fldbyte - 83)
try
{
URL url = new URL("http://www.eigelb.at");
AppletContext appletcontext = getAppletContext();
appletcontext.showDocument(url, "_blank");
}
catch(MalformedURLException malformedurlexception) { }
}

public void mouseReleased(MouseEvent mouseevent)
{
a.this.a = false;
}

a()
{
}
}

class c
{

public void a(int i, int j, int k)
{
a.this._fldelse.setColor(new Color(i, j, k));
a.this._fldelse.fillRect(0, 0, a.this._fldbyte, a.this._flddo);
for(_fldnew = 0; _fldnew < _fldfor; _fldnew++)
for(_fldtry = 0; _fldtry < _fldbyte; _fldtry++)
{
a[_fldtry][_fldnew] = i;
_fldint[_fldtry][_fldnew] = j;
_flddo[_fldtry][_fldnew] = k;
}


}

public void a()
{
for(_fldnew = 0; _fldnew < _fldfor; _fldnew++)
for(_fldtry = 0; _fldtry < _fldbyte; _fldtry++)
{
a.this._fldelse.setColor(new Color(a[_fldtry][_fldnew], _fldint[_fldtry][_fldnew], _flddo[_fldtry][_fldnew]));
a.this._fldelse.drawLine(_fldtry, _fldnew, _fldtry, _fldnew);
}


}

public void a(boolean flag)
{
_fldchar = flag;
}

public void a(double d)
{
_fldif = d;
}

public void a(double d, double d1, double d2, double d3, int i, int j, int k)
{
double d5 = d2 - d;
double d6 = d3 - d1;
double d4 = Math.sqrt(d5 * d5 + d6 * d6);
d5 /= d4;
d6 /= d4;
for(int l = 0; (double)l < d4; l++)
{
a(d, d1, i, j, k);
d += d5;
d1 += d6;
}

}

public void _mthif(double d, double d1, double d2, double d3, int i, int j, int k, double d4)
{
double d6 = d2 - d;
double d7 = d3 - d1;
double d5 = Math.sqrt(d6 * d6 + d7 * d7);
d6 /= d5;
d7 /= d5;
for(int l = 0; (double)l < d5; l++)
{
a(d, d1, i, j, k, d4);
d += d6;
d1 += d7;
}

}

public void a(double d, double d1, double d2, double d3, int i, int j, int k, double d4)
{
double d5 = d1 - d3;
double d6 = d2 - d;
double d7 = Math.sqrt(d5 * d5 + d6 * d6);
d5 /= d7;
d6 /= d7;
d4--;
double d9 = -d4 / 2D;
int l = (int)(d4 * _fldif);
if(l < 2)
l = 2;
double d10 = d4 / (double)l;
for(int i1 = 0; i1 <= l; i1++)
{
double d8 = d9 + d10 * (double)i1;
double d11 = Math.sqrt(d9 * d9 - d8 * d8);
a((d + d8 * d5) - d11 * d6, d1 + d8 * d6 + d11 * d5, d2 + d8 * d5 + d11 * d6, (d3 + d8 * d6) - d11 * d5, i, j, k);
}

}

public void a(double d, double d1, int i, int j, int k)
{
if(d > 0.0D && d < (double)(a.this._fldbyte - 1) && d1 > 0.0D && d1 < (double)(a.this._flddo - 1))
{
int l = (int)d;
int i1 = l + 1;
int j1 = (int)d1;
int k1 = j1 + 1;
double d2 = (double)i1 - d;
double d4 = 1.0D - d2;
double d3 = (double)k1 - d1;
double d5 = 1.0D - d3;
double d6 = d2 * d3;
double d7 = 1.0D - d2 * d3;
a[l][j1] = (short)(int)(d6 * (double)i + d7 * (double)a[l][j1]);
_fldint[l][j1] = (short)(int)(d6 * (double)j + d7 * (double)_fldint[l][j1]);
_flddo[l][j1] = (short)(int)(d6 * (double)k + d7 * (double)_flddo[l][j1]);
d6 = d4 * d3;
d7 = 1.0D - d4 * d3;
a[i1][j1] = (short)(int)(d6 * (double)i + d7 * (double)a[i1][j1]);
_fldint[i1][j1] = (short)(int)(d6 * (double)j + d7 * (double)_fldint[i1][j1]);
_flddo[i1][j1] = (short)(int)(d6 * (double)k + d7 * (double)_flddo[i1][j1]);
d6 = d2 * d5;
d7 = 1.0D - d2 * d5;
a[l][k1] = (short)(int)(d6 * (double)i + d7 * (double)a[l][k1]);
_fldint[l][k1] = (short)(int)(d6 * (double)j + d7 * (double)_fldint[l][k1]);
_flddo[l][k1] = (short)(int)(d6 * (double)k + d7 * (double)_flddo[l][k1]);
d6 = d4 * d5;
d7 = 1.0D - d4 * d5;
a[i1][k1] = (short)(int)(d6 * (double)i + d7 * (double)a[i1][k1]);
_fldint[i1][k1] = (short)(int)(d6 * (double)j + d7 * (double)_fldint[i1][k1]);
_flddo[i1][k1] = (short)(int)(d6 * (double)k + d7 * (double)_flddo[i1][k1]);
if(_fldchar)
{
a.this._fldelse.setColor(new Color((short)(int)(_fldcase * (double)a[l][j1]), (short)(int)(_fldcase * (double)_fldint[l][j1]), (short)(int)(_fldcase * (double)_flddo[l][j1])));
a.this._fldelse.drawLine(l, j1, l, j1);
a.this._fldelse.setColor(new Color((short)(int)(_fldcase * (double)a[i1][j1]), (short)(int)(_fldcase * (double)_fldint[i1][j1]), (short)(int)(_fldcase * (double)_flddo[i1][j1])));
a.this._fldelse.drawLine(i1, j1, i1, j1);
a.this._fldelse.setColor(new Color((short)(int)(_fldcase * (double)a[l][k1]), (short)(int)(_fldcase * (double)_fldint[l][k1]), (short)(int)(_fldcase * (double)_flddo[l][k1])));
a.this._fldelse.drawLine(l, k1, l, k1);
a.this._fldelse.setColor(new Color((short)(int)(_fldcase * (double)a[i1][k1]), (short)(int)(_fldcase * (double)_fldint[i1][k1]), (short)(int)(_fldcase * (double)_flddo[i1][k1])));
a.this._fldelse.drawLine(i1, k1, i1, k1);
}
}
}

public void a(double d, double d1, int i, int j, int k,
double d2)
{
if(d > 0.0D && d < (double)(a.this._fldbyte - 1) && d1 > 0.0D && d1 < (double)(a.this._flddo - 1))
{
int l = (int)d;
int i1 = l + 1;
int j1 = (int)d1;
int k1 = j1 + 1;
double d3 = (double)i1 - d;
double d5 = 1.0D - d3;
double d4 = (double)k1 - d1;
double d6 = 1.0D - d4;
double d7 = d3 * d4 * d2;
double d8 = 1.0D;
a[l][j1] = (int)(d7 * (double)i + (double)a[l][j1]);
if(a[l][j1] > 255)
a[l][j1] = 255;
_fldint[l][j1] = (int)(d7 * (double)j + (double)_fldint[l][j1]);
if(_fldint[l][j1] > 255)
_fldint[l][j1] = 255;
d7 = d5 * d4 * d2;
d8 = 1.0D;
a[i1][j1] = (int)(d7 * (double)i + (double)a[i1][j1]);
if(a[i1][j1] > 255)
a[i1][j1] = 255;
_fldint[i1][j1] = (int)(d7 * (double)j + (double)_fldint[i1][j1]);
if(_fldint[i1][j1] > 255)
_fldint[i1][j1] = 255;
d7 = d3 * d6 * d2;
d8 = 1.0D;
a[l][k1] = (int)(d7 * (double)i + (double)a[l][k1]);
if(a[l][k1] > 255)
a[l][k1] = 255;
_fldint[l][k1] = (int)(d7 * (double)j + (double)_fldint[l][k1]);
if(_fldint[l][k1] > 255)
_fldint[l][k1] = 255;
d7 = d5 * d6 * d2;
d8 = 1.0D;
a[i1][k1] = (int)(d7 * (double)i + (double)a[i1][k1]);
if(a[i1][k1] > 255)
a[i1][k1] = 255;
_fldint[i1][k1] = (int)(d7 * (double)j + (double)_fldint[i1][k1]);
if(_fldint[i1][k1] > 255)
_fldint[i1][k1] = 255;
if(_fldchar)
{
a.this._fldelse.setColor(new Color(a[l][j1], _fldint[l][j1], 0));
a.this._fldelse.drawLine(l, j1, l, j1);
a.this._fldelse.setColor(new Color(a[i1][j1], _fldint[i1][j1], 0));
a.this._fldelse.drawLine(i1, j1, i1, j1);
a.this._fldelse.setColor(new Color(a[l][k1], _fldint[l][k1], 0));
a.this._fldelse.drawLine(l, k1, l, k1);
a.this._fldelse.setColor(new Color(a[i1][k1], _fldint[i1][k1], 0));
a.this._fldelse.drawLine(i1, k1, i1, k1);
}
}
}

protected int a[][];
protected int _fldint[][];
protected int _flddo[][];
protected int _fldbyte;
protected int _fldfor;
protected int _fldtry;
protected int _fldnew;
boolean _fldchar;
double _fldif;
double _fldcase;
double _fldelse;

public c(int i, int j)
{
_fldchar = false;
_fldif = 1.0D;
_fldcase = 0.007782219916379284D;
_fldelse = 128.49803921568628D;
_fldbyte = i;
_fldfor = j;
a = new int[_fldbyte][_fldfor];
_fldint = new int[_fldbyte][_fldfor];
_flddo = new int[_fldbyte][_fldfor];
}
}


public a()
{
_fldchar = true;
_fldcase = false;
_fldgoto = 0;
a = false;
_fldint = 0;
_fldfor = 0;
}

public void init()
{
_fldbyte = size().width;
_flddo = size().height;
_fldlong = createImage(_fldbyte, _flddo);
_fldelse = _fldlong.getGraphics();
_fldgoto = 1;
_fldtry = new c(_fldbyte, _flddo);
_fldtry.a(true);
addMouseListener(new a());
addMouseMotionListener(new b());
}

public void start()
{
if(_fldnew == null)
{
_fldnew = new Thread(this);
_fldnew.start();
}
}

public void stop()
{
if(_fldnew != null)
{
_fldnew.stop();
_fldnew = null;
_fldchar = false;
}
}

public void update(Graphics g)
{
paint(g);
}

public void paint(Graphics g)
{
if(_fldgoto >= 1)
g.drawImage(_fldlong, 0, 0, this);
}

public void run()
{
int l = 30;
double ad[] = new double[l];
double ad1[] = new double[l];
double ad2[] = new double[l];
double ad3[] = new double[l];
for(int j = 0; j < l; j++)
{
ad[j] = 0.0D;
ad1[j] = 0.0D;
ad2[j] = 0.0D;
ad3[j] = 0.0D;
}

_fldtry.a(0, 0, 0);
if(!_fldtry._fldchar)
_fldtry.a();
double d = 0.0D;
double d1 = 0.01D;
while(_fldchar)
{
for(int i = 0; i < 10; i++)
{
for(int k = 0; k < l; k++)
{
double d2 = (double)_fldint - ad[k];
double d3 = (double)_fldfor - ad1[k];
ad2[k] += d1 * d2 * (1.0D - (0.75D * (double)k) / (double)l);
ad3[k] += d1 * d3 * (1.0D - (0.75D * (double)k) / (double)l);
ad2[k] *= 0.995D;
ad3[k] *= 0.995D;
ad[k] += d1 * ad2[k];
ad1[k] += d1 * ad3[k];
_fldtry.a(ad[k], ad1[k], 255, 80, 0, 0.5D);
}

}

if(a)
{
a = false;
_fldtry.a(0, 0, 0);
_fldtry.a();
repaint();
}
_fldelse.setColor(Color.black);
_fldelse.drawString("www.eigelb.at", _fldbyte - 77, _flddo - 6);
_fldelse.drawString("www.eigelb.at", _fldbyte - 77, _flddo - 8);
_fldelse.drawString("www.eigelb.at", _fldbyte - 79, _flddo - 6);
_fldelse.drawString("www.eigelb.at", _fldbyte - 79, _flddo - 8);
_fldelse.setColor(new Color(140, 140, 140));
_fldelse.drawString("www.eigelb.at", _fldbyte - 78, _flddo - 7);
repaint();
try
{
a _tmp = this;
Thread.sleep(20L);
}
catch(InterruptedException interruptedexception) { }
}
}

Thread _fldnew;
Image _fldlong;
Graphics _fldelse;
Random _fldif;
int _fldbyte;
int _flddo;
boolean _fldchar;
boolean _fldcase;
int _fldgoto;
boolean a;
int _fldint;
int _fldfor;
c _fldtry;
}
Lots of maths :).

Jason2gs
05-06-2007, 12:05 AM
Java applet = Jar{CLASS files}file

Got it ;)

Thanks, I'll have to DL JAD then :)

Edit: Wait. Once I have the source code to the applet, how do I use it? My goal is to get that on my computer. So I can play with it whenever I want.

ShawnjohnSJ
05-07-2007, 12:09 AM
I don't believe you can open a Applet on your computer but if you put the code in a HTML file you can. :]

Jason2gs
05-07-2007, 12:25 AM
It seems like that's what I'll have to do :(

Yakman
05-07-2007, 02:59 PM
thats very nice applet,
if you want to run it one your computer, you could make a main() method and place it in a frame and stuff

a jar file is just loads of class files that have been compressed, it uses the same compression as .zip so you can rename it to .zip and you can extract it

also, another good decompiler is Jode (http://sourceforge.net/projects/jode)
sometimes when jad cant work, jode can work, and vis versa, i dont think anyone is better than the other, but its good to have both

Jason2gs
05-07-2007, 04:04 PM
Main()?

And about CLASS files.

Are class files the only type of files that can be loaded into a Java applet? I tried loading a Java file, but it didn't work for me.

How do I convert a Java file to a CLASS file? Or do I even need to do so?

duther
05-07-2007, 04:28 PM
Main()?

And about CLASS files.

Are class files the only type of files that can be loaded into a Java applet? I tried loading a Java file, but it didn't work for me.

How do I convert a Java file to a CLASS file? Or do I even need to do so?

".java" are source files, and ".class" are bytecode (compiled) files. Assuming you have the right Java JDK installed, to compile a .java file, open the cmd (Start->Run->"cmd"), go to the .java's folder, and type "javac filename.java".

If you want to make it simple, make a bat file into the directory of your .java files:



javac *.java
pause


It should compile it all.

Jason2gs
05-07-2007, 04:50 PM
I'm installing the Java SE Development Kit 6 right now. Is that what I need?

Got it from this site:

http://java.sun.com/javase/downloads/index.jsp

First download down. The "JDK 6u1" one.

Edit:

javac idiot.java
pause

Is that right? It's saying "javac" isn't a recognized command.

Yakman
05-07-2007, 07:35 PM
the 'javac is not requognised' is a classic problem which almost everyone gets, look on google, you'll solve it easily from there

also, heres a small html file which loads the applet from its normal location, just open it
change the extention to .html and open it

Jason2gs
05-07-2007, 11:46 PM
Thanks for that, Yak ;)

I'll look there.

Seaninio
05-13-2007, 09:22 AM
The basic way to open a jar file into a webpage is to make a html file with this line:

<Applet code="appletname"></APPLET>

OR if that doesn't look right:

<Applet code="appletname" width="number" height="number"></APPLET>

(You have to change the appletname and numbers to what you want btw)

It can also be done by using the applet viewer command but this way is easier.

You don't have to decompile it to .java files just to run it from your computer.

And heres a little tutorial on setting up the path and classpath (which will get javac to work) http://www.jibble.org/settingupjava.php

BeaconofBacon
09-25-2007, 04:15 PM
Textpad is a good way for testing it with the applet viewer, where you don't need the HTML...but if you wanted the HTML, then you could easily write it as Sean said, in Textpad. :D All around pwn tool.

owned1112
09-28-2007, 03:59 PM
JAR isn't java applet, it's java archive.