它说 exeption it thread "main" java.lang.noclassdeffounderror: 后面跟着 13 行“at java”。
我尝试了最常见的方法来解决这个错误,我对 java 完全陌生,这让我发疯了!它非常令人沮丧。:(我将“类路径”环境变量更改为“。”并将正确的路径(C:\ Program Files \ Java \ jdk1.7.0_17 \ bin)也复制到“路径”变量中。我不认为它是.我什至在另一台计算机上尝试了完全相同的结果(在我更改了环境变量之后)。我从“fordummies”网站下载了代码,所以我不认为它的代码不好......我花了最后 4 个小时研究这个,我想是时候向专家寻求建议了 :) :)
// This program prompts for information about a loan and
// computes the monthly loan payment.
import java.util.*; // for Scanner
public class Mortgage {
public static void main(String[] args) {
Scanner console = new Scanner(System.in);
// obtain values
System.out.println("This program computes monthly " +
"loan payments.");
System.out.print("loan amount : ");
double loan = console.nextDouble();
System.out.print("number of years : ");
int years = console.nextInt();
System.out.print("interest rate : ");
double rate = console.nextDouble();
System.out.println();
// compute result and report
int n = 12 * years;
double c = rate / 12.0 / 100.0;
double payment = loan * c * Math.pow(1 + c, n) /
(Math.pow(1 + c, n) - 1);
System.out.println("payment = $" + (int) payment);
}
}
错误是:
at java.net.URLClassLoader$1.run(Unknown Source)
at java.net.URLClassLoader$1.run(unknown Source)
at java.security.AccessController.DoPrivileged(Native Method)
at java.net.URLClassLoader.findClass(Unknown Source)
at java.lang.ClassLoader.loadClass(Unknown Source)
at sun.misc.Launcher$AppClassLoader.loadClass(Unknown Source)
at java.lang.ClassLoader.loadClass(Unknown Source)
at sun.launcher.LauncherHelper.checkAndLoadMain(Unknown Source)