Yonex
Yonex

Reputation: 87

Java: Eclipse crashes(linux)

I am using eclipse 4.6.3 and ubuntu Budge(17.04)

I am trying to call a method from another class. In that method I have done some opencv task. But whenever I tried to call and compile, it shows this message.

# A fatal error has been detected by the Java Runtime Environment:
#
#  SIGSEGV (0xb) at pc=0x00007f711102daf7, pid=7567, tid=0x00007f70b010d700
#
# JRE version: OpenJDK Runtime Environment (8.0_131-b11) (build 1.8.0_131-8u131-b11-2ubuntu1.17.04.3-b11)
# Java VM: OpenJDK 64-Bit Server VM (25.131-b11 mixed mode linux-amd64 compressed oops)
# Problematic frame:
# V  [libjvm.so+0x67daf7]  jni_GetStringUTFChars+0x87
#
# 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:
# /home/aritra/workspace/ProjectHetero/hs_err_pid7567.log
#
# If you would like to submit a bug report, please visit:
#   http://bugreport.java.com/bugreport/crash.jsp

And methods I am calling are

public  static String FaceDetection(String Path) {

        System.loadLibrary(Core.NATIVE_LIBRARY_NAME);
        String file=Path;
        Mat src = Imgcodecs.imread(file);
        //instamting classifier
        //String xmlFile="/home/aritra/opencv-3.2.0/data/lbpcascade_frontalface.xml";
        CascadeClassifier classsifier= new CascadeClassifier();
        classsifier.load("haarcascade_frontalface_alt.xml");
    try {


        //detecting face
        MatOfRect faceDetections= new MatOfRect();
        classsifier.detectMultiScale(src, faceDetections);
        //System.out.println(String.format("Detected %s faces",faceDetections.toArray().length));
        for(Rect rect : faceDetections.toArray()){

            Imgproc.rectangle(src,
                    new Point(rect.x,rect.y),
                    new Point(rect.x+rect.width,rect.y+rect.height),
                    new Scalar(0,0,255),
                    3);
        }
            Imgcodecs.imwrite("/home/aritra/workspace/ProjectHetero/Output/OutputPic652.jpg",src);
            //System.out.println("Image Processesd");
        //  File picture= new File("/home/aritra/workspace/oopencv/picture/outputPic652.jpg");
        //  open(picture);

    }
    catch (Exception e) {
        // TODO: handle exception
    }
        String OutputPath ="/home/aritra/workspace/ProjectHetero/Output/OutputPic652.jpg";
        return(OutputPath);

    }


 public static void open(File document) throws IOException {
    Desktop dt = Desktop.getDesktop();
    if(Desktop.isDesktopSupported()){
        new Thread(()-> {
            try {
                dt.open(document);
            } catch (IOException e) {
                // TODO Auto-generated catch block
                e.printStackTrace();
            }
        }).start();  

    }

    }

I have checked my method separately. It works fine. I have also checked previous questions asked on this same issue and changed in config.ini file by adding this. Eclipse continue crashing

org.eclipse.swt.browser.DefaultType=mozilla
org.eclipse.swt.browser.XULRunnerPath=/home/aritra/Desktop/XUL RUNNER/xulrunner

But still showing this message. I have find out that this message appears only when I am calling those methods. Unable to understand where the problem is. Can some one help me please??

Upvotes: 2

Views: 135

Answers (1)

Yonex
Yonex

Reputation: 124

According to you the problem is occurring whenever you call the method. right? So I have checked your method open() and FaceDetection() it seems fine to me. But I think whenever you are calling these methods you are passing wrong parameters. I guess you are passing null.Thats why you r getting this message. Will you check it again?

Upvotes: 1

Related Questions