简体   繁体   English

Eclipse IDE 能够生成 javacard cap 文件,但在命令行中我遇到了这个错误

[英]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.下面的错误迫使我在不使用 IDE 的情况下在命令行中深入研究 cap 文件的构建过程。 So now, I can build a cap file from the command line using java/javac series of commands.所以现在,我可以使用 java/javac 系列命令从命令行构建一个 cap 文件。 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.但是我有这个小程序,如果通过 eclipse IDE 构建成功创建了一个 cap 文件,但是当我尝试在命令行中构建时遇到错误。 I am also having same error when I tried in a correctly setup gradle build settings/environment.当我尝试正确设置 gradle 构建设置/环境时,我也遇到了同样的错误。 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.这建立在 eclipse IDE 中。

Also I am able to generate the .class file.我还能够生成.class文件。 The problem is during the convertion of the class file to cap file.问题出在将 class 文件转换为cap文件的过程中。

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.这个.cap是其他五个之一。 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. 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.首先,我jar类,因为正如我所说,我可以创建类并提供给java转换命令来构建其他上限,我还使用了TestApplet.exp生成的 TestApplet.exp

UPDATES: 2019/11/17 Here is the actual java command options that is able to build from .class to .cap .更新:2019/11/17是实际的java命令选项,可以从.class构建到.cap I took this as exactly from the Eclipse IDE conversion log.我完全从 Eclipse IDE 转换日志中得到了这个。

If an answer can confirm this is a current gradle limitation then I will accept this answer.如果答案可以确认这是当前的 gradle 限制,那么我将接受此答案。 If answer can show what is the correct gradle settings to make it work then I will accept this answer.如果答案可以显示正确的 gradle 设置以使其正常工作,那么我将接受此答案。 Thanks.谢谢。

This is very likely due to linking to a newer or older version of a library, while targeting a different Java Card version during your build process.这很可能是由于链接到较新或较旧版本的库,而在构建过程中针对不同的 Java 卡版本。 Note that the converter creates pre-linked code, so it expects to link against the correct versions.请注意,转换器会创建预链接代码,因此它希望链接到正确的版本。

This is different from Java SE, where the classes can be linked at runtime and the location of methods and fields doesn't matter, as they are created during runtime.这与 Java SE 不同,其中类可以在运行时链接,方法和字段的位置无关紧要,因为它们是在运行时创建的。

I've resolved the issue by removing the applet {} block in build.gradle .我已经通过删除build.gradle中的applet {}块解决了这个问题。 As the particular cap being built is an abstract class, it does not have an applet aid.由于正在构建的特定上限是抽象 class,因此它没有小程序辅助。

暂无
暂无

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

相关问题 从底部的第二行检查语法,我在 eclipse ide 中遇到错误 - from bottom second line check the syntax, I am getting error in eclipse ide Spring Boot JPA错误:为什么我不能使用Command Line Runner将对象持久保存到数据库? - Spring Boot JPA Error: Why am I not able to use Command Line Runner to persist an object to the database? 将.class文件转换为.cap JavaCard 3.0.2 Connected Edition - Converting .class file to .cap JavaCard 3.0.2 Connected Edition Eclipse-IDE的Java命令行参数 - Java command line parameters for Eclipse-IDE 如何将Javacard cap文件转换为其对应的字节stream? - How to convert the Javacard cap file to its corresponding byte stream? 尝试通过批处理文件生成报告时,为什么无法生成报告? - Why am I not able to generate report when I am trying to generate report via a batch file? 如何调试使用 Eclipse Z581D6381F01F35E4B36ACDZ7 文件编译的命令行 Java.class 文件? - How to debug a command line compiled Java .class file using Eclipse IDE? 无法通过命令行执行TestNG Suite文件,但可以在Eclipse IDE中使用 - Unable to execute TestNG Suite file via command line but works from Eclipse IDE 如果我是盲人,我如何在 Eclipse IDE for Java 中查看错误指示器 - If I am blind, how do I see the error indicators in Eclipse IDE for Java 当我试图在 eclipse IDE 2021-03 中安装 maven 时,我收到了这个错误 - When i was trying to install maven in eclipse IDE 2021-03 i am geeting this error
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM