繁体   English   中英

Eclipse IDE / Jpasskit无法配置

[英]Eclipse IDE/Jpasskit not able to configure

我最近开始为我的新项目之一使用Java开发人员的Eclipse IDE,我必须为我的iPhone项目配置Jpasskit 我创建了新的test.java文件。

蚀项目资源管理器:

在此处输入图片说明

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!");
}
}

每当我运行此代码作为应用程序时,我都会收到此错误。 在此处输入图片说明

我不知道我在做什么错?

我不确定我是否导入了项目权限..或classpth问题。 或我的样本成绩有问题。

您安装了蚂蚁吗? 是否设置了ANT_HOME,CLASSPATH和JAVA_HOME? JAVA_HOME是否与您的项目使用的jdk相同?

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM