Java Card - Offcard API code samples needed
I have already written java card applet, that successfully works on JCOP 31 card.
The main problem is, that am loading it through the JCOP shell, but i would like to write to off card applications: one for the applet uploading on card and it's instantiation, ant the other - for the working with the applet (selecting it and calling it's methods).
could anyone please send me any samples of such code? I am working with PCSC Gemplus and Sun readers.
Thank you.
Eveline
[501 byte] By [
eve-za] at [2007-11-14]

Hello Eveline!
I would suggest you to give a look at the following topic:
http://forum.java.sun.com/thread.jspa?forumID=23&threadID=672352.
You should give a look at the documentation of the JCOP offcard API. It should be easy to you to write the code that will upload and instantiate your applet.
Considering working with your applet, I believe that you will be able to find the example of offcard application in JCOP samples. Just skim through the directories containing the JCOP plug-in for Eclipse.
Best regards,
Aleksandar
Thank you, Aleksandr, for your help.Now it is more clear to me, how to write an Offcard application.If there will be any problems during the implementation of it, I'll try to use your help again.I hope, you don't mind:)Best regards,Eve
You are welcome!Best regards,Aleksandar
Hello,
so there is the first problem, i have met by testing the code from the link, that were posted in one of your replies (I mean CardInfo java Class). Everything just works fine with jcop simulator. But in case i want to connect to the real jcop card in my Sun Card reader, by inserting the line:
JCTerminal term = JCTerminal.getInstance("pcsc:4", null);I get the following error.
Open terminal ...java.lang.UnsatisfiedLinkError: no jct in java.library.path
java.lang.UnsatisfiedLinkError: setup
at com.ibm.jc.terminal.NativeJCTerminal.setup(Native Method)
at com.ibm.jc.terminal.NativeJCTerminal.<init>(Unknown Source)
at com.ibm.jc.JCTerminal.getInstance(Unknown Source)
at cardInfo.CardInfo.getcardinfo(CardInfo.java:66)
at cardInfo.CardInfo.main(CardInfo.java:154)
Exception in thread "main"
Please, give me some hints. Offcard jar is already added to the projects libraries in Eclipse
Best regards,
Eve.
I am also quite new to Eclipse. But i think, that CardInfo project needs the path to the jct.dll file. Where should i specify it in Eclipse? and how?Best regards,Eve
Maybe it would be enough to add the jct.dll to your system path. I usually copy the library to the bin directory of the JRE used by the Eclipse. That should solve the problem.
I have already done both of those things, that you have noticed.
I an Eclipse java project I added JVM arguments:
-Djava.library.path=c:\eclipse3.1.2\eclipse\plugins\com.ibm.bluez.jcop.eclipse_3.1.2\os\win32\x86\ -classpath c:\eclipse3.1.2\eclipse\plugins\com.ibm.bluez.jcop.eclipse_3.1.2\lib\offcard.jar;.The error remainsthe same during the execution (Run in Eclipse).
This is very strange for me, because I tried to exeute this project just from command line prompt (with the same library path & classpath arguments) - it works fine!
So Eclipse gives the ability to compile my code, but no possibility to execute it (because ir ignores the path to the jct.dll).
Is there any possibility to fix it? It looks just like some bug in the implementation of this development tool?
Best regards,
Eve
There is a more elegant approach:-) I discovered it right now...
Right click on the project, choose Build path ->configure build path.
Then click on Libraries tab, find and expand the jpcsc.jar and configure the native library location. Now you will be able to run your program from the Eclipse.
Regards,
Aleksandar
I am not even using jcpcs.jar, because am working on Windows OS, and using pcsc:4 call to terminal, that uses jct.dll.I tried to configure native path to it.But everything remains the same.Am I doing smth wrong?Thanks for your help,Regards,Eve
You could also just copy the jct.dll into the Windows/System32 folder.This worked for me...
Hi,
the JCShell /terminal command allows different ways of a terminal connection:
Example 1: Open a NativeJCTerminal (using jct.dll)
/term pcsc:4
Example 2: Open a NativeJCTerminal (using jct.dll)
/term winscard:4
Example 3: Open a PCSCJCTerminal (using jpcsc.dll)
/term "PCSC"
Example 4: Open a PCSCJCTerminal (using jpcsc.dll) to the designated reader
/term "PCSC|SCM Microsystems Inc. SDI010 Contactless Reader 0"
Example 5: Open a RemoteJCTerminal (using a socket connection at localhost:8050 to the Generic-Simulation - must be started before)
/term Remote
Example 6: Open a RemoteJCTerminal (try to connect Simulation at localhost:2233)
/term Remote|2233
Example 7: Open a RemoteJCTerminal (try to connect Simulation at myHost:2233)
/term Remote|myHost:2233
Example 8: Try to open a MyTermJCTerminal(using individual dll)
/term "MyTerm"
These DLL's are part of the JCOP-Tools plug-in and you must either place the DLL's in the Windows/System32 folder or configure the build path of your project.
