java - Trying to open notepad with an applet -


i'm trying open notepad browser using applet. yes know awful security, it's proof of concept. trying use javascript in apex it, no avail. anyway, here 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 html is

<html> <title>this applet opens notepad</title> <hr> <applet code=opennote.class width="320" height="120"> if browser java-enabled, open notepad. </applet> <hr> <html> 

it worked when made applet application, isn't saying much. when open html, displays "if browser..." message before allow security run java applet. javascript loads, message disappears , gives me application error. error "noclassdeffounderror", information being "opennote (wrong name: opennote/opennote) class file saved in same directory html.

can see i'm doing wrong? except security risk bit of course.

edit: have given on notepad proof of concept. seems hang up. here new problem. have app. writes output. gets 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 monsters"); } } 

and html is

<html> <title>this applet writes stuff</title> <hr> <applet code="ex.class" width="320" height="120"> if browser java-enabled, write stuff </applet> <hr> <html> 

when put in error

noclassdeffounderror

ex(wrong name:ex/ex)

when change 'code' attribute in javascript "ex.ex.class" receive following code:

classnotfoundexception

ex.ex.class

what's that?

you need specify class correctly in html. like

<applet code="opennote.opennote.class" width="320" height="120"> 

or

<applet code="opennote\opennote.class" width="320" height="120"> 

this because code in package opennote.


Comments

Popular posts from this blog

javascript - RequestAnimationFrame not working when exiting fullscreen switching space on Safari -

Python ctypes access violation with const pointer arguments -