-
Notifications
You must be signed in to change notification settings - Fork 0
JRubyOnWebStart
» JRuby Project Wiki Home Page
Deploying JRuby applications with Java Web Start
Open JIRA Issues matching "Web Start or jnlp or javaws"
The samples directory distributed with JRuby has an example jnlp, http://github.com/jruby/jruby/blob/master/samples/irb-applet.html that will start the JRuby Swing IRB console as a Java Web Start application. See also http://github.com/jruby/jruby/tree/master/samples/jnlp/
Here is deployed instance: http://tim.lossen.de/2007/03/jruby/applet.html
The jirb.jnlp needs to be modified to work on Java 1.5 because of the use of .. in the codebase attribute, which only works in Java 1.6.
- Make a symbolic link to the directory $JRUBY_HOME/lib in the samples directory (or make a copy of the lib directory).
$ cd $JRUBY_HOME/samples<br/> $ ln -s ../lib - Change the codebase attribute in the jnlp element to use a reference to the local directory.
<jnlp spec="1.0+" codebase="file:."> - Start the jnlp using javaws from the command line.
$ javaws jirb.jnlp
The following Jira issue includes an attachment that, when extracted in samples/ adds both unsigned and signed examples that work in Java 1.5 and 1.6. It is projected to be included in JRUBY 1.1 RC2.
If you're getting java.securityAccessControlException with the message access denied (java.lang.RuntimePermission accessDeclaredMembers) on startup or when running your JRuby application, then you need to sign your jar. The whole process is described here, under "Signing JAR Files with a Test Certificate".
You basically have to perform the following steps:
keytool -genkey -keystore myKeystore -alias myself keytool -selfcert -alias myself -keystore myKeystore
You also need to include to following lines in your jnlp-file:
<security> <all-permissions/> </security>
Whenever you modify the jar, you need to do the following to update the signature:
jarsigner -keystore myKeystore test.jar myself
If you have a signed jar and the startup fails because of a java.lang.reflect.ReflectPermission, or you continue to have access denied (java.lang.RuntimePermission accessDeclaredMembers) errors, you can just disable the security manager.
Using JRuby:
java.lang.System.setSecurityManager(nil)
Using Java:
System.setSecurityManager(null);
Disclaimer: I'm not an expert on Java Security, so I don't know if disabling the Security Manager has unintended side effects. [User:Mstocker|Mstocker] 10:49, 30 December 2007 (PST)
See: JRUBY-1821 and JRUBY-1782.
http://almaer.com/blog/running-ruby-in-the-browser-via-script-typetextruby has some interesting stuff