如何正确的双击运行jar文件

在谈这个之前,你的代码必须运行正确,并且能在dos环境下,运行java -jar xxx.jar 能够正确运行

 

在这之前,如果还是不能双击运行jar文件

那么你可以看下面的了:

双击运行会出现如下错误:

“Could not find the main class. Program will exit.”

根源分析:可能是在打开方式中的javaw版本过低。比如jdk1.5编译的class文件用1.4的javaw打开就会出现这个问题。

解决方案:控制面板->文件夹选项->文件类型->JAR下面的<高级>按纽
<操作>下面选open , 点右边的<编辑>,修改javaw路径,如:"C:/Program Files/Java/jdk1.5.0_10/bin/javaw.exe" -jar "%1" "%*"

 

 

sun公司的观点

CAUSE

WJView.exe or Javaw.exe cannot find the program it is trying to run.


SOLUTION

If this error occurs during startup, it is mostly likely caused by a spyware or adware program which is missing, corrupt, or partially deleted.


Remove Spyware/Adware

Using your favorite search engine, search for "spyware removal utility" as your search phrase. This search will help you locate many free spyware removal utilities.

Note: The Spyware Removal Utility can help you get rid of this error message partially. Any new spyware can get itself downloaded to your system later. To get rid of this problem completely, try the second option given below.


Remove WJView entries from Startup

Wjview lets you view Windows based Java applications. You might receive an error message if Wjview attempts to start an application on your system that no longer exists.

You may need to modify the system configuration settings to completely get rid of the error. To do so, follow these steps:
Click Start > Run.
The Run dialog box appears.
Type msconfig.exe.
Click OK.
The System Configuration Utility dialog box appears.
Select the Startup tab.
Deselect the WJView.exe and/or javaw.exe check boxes that are associated with this problem.
Click OK.
You will be prompted to restart the computer. Restart the system to apply changes.

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值