javaxpcom試そうとしたが
なんか気になったので試そうとしたが、ぜんぜん意味が分からん。
そもそもxpcomが意味分からん。自分が何やってるのかすら分からん。
(参考文献をあとで書く)
import java.io.File; import java.io.FileNotFoundException; import org.mozilla.xpcom.*; import java.util.*; public class Main { /** * @param args */ public static void main(String args) { // TODO 自動生成されたメソッド・スタブ Mozilla mozilla = Mozilla.getInstance(); //xulrunner installationを探す GREVersionRange range = new GREVersionRange[1]; range[0] = new GREVersionRange("1.8",true,"1.9+",true); Properties props = null; File grePath = null; try { grePath = Mozilla.getGREPathWithProperties(range,props); } catch(FileNotFoundException e){} if(grePath == null) { System.out.println("Found no gre path"); } try{ //mozilla. //mozilla.initalize(grePath); mozilla.initXPCOM(grePath,null); } catch(IllegalArgumentException e) { System.out.println("no javacom.jar found in given path"); } catch(Exception ex) { System.out.println("initXPCOM failed"); ex.printStackTrace(); return; } nsIComponentManager componentManager = mozilla.getComponentManager(); nsIMutableArray array = (nsIMutableArray)componentManager.createInstanceByContractID("@mozilla.org/array;1", null, nsIMutableArray.NS_IMUTABLEARRAY_IID); System.out.println(array.toString()); mozilla.shutdownXPCOM(null); } }
コンパイルは通ったので一応実行結果・・・・
org.mozilla.xpcom.nsIMutableArray@1ffb8dc
ちゃんと動作してるのかすら分からんレベル。
なにこれ?
(追記)
メソッド呼んだ。
System.out.println(array.getLength());
結果
動いてる・・・のか?