一段小代码运行出错?跪求解决~~~~估计是API的加载[我是菜鸟]
我使用的是j2sdk1.4.1 刚刚安装好 也没配置(也不知道配置)
运行javac addition1时(已经java addition了)出现以下提示:
Exception in thread "main "
java.lang.NoClassDefFoundError: addtion1/ <wrong name: Addition1>
这是什么问题???是没有配置加载API库吗??
程序如下:(程序应该没有问题)的
// Fig. 2.9: Addition.java
// An addition program.
// Java extension packages
import javax.swing.JOptionPane; // import class JOptionPane
public class Addition1 {
// main method begins execution of Java application
public static void main( String args[] )
{
String firstNumber; // first string entered by user
String secondNumber; // second string entered by user
int number1; // first number to add
int number2; // second number to add
int sum; // sum of number1 and number2
// read in first number from user as a string
firstNumber =
JOptionPane.showInputDialog( "Enter first integer " );
// read in second number from user as a string
secondNumber =
JOptionPane.showInputDialog( "Enter second integer " );
// convert numbers from type String to type int
number1 = Integer.parseInt( firstNumber );
number2 = Integer.parseInt( secondNumber );
// add the numbers
sum = number1 + number2;
// display the results
JOptionPane.showMessageDialog(
null, "The sum is " + sum, "Results ",
JOptionPane.PLAIN_MESSAGE );
System.exit( 0 ); // terminate application