AndreasFagschlunger / O2Xfs

Java API for accessing CEN/XFS API, EMV Level 2 Kernel
47 stars 28 forks source link

How to build in java 7 #48

Closed sunyuyangg123 closed 7 years ago

sunyuyangg123 commented 7 years ago

I want to build with java 7 as the client system is XP, but I can not build when I set "org.gradle.java.home = java7". What should I do ?

AndreasFagschlunger commented 7 years ago

Hi @sunyuyangg123

java7 doesn't seem to be a full path like C:/Program Files (x86)/Java/jdk1.7.0? Also Oracle doesn't give support on Windows XP, but you're free to install it anyway. So this may be the easier solution.

sunyuyangg123 commented 7 years ago

yes, java7 is the full path.

this is the gradle log:

           ^

符号: 类 Optional 位置: 程序包 java.util E:\workspace\O2Xfs\o2xfs-xfs3\src\o2xfs-xfs3\java\at\o2xfs\xfs\cdm\v3_00\ItemPosition3.java:78: 错误: 找不到符号 public Optional getRetractArea() { ^ 符号: 类 Optional 位置: 类 ItemPosition3 E:\workspace\O2Xfs\o2xfs-xfs3\src\o2xfs-xfs3\java\at\o2xfs\xfs\cdm\v3_00\CashUnitError3.java:30: 错误: 找不到符号 import java.util.Optional; ^ 符号: 类 Optional 位置: 程序包 java.util E:\workspace\O2Xfs\o2xfs-xfs3\src\o2xfs-xfs3\java\at\o2xfs\xfs\cdm\v3_00\CashUnitError3.java:74: 错误: 找不到符号 public Optional getCashUnit() { ^ 符号: 类 Optional 位置: 类 CashUnitError3 E:\workspace\O2Xfs\o2xfs-xfs3\src\o2xfs-xfs3\java\at\o2xfs\xfs\cdm\v3_00\Denomination3.java:31: 错误: 找不到符号 import java.util.Optional; ^ 符号: 类 Optional 位置: 程序包 java.util E:\workspace\O2Xfs\o2xfs-xfs3\src\o2xfs-xfs3\java\at\o2xfs\xfs\cdm\v3_00\Denomination3.java:137: 错误: 找不到符号 public Optional<long[]> getValues() { ^ 符号: 类 Optional 位置: 类 Denomination3 E:\workspace\O2Xfs\o2xfs-xfs3\src\o2xfs-xfs3\java\at\o2xfs\xfs\cdm\v3_00\Denomination3.java:49: 错误: 找不到符号 private Optional<long[]> values = Optional.empty(); ^ 符号: 类 Optional 位置: 类 Builder E:\workspace\O2Xfs\o2xfs-xfs3\src\o2xfs-xfs3\java\at\o2xfs\xfs\cim\v3_00\CashIn3.java:31: 错误: 找不到符号 import java.util.Optional; ^ 符号: 类 Optional 位置: 程序包 java.util E:\workspace\O2Xfs\o2xfs-xfs3\src\o2xfs-xfs3\java\at\o2xfs\xfs\cim\v3_00\CashIn3.java:164: 错误: 找不到符号 public Optional getNoteNumberList() { ^ 符号: 类 Optional 位置: 类 CashIn3 E:\workspace\O2Xfs\o2xfs-xfs3\src\o2xfs-xfs3\java\at\o2xfs\xfs\cim\v3_00\P6Info3.java:30: 错误: 找不到符号 import java.util.Optional; ^ 符号: 类 Optional 位置: 程序包 java.util E:\workspace\O2Xfs\o2xfs-xfs3\src\o2xfs-xfs3\java\at\o2xfs\xfs\cim\v3_00\P6Info3.java:78: 错误: 找不到符号 public Optional getNoteNumberList() { ^ 符号: 类 Optional 位置: 类 P6Info3 E:\workspace\O2Xfs\o2xfs-xfs3\src\o2xfs-xfs310\java\at\o2xfs\xfs\cdm\v3_10\CashUnitError3_10.java:30: 错误: 找不到符号 import java.util.Optional; ^ 符号: 类 Optional 位置: 程序包 java.util E:\workspace\O2Xfs\o2xfs-xfs3\src\o2xfs-xfs310\java\at\o2xfs\xfs\cdm\v3_10\CashUnitError3_10.java:67: 错误: 找不到符号 public Optional getCashUnit() { ^ 符号: 类 Optional 位置: 类 CashUnitError3_10 E:\workspace\O2Xfs\o2xfs-xfs3\src\o2xfs-xfs310\java\at\o2xfs\xfs\cim\v3_10\ItemInfo3_10.java:30: 错误: 找不到符号 import java.util.Optional; ^ 符号: 类 Optional 位置: 程序包 java.util E:\workspace\O2Xfs\o2xfs-xfs3\src\o2xfs-xfs310\java\at\o2xfs\xfs\cim\v3_10\ItemInfo3_10.java:81: 错误: 找不到符号 public Optional getSerialNumber() { ^ 符号: 类 Optional 位置: 类 ItemInfo3_10 E:\workspace\O2Xfs\o2xfs-xfs3\src\o2xfs-xfs310\java\at\o2xfs\xfs\cim\v3_10\ItemInfo3_10.java:89: 错误: 找不到符号 public Optional getP6Signature() { ^ 符号: 类 Optional 位置: 类 ItemInfo3_10 E:\workspace\O2Xfs\o2xfs-xfs3\src\o2xfs-xfs310\java\at\o2xfs\xfs\cim\v3_10\P6SignaturesIndex3_10.java:30: 错误: 找不到符号 import java.util.Optional; ^ FAILURE: Build failed with an exception.

Class Optional is the java 8 Class so I can not build in java 7 .

sunyuyangg123 commented 7 years ago

Thank you very much for your reply! I have installed Java8 on XP now.It would be better to use Java7!

AndreasFagschlunger commented 7 years ago

The java.util.Optional class was added in Java 8, since you compile with Java 7 it will obviously fail. You have to fork and rewrite some code to be compatible with Java 7. See Issue #33 for an example on how Optional could be written in Java 7.