【问题标题】:Eclipse IDE/Jpasskit not able to configureEclipse IDE/Jpasskit 无法配置
【发布时间】:2017-01-12 15:16:20
【问题描述】:

刚开始在我的一个新项目中使用 Eclipse IDE for Java Developers 我必须为我的 iphone 项目配置 Jpasskit。我创建了新的 test.java 文件。

eclipse 项目浏览器:

public static void main(String [ ] args)
{

    String appleWWDRCA = "passbook/AppleWWDRCA.pem"; // this is apple's developer relation cert
    String privateKeyPath = "./privateKey.p12"; // the private key you exported from keychain
    String privateKeyPassword = "password"; // the password you used to export
    try {

    PKSigningInformation pkSigningInformation = PKSigningUtil.
            loadSigningInformationFromPKCS12FileAndIntermediateCertificateFile(
            privateKeyPath, privateKeyPassword, appleWWDRCA);

    PKPass pass = new PKPass();
    pass.setPassTypeIdentifier("pass.com.yourdomain.type");
    pass.setAuthenticationToken("vxwxd7J8AlNNFPS8k0a0FfUFtq0ewzFdc");
    pass.setSerialNumber("12345678000");
    pass.setTeamIdentifier("abcdefg"); // replace this with your team ID
    pass.setOrganizationName("your org");
    pass.setDescription("some description");
    pass.setLogoText("some logo text");

    PKBarcode barcode = new PKBarcode();
    barcode.setFormat(PKBarcodeFormat.PKBarcodeFormatPDF417);
    barcode.setMessageEncoding(Charset.forName("iso-8859-1"));
    barcode.setMessage("123456789");
    pass.setBarcode(barcode);

    PKGenericPass generic = new PKGenericPass();
    List<PKField> primaryFields = new ArrayList<PKField>();
    PKField member = new PKField();
    member.setKey("mykey"); // some unique key for primary field
    member.setValue("myvalue"); // some value
    primaryFields.add(member);
    generic.setPrimaryFields(primaryFields);
    pass.setGeneric(generic);

    PKLocation location = new PKLocation();
    location.setLatitude(37.33182); // replace with some lat
    location.setLongitude(-122.03118); // replace with some long
    List<PKLocation> locations = new ArrayList<PKLocation>();
    locations.add(location);
    pass.setLocations(locations);

    if (pass.isValid()) {
        String pathToTemplateDirectory = "./mypass.raw"; // replace with your folder with the icons
        byte[] passZipAsByteArray = PKSigningUtil.
                createSignedAndZippedPkPassArchive(pass, pathToTemplateDirectory, pkSigningInformation);

        String outputFile = "./mypass.pkpass"; // change the name of the pass
        ByteArrayInputStream inputStream = new ByteArrayInputStream(passZipAsByteArray);
        IOUtils.copy(inputStream, new FileOutputStream(outputFile));
        System.out.println("Done!");
    } else {
        System.out.println("the pass is NOT Valid man!!!");
    }
} catch (Exception e) {
    e.printStackTrace();
    System.out.println("failed!");
}
}

当我将这个代码作为应用程序运行时,我得到了这个错误。

我不知道我做错了什么?

我不确定我是否正确导入了项目.. 或类问题。 或者我的示例课程中可能有问题。

【问题讨论】:

    标签: java ios eclipse wallet passkit


    【解决方案1】:

    你安装了ant吗? ANT_HOME、CLASSPATH 和 JAVA_HOME 设置了吗? JAVA_HOME和你项目使用的jdk一样吗?

    【讨论】:

    • no 不能用 eclipse 安装?我有单独安装吗
    猜你喜欢
    • 2017-08-09
    • 2013-08-27
    • 2011-03-28
    • 2017-05-26
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2013-04-24
    • 1970-01-01
    相关资源
    最近更新 更多