main.java
来自「jdk-6u10-docs java开发宝典」· Java 代码 · 共 31 行
JAVA
31 行
/* Main.java - main class for Hello World example. Create the HelloWorld MBean, register it, then wait forever (or until the program is interrupted). */package com.example.mbeans;import java.lang.management.*;import javax.management.*;public class Main { /* For simplicity, we declare "throws Exception". Real programs will usually want finer-grained exception handling. */ public static void main(String[] args) throws Exception { // Get the Platform MBean Server MBeanServer mbs = ManagementFactory.getPlatformMBeanServer(); // Construct the ObjectName for the MBean we will register ObjectName name = new ObjectName("com.example.mbeans:type=Hello"); // Create the Hello World MBean Hello mbean = new Hello(); // Register the Hello World MBean mbs.registerMBean(mbean, name); // Wait forever System.out.println("Waiting forever..."); Thread.sleep(Long.MAX_VALUE); }}
⌨️ 快捷键说明
复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?