本文介绍了胖罐立即关闭的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我使用JarSplice创建了一个胖jar文件,但是当我启动它时,我得到一个窗口(大小合适)并在半秒后关闭...

I created a fat jar file using JarSplice, but when I launch it i get a window (the size is okay) and it closes after half a seccond...

在添加罐子部分中,我添加了从Eclipse导出的jar文件,以及我正在使用的所有库罐。在本机部分,我只为lwjgl添加Windows本机。我想我写了正确的主要课程。

In the "add jars" section I'm adding the jar file that I exported from Eclipse, and all library jars that I'm using. In the natives section I'm adding only Windows natives for lwjgl. I think I wrote the correct main class.

我做错了什么?我该如何解决这个问题呢?

注意:我正在使用最新版本的eclipse和jdk。

推荐答案

该文件不再是文件系统,而是在jar中,因此您需要从中加载资源在罐子里面。当你在eclipse中运行时它仍然在文件系统上,但是当你创建jar时它不是,这就是为什么它在eclipse中工作但不是在你打包它时。 的答案应该会给你一个良好的开端在jar中加载文件作为资源。也就是说,我不确定你是否可以做一些与你的 listFiles 类似的事情。

The file no longer is really on the "file system" but is instead in the jar, so you will need to load the resource from within the jar. When you run from within eclipse it is still on the file system, but when you create the jar it's not, that's why it works in eclipse but not when you package it up. The answer to this question should give you a good start on loading a file within a jar as a resource. That said, I'm not sure if you can do something similar to your listFiles call.

这篇关于胖罐立即关闭的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

08-13 09:00