How to use the require keyword

Code Example 1 shows how to use the require keyword to reference or include both third-party and Java platform API libraries.

#Load Java platform and third-party API support using 
#JRuby 0.9.1 and later syntax.
require 'java'
require 'xml-apis-1.3.02.jar'

#Third-party code
...
org.w3c.dom.Element root = g.getRoot()
svgdocument = impl.createDocument(svgNS, "svg", null)
org.w3c.dom.Node node = svgdocument.importNode(root, true) 
...

This code sample is from the article JRuby and the Java Platform.

Enter labels to add to this page:
Please wait 
Looking for a label? Just start typing.

Sign up or Log in to add a comment or watch this page.


The individuals who post here are part of the extended Sun Microsystems community and they might not be employed or in any way formally affiliated with Sun Microsystems. The opinions expressed here are their own, are not necessarily reviewed in advance by anyone but the individual authors, and neither Sun nor any other party necessarily agrees with them.

Copyright 1994-2009 Sun Microsystems, Inc.
Powered by Atlassian Confluence
Sun Guidelines on Public Discourse Privacy Policy Terms of Use Trademarks Site Map Employment Investor Relations Contact