当前位置: 技术问答>java相关
初学者救助?
来源: 互联网 发布时间:2015-03-31
本文导语: class employee { String Name; long EmployeeID; double Salary; public employee() { Name = "LSP"; EmployeeID = 76813; Salary = 1323234.23; } public void showEmployee() { System.out.println("Name:" + Name +...
class employee
{
String Name;
long EmployeeID;
double Salary;
public employee()
{
Name = "LSP";
EmployeeID = 76813;
Salary = 1323234.23;
}
public void showEmployee()
{
System.out.println("Name:" + Name + "n");
System.out.println("EmpID:" + EmployeeID + "n");
System.out.println("Salary:" + Salary + "n");
}
}
public class EmployeeInfo
{
public static void main(String args[])
{
employee boss = new employee();
boss.showEmployee();
}
}
上面是我用记事本写的代码,保存为EmployeeInfo.Java
切换到DOS命定符:
Javac EmployeeInfo.Java //顺利执行
Java EmployeeInfo //出现错误提示:
Registry key 'SoftwareJavaSoftJava Runtime EnvironmentCurrentVersion' has value '1.3', but '1.4' is required. Error: could not find java.dll Error: could not find Java 2 Runtime Environment.
{
String Name;
long EmployeeID;
double Salary;
public employee()
{
Name = "LSP";
EmployeeID = 76813;
Salary = 1323234.23;
}
public void showEmployee()
{
System.out.println("Name:" + Name + "n");
System.out.println("EmpID:" + EmployeeID + "n");
System.out.println("Salary:" + Salary + "n");
}
}
public class EmployeeInfo
{
public static void main(String args[])
{
employee boss = new employee();
boss.showEmployee();
}
}
上面是我用记事本写的代码,保存为EmployeeInfo.Java
切换到DOS命定符:
Javac EmployeeInfo.Java //顺利执行
Java EmployeeInfo //出现错误提示:
Registry key 'SoftwareJavaSoftJava Runtime EnvironmentCurrentVersion' has value '1.3', but '1.4' is required. Error: could not find java.dll Error: could not find Java 2 Runtime Environment.
|
是classpath设置的问题,你自己看看书就懂了