双击命令提示符中运行.jar文件 [英] Running a .jar file in a command prompt from double click

查看:154
本文介绍了双击命令提示符中运行.jar文件的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我将首先在Windows 7上说我。

I'll start of by saying Im on windows 7.

我创建了一个.jar文件,它使用-java -jar从命令行执行得很好myJar.jar方法

I have created a .jar file which executes fine from the command line using the - java -jar myJar.jar approach

但我所追求的是能够双击jar文件并打开命令提示符窗口并运行命令提示符好像我刚刚输入了java -jar myJar.jar行。

But what I'm after is to be able to double click on the jar file and for it to open up the command prompt window and run in the command prompt as if i've just typed the java -jar myJar.jar line.

当我双击jar文件时,我认为它正在运行,因为它是一个可视化部分java正在出现,但是没有命令提示窗口显示我的控制台输出。

When I double click the jar file I do think it is running because a visual part of the java is appearing, but there is no command prompt window showing my console output.

环顾四周之后我遇到过人们说javaw这是什么jar文件与没有控制台关联,我需要将jar文件与java.exe而不是javaw.exe关联。我试过这个并且它似乎没有用。

After looking around I've come across people saying that javaw which is what the jar files are associated with don't have a console and that I need to associate jar files with java.exe instead of javaw.exe. I've tried this and it didn't seem to work.

任何人都可以帮忙吗?一步一步会很好。

Can anyone help? A step by step would be nice.

推荐答案

这是恕我直言。您可以从应用程序本身打开控制台,但是是依赖于操作系统的。如果您需要打开控制台,则必须像以前一样从中运行应用程序。

This is IMHO not possible. You could open the console from the application itself, but that is OS-dependent. If you need the console open, you have to run the application from it as you already do.

这篇关于双击命令提示符中运行.jar文件的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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