We're sorry Aspose doesn't work properply without JavaScript enabled.

Free Support Forum - aspose.com

A fatal error when using java 1.6, it works fine with jdk1.7

Hi ,
i am using java sdk version 1.6 and try to use aspose-cells-8.3.1.jar of product but i am getting A fatal at Java Runtime Environment like -

#
# A fatal error has been detected by the Java Runtime Environment:
#
# SIGSEGV (0xb) at pc=0x00007f05a594a233, pid=4897, tid=139662252013312
#
# JRE version: 6.0_31-b31
# Java VM: OpenJDK 64-Bit Server VM (23.25-b01 mixed mode linux-amd64 compressed oops)
# Problematic frame:
# V [libjvm.so+0x52f233] jni_CallStaticVoidMethod+0xd3
#
# 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/echasro/LAB/Chart/hs_err_pid4897.log
#
# If you would like to submit a bug report, please include
# instructions how to reproduce the bug and visit:
# https://bugs.launchpad.net/ubuntu/+source/openjdk-6/
#

And i am try to run this 1.7 version then it work fine. but i can not change my sdk.

I using this code to run -

import java.io.FileNotFoundException;
import java.io.FileOutputStream;

import com.aspose.cells.Cells;
import com.aspose.cells.Chart;
import com.aspose.cells.ChartPoint;
import com.aspose.cells.ChartPointCollection;
import com.aspose.cells.ChartType;
import com.aspose.cells.Color;
import com.aspose.cells.ImageFormat;
import com.aspose.cells.ImageOrPrintOptions;
import com.aspose.cells.Workbook;
import com.aspose.cells.Worksheet;

public class CharttoImage {

public static void main(String[] args) {


//Create a new Workbook.
Workbook workbook = new Workbook();

//Get the first worksheet.
Worksheet sheet = workbook.getWorksheets().get(0);

//Set the name of worksheet
sheet.setName(“Data”);

//Get the cells collection in the sheet.
Cells cells = workbook.getWorksheets().get(0).getCells();

//Put some values into a cells of the Data sheet.
cells.get(“A1”).setValue(“Region”);
cells.get(“A2”).setValue(“France”);
cells.get(“A3”).setValue(“Germany”);
cells.get(“A4”).setValue(“England”);
cells.get(“A5”).setValue(“Sweden”);
cells.get(“A6”).setValue(“Italy”);
cells.get(“A7”).setValue(“Spain”);
cells.get(“A8”).setValue(“Portugal”);
cells.get(“B1”).setValue(“Sale”);
cells.get(“B2”).setValue(70000);
cells.get(“B3”).setValue(55000);
cells.get(“B4”).setValue(30000);
cells.get(“B5”).setValue(40000);
cells.get(“B6”).setValue(35000);
cells.get(“B7”).setValue(32000);
cells.get(“B8”).setValue(10000);

//Create chart
int chartIndex = sheet.getCharts().add(ChartType.COLUMN, 12, 1, 33, 12);
Chart chart = sheet.getCharts().get(chartIndex);

//Set properties of chart title
chart.getTitle().setText(“Sales By Region”);
chart.getTitle().getTextFont().setBold(true);
chart.getTitle().getTextFont().setSize(12);

//Set properties of nseries
chart.getNSeries().add(“Data!B2:B8”, true);
chart.getNSeries().setCategoryData(“Data!A2:A8”);

//Set the fill colors for the series’s data points (France - Portugal(7 points))
ChartPointCollection chartPoints = chart.getNSeries().get(0).getPoints();

ChartPoint point = chartPoints.get(0);
point.getArea().setForegroundColor(Color.getCyan());

point = chartPoints.get(1);
point.getArea().setForegroundColor(Color.getBlue());

point = chartPoints.get(2);
point.getArea().setForegroundColor(Color.getYellow());

point = chartPoints.get(3);
point.getArea().setForegroundColor(Color.getRed());

point = chartPoints.get(4);
point.getArea().setForegroundColor(Color.getBlack());

point = chartPoints.get(5);
point.getArea().setForegroundColor(Color.getGreen());

point = chartPoints.get(6);
point.getArea().setForegroundColor(Color.getMaroon());

//Set the legend invisible
chart.setShowLegend(false);

//Get the Chart image
ImageOrPrintOptions imgOpts = new ImageOrPrintOptions();
imgOpts.setImageFormat(ImageFormat.getPng());

//Save the chart image file.
try {
chart.toImage(new FileOutputStream("/home/echasro/LAB/Chart/images/MyChartImage.png"), imgOpts);
} catch (FileNotFoundException e) {
// TODO Auto-generated catch block
e.printStackTrace();
} catch (Exception e) {
// TODO Auto-generated catch block
e.printStackTrace();
}



}

}


please help me.

Hi Chandan,


Thank you for contacting Aspose support.

The said error (SIGSEGV (0xb)) is caused due to some bug in the OpenJDK 1.6 and has nothing to do with Aspose.Cells for Java API. If you search internet for this error message, you will find hundreds of discussions where people are complaining about this error, and they are not using the Aspose.Cells for Java API in their applications. I have gone through most of such discussions to find a solution, and it is to upgrade the JDK to more recent revisions. As you have already checked that upgrading to JDK1.7 has resolved the problem so it seems to be the only way to avoid this problem.

Hi Chandan,

Thanks for your posting and using Aspose.Cells.

For this issue, you can also try following JVM options to test whether it
can work with your current JDK:
java.awt.headless=true
Or
Aspose.Cells.Disable=SunFontManager