I am trying to create a new template for OMR. Find below my complete code:
public class TestOMRTemplate {
public static void main(String []a) {
OmrTemplate template = new OmrTemplate();
OmrPagesCollection pages = template.getPages();
OmrPage page = pages.get(0);
page.setWidth(215.9);
page.setHeight(279.4);
//page.
/*PointF choiceBoxPosition = new PointF(20, 5); // 20 mm to the right, 5 mm from the top
SizeF choiceBoxSize = new SizeF(5, 5); // 5x15 mm
*/
Point2D.Float p2dfloat = new Point2D.Float(20, 5);
Dimension2D.Float d2float = new Dimension2D.Float(5, 5);
ChoiceBoxElement choiceBox = new ChoiceBoxElement(“AnotherElement”, p2dfloat, d2float);
choiceBox.isHorizontal(false);
List cellList = choiceBox.getCells();
cellList.add(new OmrCell(“A”));
cellList.add(new OmrCell(“B”));
cellList.add(new OmrCell(“C”));
page.getElements().add(choiceBox);
try {
template.save(“D:\devlabs\glass\new_template.amr”);
} catch (IOException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
}
when the code calls template.save(“D:\devlabs\glass\new_template.amr”);
I get below error. Kindly check and please provide a resolution. i am using aspose-omr-1.9-jdk16 library.
Exception in thread “main” java.lang.StackOverflowError
at java.util.LinkedHashMap.access$000(Unknown Source)
at java.util.LinkedHashMap$Entry.recordAccess(Unknown Source)
at java.util.LinkedHashMap.get(Unknown Source)
at com.aspose.omr.internal.bE.a(Unknown Source)
at com.aspose.omr.internal.bE.a(Unknown Source)
at com.aspose.omr.internal.lh.a(Unknown Source)
at com.aspose.omr.internal.bM.a(Unknown Source)
at com.aspose.omr.internal.bM.a(Unknown Source)
at com.aspose.omr.internal.bM.a(Unknown Source)
at com.aspose.omr.internal.ai.(Unknown Source)
at com.aspose.omr.internal.ai.a(Unknown Source)
at com.aspose.omr.internal.co.b(Unknown Source)
at com.aspose.omr.internal.ai.b(Unknown Source)
Hi Nitesh,
- Operating System version
- Operating System Architecture (32-bit/64-bit)
- JDK/JRE version and type
Thanks for testing this out.
I am using Windows 7 professional 64 bit with Java 1.7.
I even tried creating a template from .Net Template Editor and tried to upload that template using
OmrTemplate.load(“D:\devlabs\glass\new_template.amr”);
I still end up getting java.lang.StackOverflowError.
Basically whatever operation i am doing on OmrTemplate class results in this issue. I am not sure how it worked on your system.
I just created a main class as shown in the code above and added aspose-omr-1.9-jdk16 as a referenced library.
can you tell me if i need to do anything else. Like there is a resources folder as well what is the use of that folder for OMR.
Thanks for your help i much appreciate it.
Nitesh
Hi Nitesh,
Thanks Babar for your help on this.
I am not using any licence. Can that be a issue while developing.
Hi there,
Hi Babar,
Please find below:
C:\Users>java -version
java version "1.7.0_51"
Java™ SE Runtime Environment (build 1.7.0_51-b13)
Java HotSpot™ 64-Bit Server VM (build 24.51-b03, mixed mode)
Please let me know if this is fine.
Thanks much for your help.
Nitesh
Hi Nitesh,