2

I am using Netbeans IDE 8.0 and writing java code with the option classic Applet Project. Here all goes well till using the below import

package wallet;

import javacard.framework.*;
import javacard.framework.ISO7816;
import javacard.framework.Applet;
import javacard.framework.OwnerPIN;

but I wanted to use the global platform function so I download the JAR ( gpapi-globalplatform.jar) file from HERE and add like below,

enter image description here

adding new imports like below

import org.globalplatform.GPSystem;
import org.globalplatform.SecureChannel;

no error shown in IDE but during the building of code, getting the error below. Any advice here would be great.

error: export file globalplatform.exp of package org.globalplatform not found. [ INFO: ] Converter [v3.0.2]
Karma
  • 1
  • 1
  • 3
  • 9
Arjun
  • 3,491
  • 4
  • 25
  • 47

1 Answers1

0

Your found file is fine. There is a file globalplatform.exp contained in the file. You have to add the path to this file to the class path when using the Java Card converter.

Here is a configuration for Maven:

     <plugin>
                        <groupId>org.apache.maven.plugins</groupId>
                        <artifactId>maven-antrun-plugin</artifactId>
                        <version>1.7</version>
                        <executions>
                            <execution>
                                <phase>package</phase>
                                <goals>
                                    <goal>run</goal>
                                </goals>
                            </execution>
                        </executions>
                        <configuration>
                            <tasks>
                                <echo message="Converting to CAP file"/>
                                <java classname="com.sun.javacard.converter.Converter"
                                      failonerror="true" fork="true">
                                    <arg value="-verbose"/>
                                    <arg value="-classdir"/>
                                    <arg value="target/classes/"/>
                                    <arg value="-applet"/>
                                    <arg value="${javacard.applet.aid}"/>
                                    <arg value="${javacard.applet.name}"/>
                                    <arg value="${javacard.package.name}"/>
                                    <arg value="${javacard.package.aid}"/>
                                    <arg value="${javacard.major.version}.${javacard.minor.version}"/>
                                    <arg value="-nowarn"/>
                                    <classpath>
                                        <pathelement location="${jc.home}/api_export_files"/>
                                        <pathelement location="${jc.home}/lib/apduio.jar"/>
                                        <pathelement location="${jc.home}/lib/apdutool.jar"/>
                                        <pathelement location="${jc.home}/lib/jcwde.jar"/>
                                        <pathelement location="${jc.home}/lib/converter.jar"/>
                                        <pathelement location="${jc.home}/lib/scriptgen.jar"/>
                                        <pathelement location="${jc.home}/lib/offcardverifier.jar"/>
                                        <pathelement location="${jc.home}/lib/capdump.jar"/>
                                        <pathelement location="${project.basedir}/gp/export_files"/>
                                    </classpath>
                                </java>
                                <copy todir="target/">
                                    <flattenmapper/>
                                    <fileset dir="target/classes/">
                                        <include name="**/*.cap"/>
                                    </fileset>
                                </copy>
                            </tasks>
                        </configuration>
                    </plugin>

Set the placeholders and properties as necessary.

There might be a newer version on the GlobalPlatform Specification Page. Under the section "GlobalPlatform Card API" you should find a zip file with the latest export definitions. But this should not matter.

k_o_
  • 5,143
  • 1
  • 34
  • 43
  • thanks for your reply - checking if somewhere add the .exp path. during error it is giving a link like -NetBeansProjects\wallet\nbproject\build-impl.xml:208: hope this file need to be updated. – Arjun Dec 03 '21 at 09:30