Sorry guys I have tried this again through creating class with method inside the main class but it showing this error in jsp page ;
java.lang.UnsatisfiedLinkError: org.hyperic.sigar.Sigar.getCpuInfoList()[Lorg/hyperic/sigar/CpuInfo;
I'm not sure if that from the code or Sigar API library sorry again but i need help to get this jsp right
package mydata;
import org.hyperic.sigar.CpuInfo;
import org.hyperic.sigar.Sigar;
import org.hyperic.sigar.SigarException;
public class MyCpu {
private String cpuInfoList;
public String getCpuInfoList() {
return this.cpuInfoList;
}
public MyCpu() {
Sigar sigar = new Sigar();
String output = " ";
CpuInfo[] cpuInfoList = null;
try {
cpuInfoList = sigar.getCpuInfoList();
} catch (SigarException e) {
e.printStackTrace();
return;
}
for (CpuInfo info : cpuInfoList) {
output += "Vendor: " + info.getVendor() + "";
}
System.out.println(output);
}
public static void main(String[] args) {
MyCpu main = new MyCpu();
}
}
--------------------------------------------------------------------------------------
<!---JSP--->
<%@page import ="org.hyperic.sigar.Sigar"%>
<%@page contentType="text/html" pageEncoding="UTF-8"%>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"
"http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<title>JSP Page</title>
</head>
<body>
<h1>Hello World!</h1>
<%@page import="mydata.*"%>
<%
MyCpu cpu = new MyCpu();
Sigar sigar = new Sigar();
out.println(sigar.getCpuInfoList());
%>
</body>
</html>