我第一次尝试运行 Maud(X 射线衍射软件)时遇到了与 java(已安装)相关的错误:
Error occurred during initialization of VM
java.lang.ExceptionInInitializerError
at java.nio.file.Paths.get(java.base/Paths.java:84)
at java.lang.module.ModuleFinder.ofSystem(java.base/ModuleFinder.java:163)
at jdk.internal.module.ModuleBootstrap.boot(java.base/ModuleBootstrap.java:98)
at java.lang.System.initPhase2(java.base/System.java:1917)
Caused by: java.lang.RuntimeException: default directory must be absolute
at sun.nio.fs.UnixFileSystem.<init>(java.base/UnixFileSystem.java:54)
at sun.nio.fs.LinuxFileSystem.<init>(java.base/LinuxFileSystem.java:39)
at sun.nio.fs.LinuxFileSystemProvider.newFileSystem(java.base/LinuxFileSystemProvider.java:46)
at sun.nio.fs.LinuxFileSystemProvider.newFileSystem(java.base/LinuxFileSystemProvider.java:39)
at sun.nio.fs.UnixFileSystemProvider.<init>(java.base/UnixFileSystemProvider.java:56)
at sun.nio.fs.LinuxFileSystemProvider.<init>(java.base/LinuxFileSystemProvider.java:41)
at sun.reflect.NativeConstructorAccessorImpl.newInstance0(java.base/Native Method)
at sun.reflect.NativeConstructorAccessorImpl.newInstance(java.base/NativeConstructorAccessorImpl.java:62)
at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(java.base/DelegatingConstructorAccessorImpl.java:45)
at java.lang.reflect.Constructor.newInstance(java.base/Constructor.java:453)
at java.lang.Class.newInstance(java.base/Class.java:550)
at sun.nio.fs.DefaultFileSystemProvider.createProvider(java.base/DefaultFileSystemProvider.java:48)
at sun.nio.fs.DefaultFileSystemProvider.create(java.base/DefaultFileSystemProvider.java:63)
at java.nio.file.FileSystems.<clinit>(java.base/FileSystems.java:91)
at java.nio.file.Paths.get(java.base/Paths.java:84)
at java.lang.module.ModuleFinder.ofSystem(java.base/ModuleFinder.java:163)
at jdk.internal.module.ModuleBootstrap.boot(java.base/ModuleBootstrap.java:98)
at java.lang.System.initPhase2(java.base/System.java:1917)
我读过如何通过更改初始文件中的 java 路径来修复错误,但我无法在 Maud.sh 文件中弄清楚这一点,该文件包含:
#! /bin/sh -f
MAUD_PATH=`dirname "$0"`
cd $MAUD_PATH
java -mx1024M -Duser.dir=$MAUD_PATH -cp Maud.jar:lib/miscLib.jar:lib/JNIAltivec.jar:lib/EsquiClient.jar:lib/Help.jar:lib/Images.jar:lib/JGraph.jar:lib/JSgInfo.jar:lib/jgaec.jar:lib/Files.jar:lib/ij.jar:lib/HTTPclient.jar:lib/gl4java.jar it.unitn.ing.rista.Maud
我有一个 Ubuntu 16,x86。Maud 文件位于主目录中。Java 版本是 openjdk 9-internal。
编辑:我MAUD_PATH=$(realpath "$(dirname "$0")")
按照@steeldriver 说的尝试,在一台计算机上运行良好,但在另一台计算机上却出现了另一个错误:
# A fatal error has been detected by the Java Runtime Environment:
#
# SIGSEGV (0xb) at pc=0xb72bae48, pid=6550, tid=6551
#
# JRE version: OpenJDK Runtime Environment (9.0) (build 9-internal+0-2016-04-14-195526.buildd.src)
# Java VM: OpenJDK Client VM (9-internal+0-2016-04-14-195526.buildd.src, mixed mode, serial gc, linux-x86)
# Problematic frame:
# C [libjava.so+0x18e48] JNU_GetEnv+0x18
#
# Core dump will be written. Default location: Core dumps may be processed with "/usr/share/apport/apport %p %s %c %d %P" (or dumping to /home/red/Maud/core.6550)
#
# An error report file with more information is saved as:
# /home/red/Maud/hs_err_pid6550.log
#
# If you would like to submit a bug report, please visit:
# http://bugreport.java.com/bugreport/crash.jsp
# The crash happened outside the Java Virtual Machine in native code.
# See problematic frame for where to report the bug.
#
Aborted (core dumped)