Java Eclipse IDE/Jpasskit无法配置

Java Eclipse IDE/Jpasskit无法配置,java,ios,eclipse,wallet,passkit,Java,Ios,Eclipse,Wallet,Passkit,新开始使用EclipseIDEforJava开发人员为我的一个新项目,我必须为我的iphone项目进行配置。我创建了新的test.java文件 eclipse项目浏览器: publicstaticvoidmain(字符串[]args) { 字符串appleWWDRCA=“passbook/appleWWDRCA.pem”;//这是苹果的开发者关系证书 字符串privateKeyPath=“./privateKey.p12”;//从keychain导出的私钥 String privateKeyP

新开始使用EclipseIDEforJava开发人员为我的一个新项目,我必须为我的iphone项目进行配置。我创建了新的test.java文件

eclipse项目浏览器:

publicstaticvoidmain(字符串[]args)
{
字符串appleWWDRCA=“passbook/appleWWDRCA.pem”;//这是苹果的开发者关系证书
字符串privateKeyPath=“./privateKey.p12”;//从keychain导出的私钥
String privateKeyPassword=“password”;//用于导出的密码
试一试{
PKSigningInformation PKSigningInformation=PKSigningUtil。
从PKCS12文件和IntermediateCertificateFile加载签名信息(
privateKeyPath、privateKeyPassword、appleWWDRCA);
PKPass=新的PKPass();
pass.setPassTypeIdentifier(“pass.com.yourdomain.type”);
pass.setAuthenticationToken(“vxwxd7J8AlNNFPS8k0a0FfUFtq0ewzFdc”);
通过设置序列号(“12345678000”);
pass.settamidentifier(“abcdefg”);//将其替换为您的团队ID
pass.setOrganizationName(“您的组织”);
pass.setDescription(“某些描述”);
pass.setLogoText(“某些徽标文本”);
PKBarcode条码=新的PKBarcode();
条形码.setFormat(PKBarcodeFormat.PKBarcodeFormatPDF417);
条形码.setMessageEncoding(Charset.forName(“iso-8859-1”);
条形码.setMessage(“123456789”);
通过设定码(条形码);
PKGenericPass generic=新的PKGenericPass();
List primaryFields=new ArrayList();
PKField成员=新的PKField();
member.setKey(“mykey”);//主字段的某个唯一键
member.setValue(“myvalue”);//一些值
添加(成员);
generic.setPrimaryFields(primaryFields);
pass.setGeneric(generic);
PKLocation location=新的PKLocation();
location.setLatitude(37.33182);//替换为一些lat
location.setLongitude(-122.03118);//替换为一些长的
列表位置=新的ArrayList();
位置。添加(位置);
通过设置位置(位置);
if(pass.isValid()){
String pathToTemplateDirectory=“./mypass.raw”;//用图标替换为您的文件夹
字节[]passZipAsByteArray=PKSigningUtil。
createSignedAndZippedPkPassArchive(pass、pathToTemplateDirectory、pkSigningInformation);
String outputFile=“./mypass.pkpass”;//更改过程的名称
ByteArrayInputStream inputStream=新的ByteArrayInputStream(passZipAsByteArray);
复制(inputStream,新文件OutputStream(outputFile));
System.out.println(“完成!”);
}否则{
System.out.println(“通行证无效!!!”;
}
}捕获(例外e){
e、 printStackTrace();
System.out.println(“失败!”);
}
}
当我以应用程序的形式运行此代码时,我收到了此错误。

我不知道我做错了什么

我不确定我导入的项目是否正确。。 或第pth类问题。
或者我的示例计算中可能有问题。

是否安装了ant?ANT_HOME、CLASSPATH和JAVA_HOME是否已设置?JAVA_HOME与您的项目使用的jdk相同吗?

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