javaeclipsejavacardcap

The Eclipse IDE is able to generate the javacard cap file but in command line I am encountering this error


The below error compelled me to dig into the build process of a cap file in the command line without using the IDE. So now, I can build a cap file from the command line using java/javac series of commands. But I have this one applet which successfully created a cap file if built via eclipse IDE but I am encountering an error when i try to build in the command line. I am also having same error when I tried in a correctly setup gradle build settings/environment. This is the error:

[ant:convert] [ INFO: ]     Copyright (c) 2011, Oracle and/or its affiliates. All rights reserved.
[ant:convert]
[ant:convert]
[ant:convert] warning: You did not supply export file for the previous minor version of the package
[ant:convert] [ INFO: ] conversion completed with 1 errors and 1 warnings.
[ant:convert] error: Class org/dx/tools/TestApplet, specified in -applet option, is abstract.

Take note, this is a working and tested applet in combination with other applets that uses this one. And this builds in the eclipse IDE.

Also I am able to generate the .class file. The problem is during the convertion of the class file to cap file.

Here is how it look like:

package org.dx.tools;

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

import javacardx.apdu.ExtendedLength;
import javacard.framework.ISO7816;
import javacard.framework.ISOException;
import javacard.framework.Util;
import javacard.framework.APDU;
import javacard.framework.APDUException;
import javacard.framework.Applet;
import javacard.framework.AppletEvent;    

public abstract class TestApplet extends Applet implements AppletEvent, 
    ExtendedLength {
  ...
}

This .cap is one among five others. The others are not abstract, but inherits from this one. Since it build in eclipse IDE, I can actually build the other cap files by taking the output of the IDE had produce. First, I jar the classes since as I said I can create the classes and feed to java conversion command to build the other caps, and I also use the TestApplet.exp that the IDE generated.

UPDATES: 2019/11/17 Here is the actual java command options that is able to build from .class to .cap. I took this as exactly from the Eclipse IDE conversion log.

If an answer can confirm this is a current gradle limitation then I will accept this answer. If answer can show what is the correct gradle settings to make it work then I will accept this answer. Thanks.


Solution

  • I've resolved the issue by removing the applet {} block in build.gradle. As the particular cap being built is an abstract class, it does not have an applet aid.