How to use the clipboard with JavaHASE applets
Object
When using JavaHase applets from the web, you may want to edit ARRAY content.
To accelerate the edit procedure, you may also want to cut some text from a
personnal editor or a Webpage and paste it into the ARRAY editing window.
To communicate data among applications with the copy&paste facility, the system
(Linux, Window, ...) uses the clipboard. Unfortunately, standard security
managers for applets do not allow such an access to the clipboard to prevent
malicious applets to spy information which goes to the clipboard.
Happily, the security manager can be configured manually, on the computer which
launchs the Java Virtual Machine(JVM) (appletviewer or Browser). This page explains
how to configure the security manager to be able to use the clipboard.
Principle
Basically, any java user can configure HIS OWN Security Manager with a security policy
file (See complete information from Sun).
On linux, each user who wants to configure the JVM he will launch from HIS account has to write or to modify
the file ~/.java.policy to modify security manager properties.
On Windows, the simplest way is to modify the
C:\Program files\JavaSoft\JRE\1.3.1\lib\security\java.policy file. The information
in red may depends on the JVM release you are using (1.3.1 or other) and on the path to which the JVM has been
installed. To check the JVM installation path, you can go the windows 'Control Panel'(start menu/Settings),
click on the icon related to the JVM you are using (Java plug-in 1.3.1), go to the 'Advanced' bookmark,
click on the 'Use Java plug-in Default' list box and read the path into which your plug-in is installed.
How to modify the java policy file.
If the file already exists, add the following lines at the end of the file. Otherwise, just create a file
which contains these lines :
grant codeBase "http://www.dcs.ed.ac.uk/home/hase/webhase/javahase/*" {
permission java.awt.AWTPermission "accessClipboard";
};
This means, to give a permission to access the Clipboard to any applets the url of which
starts with http://www.dcs.ed.ac.uk/home/hase/webhase/javahase/
How to copy&paste.
Copy any text from standard applications (Netscape, emacs, ...) using the copy menu item from the edit menu.
Then paste it into the edit window with either CTRL+V or mouse middle button.
Frederic Mallet
Last modified: Tue Feb 12 13:51:18 GMT 2002