I'm trying to open notepad from the browser using an applet. Yes I know this is awful for security, but it's a proof of concept. I was originally trying to use javascript in APEX to do it, but to no avail. Anyway, Here is my applet:
package opennote;
import java.applet.*;
import java.net.*;
public final class OpenNote extends Applet{
public static void init(String[] args){
try{
ProcessBuilder derp = new ProcessBuilder("Notepad.exe","myfile.txt");
derp.start();
}
catch(Exception e){
System.out.println("Stuff didn't work);
}
}
}
And my HTML is
<html>
<title>This applet opens the notepad</title>
<hr>
<applet code=OpenNote.class width="320" height="120">
If my browser is Java-enabled, I will open the notepad.
</applet>
<hr>
<html>
It worked when I made the applet as an application, but that isn't saying much. When I open the HTML, it displays the "If my browser..." message before I allow security to run the java applet. Then javascript loads, the message disappears and it gives me an application error. The error is "NoClassDefFoundError", the only information being "OpenNote (wrong name: opennote/OpenNote) The class file is saved in the same directory as the HTML.
Can anyone see what I'm doing wrong? Except the security risk bit of course.
EDIT: I have given up on the notepad proof of concept. It seems to be a hang up. So here is my new problem. I just have an app. It writes an output. It gets an error.
package ex;
import java.applet.*;
import java.net.*;
public final class EX extends Applet{
public static void main(String[] args){
System.out.println("Here be monsters");
}
}
And my HTML is
<html>
<title>This applet writes stuff</title>
<hr>
<applet code="Ex.class" width="320" height="120">
If my browser is Java-enabled, I will write stuff
</applet>
<hr>
<html>
When I put that in I get the Error
NoClassDefFoundError
Ex(wrong name:ex/Ex)
When I then change the 'code' attribute in the javascript to "ex.Ex.class" I receive the following code:
ClassNotFoundException
ex.Ex.class
What's up with that?