Skip to content

Instantly share code, notes, and snippets.

@calavera
Created December 7, 2010 15:02
Show Gist options
  • Save calavera/731867 to your computer and use it in GitHub Desktop.
Save calavera/731867 to your computer and use it in GitHub Desktop.
import java.io.File
import org.apache.commons.io.FileUtils
class Foo
def foo
ext = String[1]
ext[0] = 'erb'
erb_files = FileUtils.listFiles(File.new('.'), ext, true)
puts erb_files.size
end
end
Foo.new.foo
$ bin/mirah -c ./commons-io-2.0.jar foo.mirah
NativeMethodAccessorImpl.java:-2:in `invoke0': java.lang.reflect.InvocationTargetException
from NativeMethodAccessorImpl.java:39:in `invoke'
from DelegatingMethodAccessorImpl.java:25:in `invoke'
from Method.java:597:in `invoke'
from NativeMethodAccessorImpl.java:-2:in `invoke0'
from NativeMethodAccessorImpl.java:39:in `invoke'
from DelegatingMethodAccessorImpl.java:25:in `invoke'
from Method.java:597:in `invoke'
Caused by:
NativeConstructorAccessorImpl.java:-2:in `newInstance0': org.jruby.exceptions.RaiseException: Native Exception: 'class java.lang.ClassNotFoundException'; Message: org.apache.commons.io.FileUtils; StackTrace: java.lang.ClassNotFoundException: org.apache.commons.io.FileUtils
at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
at sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:39)
at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:27)
at java.lang.reflect.Constructor.newInstance(Constructor.java:513)
at org.jruby.javasupport.JavaConstructor.newInstanceDirect(JavaConstructor.java:275)
at org.jruby.java.invokers.ConstructorInvoker.call(ConstructorInvoker.java:92)
at org.jruby.java.invokers.ConstructorInvoker.call(ConstructorInvoker.java:179)
at org.jruby.runtime.callsite.CachingCallSite.cacheAndCall(CachingCallSite.java:319)
at org.jruby.runtime.callsite.CachingCallSite.callBlock(CachingCallSite.java:157)
at org.jruby.runtime.callsite.CachingCallSite.call(CachingCallSite.java:162)
at org.jruby.java.proxies.ConcreteJavaProxy$2.call(ConcreteJavaProxy.java:43)
at org.jruby.runtime.callsite.CachingCallSite.cacheAndCall(CachingCallSite.java:319)
at org.jruby.runtime.callsite.CachingCallSite.callBlock(CachingCallSite.java:157)
at org.jruby.runtime.callsite.CachingCallSite.call(CachingCallSite.java:162)
at org.jruby.RubyClass$SpecificArityNew.call(RubyClass.java:804)
at org.jruby.internal.runtime.methods.DynamicMethod.call(DynamicMethod.java:186)
at org.jruby.java.proxies.ConcreteJavaProxy$3.call(ConcreteJavaProxy.java:139)
at org.jruby.runtime.callsite.CachingCallSite.cacheAndCall(CachingCallSite.java:309)
at org.jruby.runtime.callsite.CachingCallSite.call(CachingCallSite.java:148)
at org.jruby.ast.CallOneArgNode.interpret(CallOneArgNode.java:57)
at org.jruby.ast.FCallOneArgNode.interpret(FCallOneArgNode.java:36)
at org.jruby.ast.NewlineNode.interpret(NewlineNode.java:104)
at org.jruby.ast.IfNode.interpret(IfNode.java:119)
at org.jruby.ast.NewlineNode.interpret(NewlineNode.java:104)
at org.jruby.internal.runtime.methods.InterpretedMethod.call(InterpretedMethod.java:113)
at org.jruby.internal.runtime.methods.InterpretedMethod.call(InterpretedMethod.java:127)
at org.jruby.internal.runtime.methods.DefaultMethod.call(DefaultMethod.java:149)
at org.jruby.RubyClass.finvoke(RubyClass.java:644)
at org.jruby.javasupport.util.RuntimeHelpers.invoke(RuntimeHelpers.java:461)
at org.jruby.javasupport.proxy.JavaProxyConstructor$2.invoke(JavaProxyConstructor.java:222)
at org.jruby.proxy.java.security.SecureClassLoader$Proxy0.findClass(Unknown Source)
at java.lang.ClassLoader.loadClass(ClassLoader.java:307)
at org.jruby.proxy.java.security.SecureClassLoader$Proxy0.__super$loadClass(Unknown Source)
from NativeConstructorAccessorImpl.java:39:in `newInstance'
from DelegatingConstructorAccessorImpl.java:27:in `newInstance'
from Constructor.java:513:in `newInstance'
from JavaConstructor.java:275:in `newInstanceDirect'
from ConstructorInvoker.java:92:in `call'
from ConstructorInvoker.java:179:in `call'
from CachingCallSite.java:319:in `cacheAndCall'
from CachingCallSite.java:157:in `callBlock'
from CachingCallSite.java:162:in `call'
from ConcreteJavaProxy.java:43:in `call'
from CachingCallSite.java:319:in `cacheAndCall'
from CachingCallSite.java:157:in `callBlock'
from CachingCallSite.java:162:in `call'
from RubyClass.java:804:in `call'
from DynamicMethod.java:186:in `call'
from ConcreteJavaProxy.java:139:in `call'
from CachingCallSite.java:309:in `cacheAndCall'
from CachingCallSite.java:148:in `call'
from CallOneArgNode.java:57:in `interpret'
from FCallOneArgNode.java:36:in `interpret'
from NewlineNode.java:104:in `interpret'
from IfNode.java:119:in `interpret'
from NewlineNode.java:104:in `interpret'
from InterpretedMethod.java:113:in `call'
from InterpretedMethod.java:127:in `call'
from DefaultMethod.java:149:in `call'
from RubyClass.java:644:in `finvoke'
from RuntimeHelpers.java:461:in `invoke'
from JavaProxyConstructor.java:222:in `invoke'
from null:-1:in `findClass'
from ClassLoader.java:307:in `loadClass'
from null:-1:in `__super$loadClass'
Caused by:
NativeConstructorAccessorImpl.java:-2:in `newInstance0': java.lang.ClassNotFoundException: org.apache.commons.io.FileUtils
from NativeConstructorAccessorImpl.java:39:in `newInstance'
from DelegatingConstructorAccessorImpl.java:27:in `newInstance'
from Constructor.java:513:in `newInstance'
from JavaConstructor.java:275:in `newInstanceDirect'
from ConstructorInvoker.java:92:in `call'
from ConstructorInvoker.java:179:in `call'
from CachingCallSite.java:319:in `cacheAndCall'
from CachingCallSite.java:157:in `callBlock'
from CachingCallSite.java:162:in `call'
from ConcreteJavaProxy.java:43:in `call'
from CachingCallSite.java:319:in `cacheAndCall'
from CachingCallSite.java:157:in `callBlock'
from CachingCallSite.java:162:in `call'
from RubyClass.java:804:in `call'
from DynamicMethod.java:186:in `call'
from ConcreteJavaProxy.java:139:in `call'
from CachingCallSite.java:309:in `cacheAndCall'
from CachingCallSite.java:148:in `call'
from CallOneArgNode.java:57:in `interpret'
from FCallOneArgNode.java:36:in `interpret'
from NewlineNode.java:104:in `interpret'
from IfNode.java:119:in `interpret'
from NewlineNode.java:104:in `interpret'
from InterpretedMethod.java:113:in `call'
from InterpretedMethod.java:127:in `call'
from DefaultMethod.java:149:in `call'
from RubyClass.java:644:in `finvoke'
from RuntimeHelpers.java:461:in `invoke'
from JavaProxyConstructor.java:222:in `invoke'
from null:-1:in `findClass'
from ClassLoader.java:307:in `loadClass'
from null:-1:in `__super$loadClass'
[exited with 1]
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment