1.首先在命令行下运行jar包看文件是否报错(java -jar jar文件名称.jar)
如果程序中有System.out.println()语句,不想让其输出到控制台而保存到文件中,
则可用命令:java -jar jar文件名称.jat >test.txt ,此时输出信息会打印到test.txt文件中(test.txt会在jar文件同目录中自动创建)
2.如果jar文件没有错误,则右键点击jar文件,选择打开方式,找到jdk的安装路径,在bin目录下选择javaw.exe
3.进入注册表(win键+R键 输入regedit)
找到HKEY_CLASSES_ROOT\Applications\javaw.exe\shell\open\command
此时数据中是不含有 -jar 的,在"%1"前面加上 -jar 即可 如图: