|
如下 网上找了jmx的学习 资料 他的源代码如下 用到了sun的一个包 大哥们那里有得下载啊?
florentina@florentina:~/java-code/exercise/c02/1$ javac HelloAgent.java
HelloAgent.java:2: 软件包 com.sun.jdk.comm 不存在
import com.sun.jdk.comm.*;
^
HelloAgent.java:12: 找不到符号
符号: 类 HtmlAdaptorServer
位置: 类 HelloAgent
HtmlAdaptorServer adapter = new HtmlAdaptorSever();
^
HelloAgent.java:12: 找不到符号
符号: 类 HtmlAdaptorSever
位置: 类 HelloAgent
HtmlAdaptorServer adapter = new HtmlAdaptorSever();
^
HelloAgent.java:38: 不兼容的类型
找到: HelloAgent
需要: HelloWorld
HelloWorld agent = new HelloAgent();
^
4 错误
florentina@florentina:~/java-code/exercise/c02/1$ more HelloAgent.java
import javax.management.*;
import com.sun.jdk.comm.*;
public class HelloAgent
{
private MBeanServer mbs = null;
public HelloAgent()
{
mbs = MBeanServerFactory.createMBeanServer("HelloAgent");
HtmlAdaptorServer adapter = new HtmlAdaptorSever();
HelloWorld hw = new HelloWorld();
ObjectName adapterName = null;
ObjectName helloWorldName = null;
try
{
helloWorldName = new ObjectName("HelloAgent:name=helloWorld1");
mbs.registerMBean(hw,helloWorldName);
adapterName = new ObjectName("HelloAgent:name=htmladaper,port=9092");
adapter.setPort("9092");
mbs.registerMBean(adapter, adapterName);
adapter.start();
}
catch(Exception e)
{
e.printStackTrace();
}
}
public static void main(String args[])
{
System.out.println("HelloAgent is running");
HelloWorld agent = new HelloAgent();
}
}
florentina@florentina:~/java-code/exercise/c02/1$ vi HelloAgent.java
florentina@florentina:~/java-code/exercise/c02/1$ javac HelloAgent.java
HelloAgent.java:2: 软件包 com.sun.jdmk.comm 不存在
import com.sun.jdmk.comm.*;
^
HelloAgent.java:12: 找不到符号
符号: 类 HtmlAdaptorServer
位置: 类 HelloAgent
HtmlAdaptorServer adapter = new HtmlAdaptorSever();
^
HelloAgent.java:12: 找不到符号
符号: 类 HtmlAdaptorSever
位置: 类 HelloAgent
HtmlAdaptorServer adapter = new HtmlAdaptorSever();
^
HelloAgent.java:38: 不兼容的类型
找到: HelloAgent
需要: HelloWorld
HelloWorld agent = new HelloAgent();
^
4 错误 |
|