昨天因为Eclipse下导出的 fatjar 不能运行郁闷坏了。
这是我见过的最诡异的问题了。直接双击运行可执行的 jar 时主窗口已经打开,只是没有响应,低头一看任务栏图标变成了Processing 的Logo...前天刚下载了一个Processing 的PDE 写了些小Demo 玩玩,结果不知道什么原因酿成这个杯具。因为在安装Processing 之前导出的jar 都可以正常运行。把所有Lib 和环境变量还有注册表都检查一遍也没有问题,删掉Processing也无济于事,本来PDE 就是免安装运行的。不知道在运行PDE之后他偷偷干了些什么,更改了我的环境。
没有办法,换了IntelliJ 新建一个工程,导包,编译通过,不过在执行时又弹出来一个错:
jogl.dll: Can't load IA 32-bit .dll on a AMD 64-bit platform
才想起来我的机器是64位,默认Jogl的dll是32位的 ,去MT4J 网站查阅,果然有解决方案:
Does MT4j run on 64-Bit operating systems?
64-Bit systems support is limited and can cause some problems. However, you can get it running by replacing the native java OpenGL libraries in the MT4j root folder with the 64-bit versions which are found in the ./mt4jLibs/jogl/ directory. For windows systems, the needed files are located in the jogl-natives-windows-amd64.jar and gluegen-rt-natives-windows-amd64.jar, for linux, in the jogl-natives-linux-amd64.jar and gluegen-rt-natives-linux-amd64.jar. These jar files can be opened by most archive programs like7-Zip for example. If problems still exist, try changing the installed java runtime environment to a 32-Bit version.
找到jogl的64位版本,解压出3个dll文件,然后拷贝到当前系统jre下的bin里,替换掉当前的dll,成功运行 :)
看看自己的初步成果。