如何在 Eclipse 上运行 Java Card Connected Edition Web 示例?
2022-09-01 23:55:54
我从Oracle官方网站下载了Java Card Connected Edition 3.0.2并安装了它。JCDK 中有一些 Web 示例。在编写的文档中:
所有示例都必须在 NetBeans IDE 中运行。在此版本的开发工具包中,它们无法从命令行运行。
示例可与 NetBeans IDE 一起使用。我可以导入它们并在Java Card平台上运行。
但我想在 Eclipse IDE 上使用此示例。在 Eclipse as Java Card SDK 路径中,我展示了 Java Card Connected 主路径。然后创建了新设备并尝试启动它(例如CardHolderApp)。但Eclipse给出了:
ApduTool thread exited
User input thread exited
APDU|ApduTool [v3.0.2]
APDU| Copyright (c) 2009 Sun Microsystems, Inc.
APDU| All rights reserved.
APDU| Use is subject to license terms.
APDU|Opening connection to localhost on port 9025.
APDU|Connected.
APDU|java.net.ConnectException: Connection refused: connect
ApduTool process finished with code: 1
.log文件:
!ENTRY org.eclipse.core.jobs 4 2 2015-09-08 01:39:17.142
!MESSAGE An internal error occurred during: "Launching CardHolderApp".
!STACK 0
java.lang.RuntimeException: Cannot start device. Please see the log.
at com.oracle.javacard.jcdk.launch.runconfiguration.AppletRunConfigurationDelegate.launch(AppletRunConfigurationDelegate.java:79)
at org.eclipse.debug.internal.core.LaunchConfiguration.launch(LaunchConfiguration.java:885)
at org.eclipse.debug.internal.core.LaunchConfiguration.launch(LaunchConfiguration.java:739)
at org.eclipse.debug.internal.ui.DebugUIPlugin.buildAndLaunch(DebugUIPlugin.java:1039)
at org.eclipse.debug.internal.ui.DebugUIPlugin$8.run(DebugUIPlugin.java:1256)
at org.eclipse.core.internal.jobs.Worker.run(Worker.java:55)
是否可以在 Eclipse IDE 中运行 Java Card Connected Web 项目?
更新:
设备已成功启动。但项目未部署。它对每个字符串用法都给出“不受支持的字符串类型常量”。代码示例:
public void doGet(HttpServletRequest request, HttpServletResponse response) throws IOException, ServletException {
response.setContentType("text/html"); // unsupported String type constant
PrintWriter out = response.getWriter();
RequestDispatcher dispatcher = null;
dispatcher = request.getRequestDispatcher("/WEB-INF/header.i");//unsupported String type constant
response.sendRedirect(response.encodeRedirectURL("http://www.sun.com"));//unsupported String type constant
dispatcher.include(request, response);
dispatcher.include(request, response);
}
经典版不支持字符串。但它必须在Connected Edition上运行。