Skip to content

Instantly share code, notes, and snippets.

@jarib
Created May 31, 2010 17:58
Show Gist options
  • Save jarib/420086 to your computer and use it in GitHub Desktop.
Save jarib/420086 to your computer and use it in GitHub Desktop.
require "java"
require "fileutils"
FileUtils.mkdir_p("com/test")
java = <<JAVA
package com.test;
class MyClass {
public static String foo() {
return "foo";
}
}
JAVA
File.open("com/test/MyClass.java", "w") { |file| file << java }
`javac com/test/MyClass.java`
java_import "com.test.MyClass"
p :result => MyClass.foo
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment