我是新來的java。我一直在學習小程序和所有,我一直在試圖做一個簡單的程序,使用系統類來獲取機器的屬性。 簡而言之,我試圖輸出窗口名稱,版本和體系結構。 我試着做點什麼。當我試着通過appletviewer運行它時,它會運行,但是當我嘗試在服務器上運行它時,它會顯示一些錯誤。可能是代碼錯誤?請幫助,因爲我是新手。 繼承人鏈接到小程序。使用java中的系統屬性時發生錯誤
http://ashish.club-tec.co.il/sysf.html
和繼承人的代碼
import java.applet.*;
import java.awt.*;
public class sysf extends Applet
{
Label l1,l2;
String p;
public void init()
{
l1=new Label("Operating system is ");
l2=new Label("");
add(l2);
add("Center",l1);
p=System.getProperty("user.name");
l2.setText("Hi "+p+",your system info is as follows");
p= System.getProperty("os.name");
l1.setText(l1.getText()+p);
p=System.getProperty("os.version");
p=" version "+p+" ";
l1.setText(l1.getText()+p);
p=System.getProperty("os.arch");
p=" and architecture is "+p+" ";
l1.setText(l1.getText()+p);
}
}
謝謝!