首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >Java无法创建java虚拟机

Java无法创建java虚拟机
EN

Stack Overflow用户
提问于 2020-09-27 09:25:07
回答 1查看 3.1K关注 0票数 0

嗨,我当时正试着在“锻造”下编写一个“我的世界”发射器的代码,我得到了一个错误:

代码语言:javascript
复制
[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.

这是我的代码:

代码语言:javascript
复制
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下

EN

回答 1

Stack Overflow用户

发布于 2020-09-27 14:11:44

这看起来并不是关于您的启动程序,而是关于JVM正在传递一个它无法处理的参数。您的程序通常是这样加载的:

  • 您的程序执行代码
  • JVM是一个环境,其中您的程序被执行
  • 操作系统是JVM被执行的环境

目前您的代码没有一个被执行,因为要执行它的JVM无法自行执行。

重申一下,结构是这样的:

OS > JVM > JAR

您目前正在研究这一部分:

OS > JVM > JAR

你应该看看这部分:

OS > JVM > JAR

正如@ JVM 1所述,当前一个参数CMSIncrementalMode作为参数传递给您的JVM。它无法处理这一论点,并拒绝参选。您的代码都不会被执行。您可以从错误消息中派生出这一点:

代码语言:javascript
复制
Unrecognized VM option 'CMSIncrementalMode'

Error: Could not create the Java Virtual Machine.
票数 0
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/64086889

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档