gpt4 book ai didi

java - Eclipse Mars 2 jvm 崩溃

转载 作者:行者123 更新时间:2023-12-03 03:02:25 27 4
gpt4 key购买 nike

我不知道出了什么问题!我正在尝试运行简单的套接字通信。我正在使用 Eclipse Mars 2,顺便说一句,当我尝试运行 Junit 测试时,它会在 Debug模式下兑现并退出!我不知道为什么!

#
# A fatal error has been detected by the Java Runtime Environment:
#
# EXCEPTION_ACCESS_VIOLATION (0xc0000005) at pc=0x739ac3e1, pid=2144, tid=0x0000182c
#
# JRE version: Java(TM) SE Runtime Environment (8.0_111-b14) (build 1.8.0_111-b14)
# Java VM: Java HotSpot(TM) Client VM (25.111-b14 mixed mode, sharing windows-x86 )
# Problematic frame:
# C [chtbrkg.dll+0x1c3e1]
#
# Failed to write core dump. Minidumps are not enabled by default on client versions of Windows
#
# An error report file with more information is saved as:
# C:\Users\User.ASUS\Documents\eclipse\workspace\Sockets\hs_err_pid2144.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.
#

我在服务器上收到上述错误消息,在客户端上收到 java.util.NoSuchElementException !正是当我尝试从服务器获取结果时(在 Client.java 中 temp = Scanner2.nextInt(); )

服务器类

package main;

import java.io.IOException;
import java.io.PrintStream;
import java.net.ServerSocket;
import java.net.Socket;
import java.util.Scanner;

public class Server {

public static void main(String[] args) throws IOException {
ServerSocket serverSocket = new ServerSocket(1234);
System.out.println("Waiting for the client...");
Socket socket = serverSocket.accept();
System.out.println("Client connected");
Scanner scanner = new Scanner(socket.getInputStream());
int number = scanner.nextInt();
int temp = number * 2;
PrintStream printStream = new PrintStream(socket.getOutputStream());
printStream.println(temp);
}

}

客户端类

package main;

import java.io.IOException;
import java.io.PrintStream;
import java.net.Socket;
import java.net.UnknownHostException;
import java.util.Scanner;

public class Client {

public static void main(String[] args) throws UnknownHostException, IOException {
int number, temp = 0;
Scanner scanner = new Scanner(System.in); // to read input from user
Socket socket = new Socket("127.0.0.1", 1234);
Scanner scanner2 = new Scanner(socket.getInputStream()); // used to accept results from the server
System.out.println("Enter any number");
number = scanner.nextInt();
PrintStream printStream = new PrintStream(socket.getOutputStream());
printStream.println(number); // send the number to the server
temp = scanner2.nextInt();
System.out.println(temp);
}

}

最佳答案

崩溃发生在 chtbrkg.dll 库内,该库不属于 Java、Eclipse Mars 或 Windows。我真的不知道 chtbrkg.dll 是什么(谷歌搜索表明它是 AdSkip 软件的一部分),但这显然是您 PC 上第三方软件的问题。

关于java - Eclipse Mars 2 jvm 崩溃,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/41048838/

27 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com