Simple steps to Self Sign the JAR through command prompt
Friday, June 4, 2010
Step 1: Generating Keystore, In the command prompt, cd to the path where we have placed the Jars and type:
keytool -genkey -keystore myKeystore -alias myself
(Note that if you run keytool it would prompt you for information like your First Name and Last Name, Organization, Business Unit, etc - I usually provide everything as blank (by pressing the return key at the prompt. At the end please provide "yes" reply for confirmation question)
Step 2: Self-Signing the key & cert in the keystore:
keytool -selfcert -alias myself -keystore myKeystore
Step 3: (Optional)
Confirming by listing all the values in the keystores which we have created.
keytool -list -keystore myKeystore
Step4: Signing the Jar. Below command will finally sign the UIManager.jar present in the current directory with the keystore which we have created in above steps.
jarsigner -keystore myKeystore UIManager.jar myself
Self-Signed Jar is ready!!!
Labels: command prompt, JAR, jars, Netscape JAR, self signed jar, signing jar
posted by MIGHTYMAK @ 9:06 PM,
,
Calling javascript code from applet
Tuesday, November 27, 2007
Sometimes you may want your applet to interact with javascript.
Apply this code to your applet class.
private void alert(){
try{
getAppletContext().showDocument(
new URL("javascript:doAlert()"));
}catch (MalformedURLException ex) { }
}When running this code you'll execute the javascript doAlert() placed in the htm file where the <applet> tag is located.
<script language="javascript" type="text/javascript">
function doAlert() {
//some code to be executed...
alert('doAlert() exevcuted!');
}
</script>
-OR-
Using the netscape.javascript package in your java code and the mayscript option in your applet tag. For this you need a Netscape JAR file name java40.jar to compile the javascript code.
import java.applet.*;
import java.awt.*;
import java.awt.event.*;
import netscape.javascript.*;
public class jsobject extends Applet implements ActionListener
{
Button button;
public void init()
{
button = new Button("hello");
button.addActionListener(this);
add(button);
}
public void actionPerformed(ActionEvent event)
{
JSObject obj = JSObject.getWindow(this);
obj.call("hello", null);
}
}
Regards,
Manesh Koovappillil
Labels: applet, code, java, javascript, Netscape JAR
posted by MIGHTYMAK @ 2:05 AM,
,
