Here's the JSP page applet tags:
<applet code="localfile" width=150 height=150>
<param name="archive" value="localfile.jar">
</applet>
Applet Code is:
package locf;
import java.applet.*;
import java.util.*;
import java.lang.*;
import java.io.*;
public class localfile extends Applet
{
@Override
public void init() {}
@Override
public void start(){
String s,uno,des = null;
try {
Process p = Runtime.getRuntime().exec("ipconfig/all");
BufferedReader stdInput = new BufferedReader(new InputStreamReader(p.getInputStream()));
File outputFile = new File("/home/elie-m/NetBeansProjects/CMMAC/web/output.txt");
FileWriter outt= new FileWriter(outputFile);
System.out.println("MAC ADDRESS:\n");
while ((s = stdInput.readLine()) != null) {
Scanner par = new Scanner(s).useDelimiter(" Link encap:Ethernet HWaddr ");
if(s.startsWith("eth0"))
{
while(par.hasNext()){
uno=par.next();
des=par.next();
outt.write(des);
}
par.close();
}
}
System.exit(0);
}
catch (IOException e) {
System.out.println("exception happened - here's what I know: ");
e.printStackTrace();
System.exit(-1);
}
}
@Override
public void stop() {}
}
when I launch the jsp page I get this error:
Reading certificates from 1580 http://localhost:8080/CMMAC/localfile.jar | /home/elie-m/.java/deployment/cache/6.0/18/57db752-3f3326e8.idx java.lang.NoClassDefFoundError: localfile (wrong name: locf/localfile) at java.lang.ClassLoader.defineClass1(Native Method) at java.lang.ClassLoader.defineClass(ClassLoader.java:621) at java.security.SecureClassLoader.defineClass(SecureClassLoader.java:124) at java.net.URLClassLoader.defineClass(URLClassLoader.java:260) at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39) at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25) at java.lang.reflect.Method.invoke(Method.java:597) at sun.plugin2.applet.Plugin2ClassLoader.defineClassHelper(Plugin2ClassLoader.java:694) at sun.plugin2.applet.Plugin2ClassLoader.access$400(Plugin2ClassLoader.java:63) at sun.plugin2.applet.Plugin2ClassLoader$2.run(Plugin2ClassLoader.java:671) at java.security.AccessController.doPrivileged(Native Method) at sun.plugin2.applet.Plugin2ClassLoader.findClassHelper(Plugin2ClassLoader.java:633) at sun.plugin2.applet.Applet2ClassLoader.findClass(Applet2ClassLoader.java:100) at java.lang.ClassLoader.loadClass(ClassLoader.java:307) at java.lang.ClassLoader.loadClass(ClassLoader.java:252) at sun.plugin2.applet.Plugin2ClassLoader.loadCode(Plugin2ClassLoader.java:433) at sun.plugin2.applet.Plugin2Manager.createApplet(Plugin2Manager.java:2880) at sun.plugin2.applet.Plugin2Manager$AppletExecutionRunnable.run(Plugin2Manager.java:1397) at java.lang.Thread.run(Thread.java:619) Exception: java.lang.NoClassDefFoundError: localfile (wrong name: locf/localfile)
This error occurs after I accept the permission question to use the applet.
I dont know where to put the .jar and the .class files so the client can read use the applet, and I can't even get around the error for 2 weeks of searching now. I can give the whole directories folders/files structure in the project if needed. just ask what do u need and i'll paste it here just help me plz.
the jar is signed and the class is compiled, but it can't seem to find the applet's class that I need to run.. I have the jar and class files into both WEB-INF/classes/locf/ and the build/web/ folders. and I have em also in the other web folder, the one in the same directory as build.
operating system is linux ubuntu 9.10....