LEQ*_*ADA 24 java eclipse netbeans eclipse-plugin javacard
我从Oracle官方网站下载了Java Card Connected Edition 3.0.2并进行了安装.JCDK中有一些网络样本.在编写的文档中:
必须在NetBeans IDE中运行所有示例.它们无法在此版本的开发工具包中从命令行运行.
示例正确地与NetBeans IDE一起使用.我可以导入它们并在Java Card Platform上运行.
但我想在Eclipse IDE上使用这些示例.在Eclipse中作为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
Run Code Online (Sandbox Code Playgroud)
.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)
Run Code Online (Sandbox Code Playgroud)
是否可以在Eclipse IDE中运行Java Card Connected Web项目?
更新:
设备已成功启动.但项目未部署.它在每个String使用时给出"不支持的String类型常量".代码示例:
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);
}
Run Code Online (Sandbox Code Playgroud)
经典版不支持Strings.但它必须适用于Connected Edition.
忘记中间所有复杂的软件。只需查看错误消息,您的本地主机上的端口 9025 似乎未打开或不可用:
APDU|Opening connection to localhost on port 9025.
APDU|Connected.
APDU|java.net.ConnectException: Connection refused: connect
ApduTool process finished with code: 1
Run Code Online (Sandbox Code Playgroud)
文本 [java.net.ConnectException: 连接被拒绝: 连接],每次我看到“连接被拒绝”时,这意味着 java 尝试在端口(本例中为 9025)上创建套接字,并且由于以下原因无法获取端口号阻塞(如防火墙)或不可用(其他东西正在使用端口 9025)。
在 Windows 或 *nix 上,您通常可以使用 netstat 命令来查看正在使用哪些端口。
hth,阿迪姆