Java 使用Ecplipse导出时无法使我的程序可执行
亲爱的java爱好者朋友: 我想在eclipse的帮助下将我的java程序制作成一个可执行的.jar文件。我导出到一个.jar文件中,但当我双击它时,它似乎不起作用?我想我错过了一些东西,但经过一段时间的努力,我找不到它 有什么建议吗Java 使用Ecplipse导出时无法使我的程序可执行,java,file,jar,makefile,executable,Java,File,Jar,Makefile,Executable,亲爱的java爱好者朋友: 我想在eclipse的帮助下将我的java程序制作成一个可执行的.jar文件。我导出到一个.jar文件中,但当我双击它时,它似乎不起作用?我想我错过了一些东西,但经过一段时间的努力,我找不到它 有什么建议吗 import java.util.Scanner; public class GravityMoon { public static void main(String[] args) { System.out.println("Plea
import java.util.Scanner;
public class GravityMoon {
public static void main(String[] args) {
System.out.println("Please enter your earthweight in kilograms below:");
Scanner earthweight = new Scanner(System.in);
// Repeat until next item is a double
while (!earthweight.hasNextDouble())
{
// Read and discard offending non-double input
earthweight.next();
// Re-prompt
System.out.print("Please enter your earthweight "
+ "in numerical kilograms: ");
}
double moonweight;
// Converts earthweight in moonweight 17%
moonweight = earthweight.nextDouble() * 0.17;
// convert to whole numbers
//closes keyboard input
earthweight.close();
//prints out your moonweight in a decimal number
System.out.println("Your moonweight is " + Math.round(moonweight * 100d) /100d
+ " kilograms.");
}}
由于您没有解释确切的问题,我可能只会给出一些提示: 导出为可执行Jar 在Eclipse中,有导出到jar文件的选项和导出到可执行jar文件的另一个选项请参见 我猜您正在使用windows,尝试从控制台执行jar文件,比如java-jar 在windows中双击jar文件不会打开终端窗口