简体   繁体   English

在Eclipse中导出我的Java程序

[英]Exporting my Java program in Eclipse

I have made a hello world program in eclipse and I was wondering how to run it out of eclipse (not on the console). 我在eclipse中制作了一个hello world程序,我想知道如何在eclipse之外运行它(不在控制台上)。 I want to run it like you would with a .exe . 我想像使用.exe一样运行它。 Is this possible? 这可能吗?

If you exported your program as an .exe, you would only be able to run it natively on Windows (the point of Java is that it is cross platform). 如果将程序导出为.exe,则只能在Windows上本机运行(Java的要点是它是跨平台的)。 You want to export it as a Runnable JAR File , which should be one of the export options in Eclipse: 您要将其导出为可运行的JAR文件 ,这应该是Eclipse中的导出选项之一:

在此处输入图片说明

By default, no console window will be opened when you try to open your JAR file, so any calls to System.out or System.err will be invisible. 默认情况下,当您尝试打开JAR文件时,不会打开任何控制台窗口,因此对System.outSystem.err任何调用都是不可见的。 You can either run your JAR file through command prompt ( java -jar YourJarFile.jar ) or create a GUI for your user to interact with. 您可以通过命令提示符( java -jar YourJarFile.jar )运行JAR文件,也可以创建GUI以便用户与之交互。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM