Guest User

Untitled

a guest
May 26th, 2018
88
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.33 KB | None | 0 0
  1.  
  2. require "java"
  3. require "fileutils"
  4.  
  5. FileUtils.mkdir_p("com/test")
  6.  
  7. java = <<JAVA
  8. package com.test;
  9.  
  10. class MyClass {
  11. public static String foo() {
  12. return "foo";
  13. }
  14. }
  15. JAVA
  16.  
  17. File.open("com/test/MyClass.java", "w") { |file| file << java }
  18. `javac com/test/MyClass.java`
  19.  
  20. java_import "com.test.MyClass"
  21.  
  22. p :result => MyClass.foo
Add Comment
Please, Sign In to add comment