我是一个新手学习java和nfc。其实我真的需要一些关于我的作业“NFC编程”的帮助。 我试试这个教程http://open-nfc.org/wp/editions/sdk-edition/creating-a-java-example/,我仍然收到此错误信息:如何使用java创建简单的NFC程序?
Start failed !
NfcException : Error while starting the NFC Manager - Caused by NFC error DRIVER
at org.opennfc.NfcManager.start(Unknown Source)
at org.opennfc.NfcManager.getInstance(Unknown Source)
at example.Example.main(Example.java:26)
Exception in thread "main" java.lang.IllegalStateException
at org.opennfc.NfcManager.stop(Unknown Source)
at example.Example.main(Example.java:36)
其实,我想运行是开放式NFC
NfcManager mgt = NfcManager.getInstance(null);
try {
System.out.println(mgt.getProperty("open_nfc.version"));
System.out.println(mgt.getProperty("nfcc.firmware_version"));
} finally {
try {
mgt.stop();
} catch(NfcException e) {
System.out.println("Error :" + e.getMessage());
}
}
我已经开始连接此示例代码中心,nfc模拟器和服务器端口。我有一台QPROX QP3000,已连接到我的电脑。我正在使用eclipse juno和windows 7.
所以你的计划是与你的NFC阅读器与一些标签交互? – ThomasRS 2012-08-10 11:56:28
我建议你重构你的代码,以便每个getProperty()调用都在它们自己的catch块内的try块中。 getInstance()是否也需要try块?看看http://docs.oracle.com/javase/tutorial/essential/exceptions/index.html有关异常或本教程http://tutorials.jenkov.com/java-exception-handling/basic-try- catch-finally.html – 2012-08-12 16:13:07
@pricillia我建议你尝试https://github.com/grundid/nfctools,为你开始https://github.com/grundid/nfctools-examples,它会很多很有帮助。 – cypronmaya 2012-10-04 11:11:16