顯示具有 jade 標籤的文章。 顯示所有文章
顯示具有 jade 標籤的文章。 顯示所有文章

2012年9月29日 星期六

Re-install Cluster on Xen 6.0.2

As title, just because we updated Xen to version 6.0.2 .
Following is some problems faced while installing.

Note that the following things should be install as a "Base System" that can be cloned to make new VM.

  1. Java Environment
  2. Jade Environment
  3. Hadoop Enviornment

Note that Hadoop setup procedure is not written in this article.

2010年5月22日 星期六

如何在jade的環境下動態載入Agent並執行之

對於沒學過java,而直接寫jade的人,一定對這個標題有問題

有問題的原因就是:jade沒有提供function來做

可是在找過網路後,發現有 java.lang.ClassLoader 和 java.net.URLClassLoader 可以用。

使用方式如下:

try{
            URL url[] = new URL[1];
            url[0] = new URL("file:///pathTojar.jar");
            ClassLoader m_loader = new ClassLoader(url, ClassLoader.getSystemClassLoader());
            getContainerController().acceptNewAgent("test", (Agent)m_loader.loadClass("examples.hello.HelloWorldAgent").newInstance());
            getContainerController().getAgent("test").start();
        } catch(Exception e) {
            e.printStackTrace();
}

如此一來,就可以將jar檔裡的class檔讀出來,並動態執行之