I created an applet that utilizes the UNIX df command. I have a Choice where each UNIX hostname is listed. I have a Button that when clicked goes out an retrieves the output of the df command and puts into a TextArea.
With appletviewer, the applet works fine after I put the ".java.policy" file with "java.security.AllPermission" in the home directory. On Windows XP with Netscape and Internet Explorer, the applet works fine when I load the applet HTML file into the browser. Also on my IBM AIX system with Mozilla, the applet works fine when I load the applet HTML file into the browser.
On my IBM AIX system, I am using IBM HTTP Server which is using an Apache web server. From the URL of the web server, the applet is loaded, but nothing appears in the TextArea after clicking the Button. I have tried on Windows XP, AIX, Netscape, Internet Explorer, and Mozilla. The browser just has the message at the bottom "Applet DF started".
Can anyone give any ideas why the applet puts the df command in the TextArea as a local file, but not through the web server?
This is what is the Exception in the Java Console.
Exception in thread "AWT-EventQueue-2" java.lang.NoClassDefFoundError: ch/ethz/ssh2/Connection at DF.actionPerformed(DF.java:115) at java.awt.Button.processActionEvent(Unknown Source) at java.awt.Button.processEvent(Unknown Source) at java.awt.Component.dispatchEventImpl(Unknown Source) at java.awt.Component.dispatchEvent(Unknown Source) at java.awt.EventQueue.dispatchEvent(Unknown Source) at java.awt.EventDispatchThread.pumpOneEventForHierarchy(Unknown Source) at java.awt.EventDispatchThread.pumpEventsForHierarchy(Unknown Source) at java.awt.EventDispatchThread.pumpEvents(Unknown Source) at java.awt.EventDispatchThread.pumpEvents(Unknown Source) at java.awt.EventDispatchThread.run(Unknown Source)
In order to connect to each UNIX client to run the "df" command, I use Secure Shell with the ganymed-ssh2-build208.jar which is where the Connection class is being referenced from.
I used this command and the applet worked: appletviewer -J-Djava.security.policy=java.policy DF.html
Is the jar file containing ch/ethz/ssh2/Connection where it is supposed to be? is it readable (meaning, can you download it manually)? Is it not corrupted?
Joined: Jun 09, 2002
I am using a 3rd party ganymed-ssh2-build208.jar Secure Shell library file to obtain the df output from UNIX systems.
I extracted all the classes from the ganymed-ssh-build208.jar file. I then created a new jar file which contains the class files from my source code and the Secure Shell class files. Now this is a huge jar file. This resolved the Secure Shell references not being found.
If I properly put the .java.policy file in the home directory of each user on each system accessing using a web browser, the applet loads just fine. If there is no .java.policy file, I get AccessControlException errors. This will become problem because there is no possible way I am going to be able to copy the .java.policy in each and every home directory.
Is there a way to package the .java.policy security file into the jar file, so anybody can access the applet? Is there an alternative method that can circumvent the security issues with an applet other than the .java.policy file?
Joined: Mar 22, 2005
Yes, there is another way: you can digitally sign the applet. There is more information linked in the Applet FAQ.
[ changed to include the link to the relevant FAQ page ] [ January 06, 2006: Message edited by: Ulf Dittmer ]