JRubyでTwitterのAPIにアクセスしてみましょう。RubyであればTwitter gemというライブラリがありますが、これがJRubyでも動くのは当たり前。そこで、Javaで使われるTwitter4Jというライブラリを使います。 OAuthの説明はここではしません。まずはアクセストークンを取得して、twitter.cfgというファイルに保存するコード。先にhttp://twitter.com/appsにアクセスして、コンシューマートークンを取得しておいてください。 JRubyからJavaのライブラリを使う場合、まずrequire 'java'しておいて、jarファイルをrequireします。またJavaのクラスを利用するには、'twitter4j.TwitterFactory'などの完全修飾名を使いますが、java_importメソッドを使うと、定数名としてインポートすることがで