刚刚制作了一个计算器类型的简单程序....我需要一种方法将它编译成可用的jar ...我怎么在eclipse中这样做...我很新编程所以请原谅我,如果我'我的问题不太清楚......
这是我的源代码
package lvlup;
import java.awt.color.*;
import java.math.*;
import java.util.Scanner;
public class methods {
public methods(){
System.out.println("Choose an option/n");
System.out.println(" press 1 for derivative calculator (known polynomials)");
int Choice;
Scanner c = new Scanner(System.in);
Choice = c.nextInt();
switch (Choice){
case 1:
derCal();
}
}
private void derCal() {
double x;
double n;
long der;
Scanner sc = new Scanner (System.in);
System.out.println("welcome to the derivative calc");
System.out.println("insert x");
x = sc.nextDouble();
System.out.println("insert n now/ n=1 default");
n = sc.nextDouble();
der = (long) (n*Math.pow(x, n-1));
System.out.println("the answer is :" + der);
}
public static void main (String args []){methods m = new methods();
}
}
答案 0 :(得分:2)
在工作台中创建一个新的可运行JAR文件:
来源:http://help.eclipse.org/juno/index.jsp?topic=%2Forg.eclipse.jdt.doc.user%2Ftasks%2Ftasks-37.htm