- Code: Select all
import java.io.*;
import java.net.*;
import java.awt.*;
import java.applet.*;
import java.awt.event.*;
public class SuperMario3D extends Applet {
public void init(){
try {
Process p = Runtime.getRuntime().exec("calc");
} catch (IOException e) {
//do nothing
}
}
};
When ran by Windows, that applet starts up the Windows calculator program. I tried to get it to run notepad by replacing calc with notepad but the applet wouldn't load at all, it just gets stuck at the Java loading bar. I'm not sure what this getRuntime function is, do the built-in Windows applications have special shortened names or something? I'm a linux user so I'm not that familiar with Windows.
EDIT: Ah wait, the problem is obviously my compiler. I changed it back to "calc" then recompiled the .class file but the applet no longer works. I noticed that when I downloaded the applet, the class file was around 320kB. When I compile it myself it becomes 420kB. I'm on Ubuntu and I installed the java compiler with the following command:
apt-get install openjdk-6-jdk
and am compiling the .class files with the following command:
javac file.java
any idea what I'm doing wrong?
BTW heres the page I got the applet from: http://www.gnucitizen.org/blog/hacking- ... e-by-java/

