如何在不使用IDE或命令提示符的情况下运行Java应用程序 [英] How to run Java applications without using an IDE or the command prompt

查看:109
本文介绍了如何在不使用IDE或命令提示符的情况下运行Java应用程序的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

这是一个比一个问题更好奇:

This is more curiosity than a problem:

我最近想知道是否有一种方法来运行编译的Java应用程序,而不使用cmd或IDE,如Eclipse 。我使用Eclipse,但它不是非常有用,如果你想独立运行程序。您可以在Windows资源管理器中保存Java文件,以便您可以为它们创建快捷方式吗?如果是,如何?文件是否有某种特殊的扩展名?我听说过.JAR文件,但我不知道他们是什么。任何人都可以告诉我该怎么做?

I was recently wondering if there was a way to run compiled Java applications without using the cmd or an IDE such as Eclipse. I use Eclipse, but it isn't very useful if you want to run the program independently. Can you save Java files in Windows Explorer so you can create a shortcut for them? If so, how? Is there some sort of special extension to the file? I've heard of .JAR files, but I'm not sure what they are. Can anyone tell me how to do it?

推荐答案

.JAR文件是包含 - 清单文件。您可以在该清单中设置应用程序的主入口点。请参见设置应用程序的入口点

.JAR files are archives containing - amongst other things - your compiled classes and a manifest file. You may set the main entry point of your application in that manifest. See Setting an Application's Entry Point.

通常,如果你在Windows中双击一个jar文件,它会被 javaw.exe -jar< yourFile.jar> 打开。 javaw.exe将查找清单并尝试启动定义的主类。

Normally if you double click a jar file in windows it will be opened by javaw.exe -jar <yourFile.jar>. javaw.exe will lookup the manifest and try start the main class defined there.

这篇关于如何在不使用IDE或命令提示符的情况下运行Java应用程序的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆