I'm trying to code an opengl renderer with lwjgl. To open the window, I'm using glfw. However, when I call glfwCreateWindow, it crashes with this error:
A fatal error has been detected by the Java Runtime Environment:
SIGSEGV (0xb) at pc=0x00007fff2d732924, pid=64615, tid=775
JRE version: Java(TM) SE Runtime Environment (14.0.2+12) (build 14.0.2+12-46)
Java VM: Java HotSpot(TM) 64-Bit Server VM (14.0.2+12-46, mixed mode, sharing, tiered, compressed oops, g1 gc, bsd-amd64)
Problematic frame:
C [HIToolbox+0x27924] _ZNK22THIThemeTextInfoFinder10GetOptionsEv+0x8
No core dump will be written. Core dumps have been disabled. To enable core dumping, try "ulimit -c unlimited" before starting Java again
An error report file with more information is saved as:
/Users/vic/eclipse-workspace/Engine/hs_err_pid64615.log
If you would like to submit a bug report, please visit:
https://bugreport.java.com/bugreport/crash.jsp
Here is my code:
package main;
import org.lwjgl.glfw.GLFW;
import org.lwjgl.glfw.GLFWVidMode;
public class Main {
public static void main(String[] args) {
if(!GLFW.glfwInit()) {
System.err.println("Failed to initialize glfw");
System.exit(-1);
}
GLFW.glfwDefaultWindowHints();
GLFW.glfwWindowHint(GLFW.GLFW_VISIBLE, GLFW.GLFW_FALSE);
GLFW.glfwWindowHint(GLFW.GLFW_RESIZABLE, GLFW.GLFW_TRUE);
long window = GLFW.glfwCreateWindow(640, 480, "My window", 0, 0);
if(window == 0) {
System.err.println("Failed to create window");
System.exit(-1);
}
GLFWVidMode videoMode = GLFW.glfwGetVideoMode(GLFW.glfwGetPrimaryMonitor());
GLFW.glfwSetWindowPos(window, (videoMode.width() - 640) / 2, (videoMode.height() - 480) / 2);
GLFW.glfwShowWindow(window);
while(!GLFW.glfwWindowShouldClose(window)) {
GLFW.glfwPollEvents();
}
GLFW.glfwTerminate();
}
}
I'm using mac and eclipse.
Thanks!
The solution is to add -XstartOnFirstThread to the JVM arguments.
Related
I'm trying to get into Vulkan with LWJGL.
Currently I'm creating some sort of window (wrapper) class, however whenever i try to invoke glfwGetWindowSize, glfwGetWindowPos or glfwGetMonitorPos the program crashes with a segmentation fault. The window creation itself works fine though, and i can also move the window programatically. I use default window hints (glfwDefaultWindowHints).
The code:
var wbuf = IntBuffer.allocate(1);
var hbuf = IntBuffer.allocate(1);
glfwGetWindowSize(this.handle, wbuf, hbuf);
this.width = wbuf.get();
this.height = hbuf.get();
# A fatal error has been detected by the Java Runtime Environment:
#
# SIGSEGV (0xb) at pc=0x00007f29938156b5, pid=13791, tid=13797
#
# JRE version: OpenJDK Runtime Environment Temurin-17.0.5+8 (17.0.5+8) (build 17.0.5+8)
# Java VM: OpenJDK 64-Bit Server VM Temurin-17.0.5+8 (17.0.5+8, mixed mode, sharing, tiered, compressed oops, compressed class ptrs, g1 gc, linux-amd64)
# Problematic frame:
# C [libglfw.so+0x156b5] glfwGetWindowSize+0x5
Environment: LWJGL v3.3.1 (with GLFW linux natives), Vulkan SDK v1.3.236.0 x86_64, Java 17 (Temurin), Fedora 36
As a side note: I'm also applying class loader tweaks before the GLFW init.
I was using non-direct buffers, while the LWJGL GLFW bidings only support direct ones.
Using direct buffers works fine:
try (var stack = MemoryStack.stackPush()) {
var width = stack.mallocInt(1);
var height = stack.mallocInt(1);
glfwGetWindowSize(this.handle, width, height);
this.width = width.get();
this.height = height.get();
}
MemoryUtil.memAllocInt(1) and ByteBuffer.allocateDirect(4).asIntBuffer() works as well.
1 - I downloaded tesdata on the git hub https://github.com/tesseract-ocr/tessdata
2 - Extract the folder and passed the path to the Tesseract class
3 - When running the application the following error is displayed
Extract the folder and passed the path to the Tesseract class
When running the application the following error is displayed
Code snippet executed
public class TesseractOcrTest {
private final String tesseractPath = "/home/tessdata/";
#Test
public void shouldReturnTrueIfRunOcrEquals() throws Exception {
String result = new TesseractOcr(tesseractPath).runOcr("bw_HighResolution_en.jpeg").trim();
assertEquals(
"Optical Character Recognition in Java\nis made easy with the help of Tesseract", result);
}
}
Error
Error: Illegal Parameter specification!
"Fatal error encountered!" == NULL:Error:Assert failed:in file globaloc.cpp, line 75
#
# A fatal error has been detected by the Java Runtime Environment:
#
# SIGSEGV (0xb) at pc=0x00007f52a582d69b, pid=8957, tid=8966
#
# JRE version: OpenJDK Runtime Environment (11.0.7+10) (build 11.0.7+10-post-Ubuntu-2ubuntu218.04)
# Java VM: OpenJDK 64-Bit Server VM (11.0.7+10-post-Ubuntu-2ubuntu218.04, mixed mode, sharing, tiered, compressed oops, g1 gc, linux-amd64)
# Problematic frame:
# C [libtesseract.so.4+0x25969b] ERRCODE::error(char const*, TessErrorLogCode, char const*, ...) const+0x16b
Note: When I change the path from tesdata to the OS installation path (private final String tesseractPath = "/usr/share/tesseract-ocr/4.00/tessdata/";) I can do it perfectly. It just doesn't work if I point to the tesdata downloaded from the git hub.
What am I doing wrong? When downloaded from github do you need to do any more configuration?
You've probably used incompatible language data. For the current Tesseract verion, use tessdata_best or tessdata_fast, which comes with Linux distros. (You can verify by checking the file size.)
https://github.com/tesseract-ocr
Make sure you have installed only one version of tesseract
Fist check with version of tesseract you used (installed). Use the latest version (4.x or 5 alpha)
Test OCR with tesseract executable instead of wrapper - it can provide more information for finding problem.
While executing the following line my server halted for the second request.
Invocable invocableEngine = load();
Object o1 = invocableEngine.invokeFunction("add",5,6,jsonObj);
private static Invocable invocable =null;
public static Invocable load() throws ScriptException, NoSuchMethodException, FileNotFoundException {
if(invocable!=null){
return invocable;
}
File jsFile = new File("test.js");
ScriptEngineManager manager = new ScriptEngineManager();
ScriptEngine engine = manager.getEngineByName("jav8"); //No I18N
Reader reader = new FileReader(jsFile);
engine.eval(reader);
invocable = (Invocable) engine;
return invocable;
}
test.js
add = function(a, b) {
return a + b;
}
I dont want to evaluate the js for each request, so that i used the Invocable as static.
This is the error thrown in the console
A fatal error has been detected by the Java Runtime Environment:
SIGSEGV (0xb) at pc=0x0000000121d6f4b4, pid=791, tid=33539
JRE version: Java(TM) SE Runtime Environment (8.0_25-b17) (build
1.8.0_25-b17) Java VM: Java HotSpot(TM) 64-Bit Server VM (25.25-b02 mixed mode bsd-amd64 compressed oops) Problematic frame: C
[libjav8651059438244345661.dylib+0x184b4]
_ZN2v811HandleScopeC1Ev+0x84
Failed to write core dump. Core dumps have been disabled. To enable
core dumping, try "ulimit -c unlimited" before starting Java again
An error report file with more information is saved as:
hs_err_pid791.log
If you would like to submit a bug report, please visit:
http://bugreport.sun.com/bugreport/crash.jsp The crash happened
outside the Java Virtual Machine in native code. See problematic
frame for where to report the bug.
I'm trying to make JCEF to work in a swingNode in a simple JavaFX Application
public class MainApp extends Application {
#Override
public void start(Stage stage) throws Exception {
SwingNode swingNode = new SwingNode();
SwingUtilities.invokeAndWait(() -> {
String startURL = "https://www.google.com/";
boolean useOSR = OS.isLinux();
boolean isTransparent = false;
CefSettings settings = new CefSettings();
settings.windowless_rendering_enabled = useOSR;
CefApp cefApp_ = CefApp.getInstance(settings);
CefClient client_ = cefApp_.createClient();
CefBrowser browser_ = client_.createBrowser(startURL, useOSR, isTransparent);
Component browerUI_ = browser_.getUIComponent();
JPanel panel = new JPanel();
panel.setSize(800, 600);
panel.add(browerUI_, BorderLayout.CENTER);
swingNode.setContent(panel);
});
stage.setScene(new Scene(new javafx.scene.Group(swingNode)));
stage.show();
}
public static void main(String[] args) {
launch(args);
}
I'm getting a fatal error at client_.createBrowser(startURL, useOSR, isTransparent);
initialize on Thread[AWT-EventQueue-0,6,main] with library path /path/to/jcef/lib/linux64
#
# A fatal error has been detected by the Java Runtime Environment:
#
# SIGSEGV (0xb) at pc=0x00007f3d07fced50, pid=22843, tid=0x00007f3ca5991700
#
# JRE version: Java(TM) SE Runtime Environment (8.0_111-b14) (build 1.8.0_111-b14)
# Java VM: Java HotSpot(TM) 64-Bit Server VM (25.111-b14 mixed mode linux-amd64 compressed oops)
# Problematic frame:
# C [ld-linux-x86-64.so.2+0x9d50]
#
# Failed to write core dump. Core dumps have been disabled. To enable core dumping, try "ulimit -c unlimited" before starting Java again
#
# An error report file with more information is saved as:
# /path/to/jcef-javafx-maven/hs_err_pid22843.log
#
# If you would like to submit a bug report, please visit:
# http://bugreport.java.com/bugreport/crash.jsp
#
however, the provided JCEF awt test examples runs perfectly.
JCEF Version = 3.2840.147
CEF Version = 3.2840.1511
Chromium Version = 54.0.2840.59
Oracle JDK version = 1.8.0_111
edit1: digging into the jcef java code, the fatal error happens at CefBrowserOsr.java line 134
private void createGLCanvas() {
GLProfile glprofile = GLProfile.getMaxFixedFunc(true); // here
edit2: error log hs_err_pid.log content.
Upgrading to JOGL 2.3.2 and rebuilding JCEF again partially fixes the problem (no jvm crash happens anymore)
however, it seems that the SwingNode would not render a very complicated stuff like a GLCanvas, reference.
thanks before i have a problem with my project, my project are make apps in android then the Apps can connect to database in my company but this isn't connect
This is my script
package mas.ganteng;
import java.sql.Connection;
import java.sql.DriverManager;
import java.sql.SQLException;
import java.util.logging.Level;
import java.util.logging.Logger;
/**
*
* #author Mas Ganteng Indonesia
*/
public class ConnectedAccessActivity {
Connection conn;
String url="jdbc:odbc:JavaMsAccess";
String user="";
String pass="";
public Connection getConnection(){
try {
Class.forName("sun.jdbc.odbc.JdbcOdbcDriver");
conn=DriverManager.getConnection(url,user,pass);
System.out.println("Connected!!!");
} catch (SQLException ex) {
Logger.getLogger(ConnectedAccessActivity.class.getName()).log(Level.SEVERE, null, ex);
} catch (ClassNotFoundException ex) {
Logger.getLogger(ConnectedAccessActivity.class.getName()).log(Level.SEVERE, null, ex);
}
return conn;
}
public static void main(String [] args){
ConnectedAccessActivity acc=new ConnectedAccessActivity();
acc.getConnection();
}
}
and it's the console in eclipse
Invalid layout of java.lang.String at value
#
# A fatal error has been detected by the Java Runtime Environment:
#
# Internal Error (javaClasses.cpp:124), pid=3848, tid=3876
# fatal error: Invalid layout of preloaded class
#
# JRE version: (8.0-b104) (build )
# Java VM: Java HotSpot(TM) Client VM (25.0-b46 mixed mode windows-x86 )
# 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:
# D:\My Android\ConnectedAccess\hs_err_pid3848.log
#
# If you would like to submit a bug report, please visit:
# http://bugreport.sun.com/bugreport/crash.jsp
#
Can you help me about this bug?????
Invalid layout of java.lang.String at value
You're trying to run an Android app as a regular Java program. Run Android apps on an Android emulator or an actual device.
The code looks like it's just a regular Java program. You should remove the Android libraries from it to be able to run it as Java.