Skip to content

Instantly share code, notes, and snippets.

@BanzaiMan
Created November 24, 2010 02:06
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 1 You must be signed in to fork a gist
  • Save BanzaiMan/712974 to your computer and use it in GitHub Desktop.
Save BanzaiMan/712974 to your computer and use it in GitHub Desktop.
JRuby IRB applet sample in HTML 5 (confirmed to work on Firefox and Safari on the Mac; does not work on Google Chrome)
<!DOCTYPE html>
<html>
<head>
<title>JRuby IRB</title>
<meta charset="utf-8">
<style type="text/css">
.code {font-family: "Courier New", Courier, mono;}
</style>
</head>
<body>
<h1>JRuby IRB</h1>
<p>To use the IRB applet, you need <span class="code">jruby-complete.jar</span> (built from source with <span class="code">ant jar-complete</span> or downloaded from jruby.org separately, e.g. <a href="http://jruby.org.s3.amazonaws.com/downloads/1.5.5/jruby-complete-1.5.5.jar">1.5.5 Complete.jar</a>) in <span class="code">../lib</span>.
</p>
<object type="application/x-java-applet" id="JRuby-IRB" width="700" height="500">
<param name="code" value="org.jruby.JRubyApplet.class" />
<param name="codebase" value="../lib/" />
<param name="archive" value="jruby-complete.jar" />
<param name="jruby.banner" value="Welcome to JRuby on the Web!" />
<param name="jruby.console" value="true" />
<param name="jruby.objectspace" value="true" />
<param name="jruby.eval" value="ARGV[0..-1] = %w(-f) ; require 'irb' ; require 'irb/completion' ; Thread.new { IRB.start }" />
Failed to load the IRB applet.
</object>
</body>
</html>
@pathsny
Copy link

pathsny commented Nov 24, 2010

Hi, Im unable to get this to work. I've set the archive name to the jar I download, but i cant figure out where to keep the jar file

@BanzaiMan
Copy link
Author

Hi.
If this file irb-applet5.html is in ./dir, then jruby-complete.jar needs to be in ./lib.

You can also modify line 16 to change where to put the jar file. In particular, if you change ../lib/ to ./, you can keep the jar file in the same directory as this HTML file.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment