如何解决Java无法创建Java虚拟机
嗨,我试图在伪造下编写一个我的世界发射器代码,但出现此错误:
[OpenLauncherLib] Launching minecraft
[OpenLauncherLib] Successfully launched
Java HotSpot(TM) 64-Bit Server VM warning: Option UseConcmarkSweepGC was
deprecated in version 9.0 and will likely be removed in a future release.
Unrecognized VM option 'CMSIncrementalMode'
Error: Could not create the Java Virtual Machine.
Error: A fatal exception has occurred. Program will exit.
这是我的代码:
public class Launcher {
public static final GameVersion SC_VERSION = new GameVersion("1.7.10",GameType.V1_7_10);
public static final GameInfos SC_INFOS = new GameInfos("Lunaria",SC_VERSION,true,new GameTweak[] {GameTweak.FORGE});
public static final File SC_DIR = SC_INFOS.getGameDir();
private static AuthInfos authInfos;
private static Thread updateThread;
public static void auth(String username,String password) throws AuthenticationException{
Authenticator authentificator = new Authenticator(Authenticator.MOJANG_AUTH_URL,AuthPoints.norMAL_AUTH_POINTS);
AuthResponse response = authentificator.authenticate(AuthAgent.mineCRAFT,username,password,"");
authInfos = new AuthInfos(response.getSelectedProfile().getName(),response.getAccesstoken(),response.getSelectedProfile().getId());
}
public static void update() throws Exception {
SUpdate su = new SUpdate("https://launcherpanel.000webhostapp.com/",SC_DIR);
su.addApplication(new FileDeleter());
updateThread = new Thread() {
private int val;
private int max;
@Override
public void run() {
while(!this.isInterrupted()) {
if(BaraPI.getNumberOfFiletoDownload() == 0){
LauncherFrame.getInstance().getLauncherPanel().setInfoText("Verification des fichers...");
continue;
}
val = (int) (BaraPI.getNumberOfTotalDownloadedBytes() / 1000);
max = (int) (BaraPI.getNumberOfTotalBytesTodownload() / 1000);
LauncherFrame.getInstance().getLauncherPanel().getProgressBar().setMaximum(max);
LauncherFrame.getInstance().getLauncherPanel().getProgressBar().setValue(val);
LauncherFrame.getInstance().getLauncherPanel().setInfoText("Telechargement des fichiers... "
+ BaraPI.getNumberOfDownloadedFiles() + "/" + BaraPI.getNumberOfFiletoDownload() +
Swinger.percentage(val,max) + "%");
}
}
};
updateThread.start();
su.start();
if(updateThread != null)
updateThread.interrupt();
}
public static void launch() throws IOException {
GameLauncher gameLauncher = new GameLauncher(SC_INFOS,GameFolder.BASIC,authInfos);
Process p = gameLauncher.launch();
try {
Thread.sleep(5000L);
} catch (InterruptedException e) {
}
LauncherFrame.getInstance().setVisible(false);
try {
p.waitFor();;
} catch (InterruptedException e) {
}
System.exit(0);
}
public static void interruptThread() {
updateThread.interrupt();
}
}
感谢回答。 编辑:在Mac OS X 10.10下的即时通讯
解决方法
这似乎与启动器无关,它与JVM传递了无法处理的参数有关。您的程序通常是这样加载的:
- 您的程序执行您的代码
- JVM是在其中执行程序的环境
- 您的操作系统是执行JVM的环境
当前没有任何代码被执行,因为将在其中执行的JVM无法自身执行。
重申一下,结构如下:
OS> JVM> JAR
您当前正在看这部分:
OS> JVM> JAR
您应该关注这一部分:
OS> JVM > JAR
如@ dan1st所述,当前将参数export const modalSlice = createSlice({
name: "modal",initialState: {
current: ""
},reducers: {
hideModal: (state) => {
state.current = "";
},showModal: (state,action) => {
state.current = action.payload;
}
},// Possible solution: Works but quite messy
// and copies code from above rather than calling hideModal
extraReducers: {
[login.fulfilled]: (state,action) => {
if (action.payload.success) {
state.current = "";
}
},// Omitting rest of slice
作为参数传递给JVM。它无法处理该参数并拒绝运行。您的代码均未执行。您可以从错误消息中得出这一点:
CMSIncrementalMode
版权声明:本文内容由互联网用户自发贡献,该文观点与技术仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容, 请发送邮件至 dio@foxmail.com 举报,一经查实,本站将立刻删除。