Skip to Main Content

Java Card

Announcement

For appeals, questions and feedback about Oracle Forums, please email oracle-forums-moderators_us@oracle.com. Technical questions should be asked in the appropriate category. Thank you!

OCF installation help

843851Jan 6 2004 — edited Jan 11 2008
I I am try to setup OCF using windows XP and ToWITOKO Chip Drive 100., I have read loads of article saying that it is supported. I have been doing this for 3 days now with no end in sight and could desperately do with any help.. I no this maybe a bit off topic but I'm sure there must be others who have gone though this and solved it.

I am using C:\jdk1.3.1_10 JRE

I have unzip OCF to c:\ocf\OCF

I have installed the Readers driver which have been piece up by the OS and showing the reader and the card (JCOP).

I am using Eclipse Platform Version: 2.1.2 to compile the soucre.
The workspace env variables are as follows

<?xml version="1.0" encoding="UTF-8"?>
<classpath>
<classpathentry exported="true" kind="lib" path="C:/ocf/OCF1.2/lib/base-opt.jar"/>
<classpathentry exported="true" kind="lib" path="C:/ocf/OCF1.2/lib/pcsc-wrapper-2.0.jar"/>
<classpathentry exported="true" kind="lib" path="C:/ocf/OCF1.2/lib/base-core.jar"/>
<classpathentry exported="true" kind="lib" path="C:/ocf/OCF1.2/lib/reference-services.jar"/>
<classpathentry kind="src" path="smart"/>
<classpathentry exported="true" kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER"/>
<classpathentry kind="output" path="bin"/>
</classpath>

My OS env is at follows


CLASSPATH=C:\ocf\OCF1.2\lib\pcsc-wrapper-2.0.jar;C:\ocf\OCF1.2\lib\reference-services.jar;C:\ocf\OCF1.2\lib\base-opt.jar;C:\ocf\OCF1.2\lib\base-core.jar;C:\java_card_kit-2_2_1\lib\api.jar;C:\java_card_kit-2_2_1\lib\jcrmiclientframework.jar;C:\java_card_kit-2_2_1\lib\javacardframework.jar;%CLASSPATH%
CLIENTNAME=Console
COMMONHOME=C:\Program Files\Rational\common
CommonProgramFiles=C:\Program Files\Common Files
COMPUTERNAME=GAMERSCH-GAM
ComSpec=C:\WINDOWS\system32\cmd.exe
HOME=C:\Documents and Settings\sean
HOMEDRIVE=C:
HOMEPATH=\Documents and Settings\sean
JAVA_HOME=C:\jdk1.3.1_10
JC_HOME=C:\java_card_kit-2_2_1
LOGONSERVER=\\GAMERSCH-GAM
NUMBER_OF_PROCESSORS=1
NUTCROOT=C:\PROGRA~1\RATIONAL\RATION~1\NUTCROOT
NUTSUFFIX=1
NUT_SUFFIXED_SEARCHING=1
OCF=C:\ocf\OCF1.2
OS=Windows_NT
Path=C:\PROGRA~1\RATIONAL\RATION~1\NUTCROOT\bin;C:\jdk1.3.1_10\bin;C:\PROGRA~1\RATIONAL\RATION~1\NUTCROOT\bin\x11;C:\PROGRA~1\RATIONAL\RATION~1\NUTCROOT\mksnt;C:\WINDOWS\system32;C:\WINDOWS;
C:\WINDOWS\System32\Wbem;%PATH%;"C:\Program Files\Hummingbird\Connectivity\7.00\Accessories\";C:\java_card_kit-2_2_1\bin;C:\jdk1.3.1_10\bin;%PATH%;C:\jdk1.3.1_10\jre\lib\ext;C:\C:\jdk1.3.1_1
0\jre\lib;C:\Program Files\Rational\common;C:\ocf\OCF1.2\lib;C:\Program Files\Rational\Rose\TopLink\;C:\Program Files\Rational\Rational Test;C:\Documents and Settings\sean;C:\Documents and S
ettings\sean\studio5se_user\AboutExamples\test

This the source code that i am using to picece up the reader
i
mport java.io.FileNotFoundException;
import opencard.core.OpenCardException;
import opencard.core.service.SmartCard;
import opencard.core.service.CardRequest;
import opencard.opt.iso.fs.FileAccessCardService;
import opencard.opt.iso.fs.CardFile;


public class ReadFile2 {

public static void main(String[] args) throws ClassNotFoundException{

System.out.println("reading smartcard file...");

try {

SmartCard.start();
// wait for a smartcard with file access support
CardRequest cr = new CardRequest(CardRequest.NEWCARD, null, FileAccessCardService.class);

SmartCard sc = SmartCard.waitForCard(cr);

FileAccessCardService facs = (FileAccessCardService)

sc.getCardService(FileAccessCardService.class, true);

CardFile root = new CardFile(facs);

CardFile file = new CardFile(root, ":c009");

byte[] data = facs.read(file.getPath(), 0, file.getLength() );

sc.close();

String entry = new String(data);

entry = entry.trim();

System.out.println(entry);

} catch (OpenCardException e) {

e.printStackTrace(System.err);

} catch (FileNotFoundException e) {
// TODO Auto-generated catch block
e.printStackTrace();
} finally { // even in case of an error...

try {

SmartCard.shutdown();

} catch ( OpenCardException e ){

e.printStackTrace(System.err);
}

}
System.exit(0);

}
}

And here is the error that i have had for days, i have t put OCFPCSC1 in the path and in the source folder of the project

reading smartcard file...
[DEBUG ] opencard.core.service.SmartCard.getRegistryEntry
--- message tag OpenCard.terminals = com.ibm.opencard.terminal.pcsc10.Pcsc10CardTerminalFactory
--- thread Thread[main,5,main]
--- source class opencard.core.service.SmartCard

[DEBUG ] opencard.core.service.SmartCard.<shutdown>
--- message shutdown OpenCard
--- thread Thread[main,5,main]
--- source class opencard.core.service.SmartCard

java.lang.UnsatisfiedLinkError: no OCFPCSC1 in java.library.path
at java.lang.ClassLoader.loadLibrary(ClassLoader.java:1344)
at java.lang.Runtime.loadLibrary0(Runtime.java:744)
at java.lang.System.loadLibrary(System.java:815)
at opencard.core.util.SystemAccess.loadLibrary(SystemAccess.java:111)
at com.ibm.opencard.terminal.pcsc10.OCFPCSC1.loadLib(OCFPCSC1.java:64)
at com.ibm.opencard.terminal.pcsc10.Pcsc10CardTerminalFactory.open(Pcsc10CardTerminalFactory.java:217)
at com.ibm.opencard.terminal.pcsc10.Pcsc10CardTerminalFactory.<init>(Pcsc10CardTerminalFactory.java:84)
at java.lang.Class.newInstance0(Native Method)
at java.lang.Class.newInstance(Class.java:232)
at opencard.core.service.SmartCard.handleTerminalFactoryEntries(SmartCard.java:424)
at opencard.core.service.SmartCard.configureTerminalRegistry(SmartCard.java:261)
at opencard.core.service.SmartCard.start(SmartCard.java:534)
at ReadFile2.main(ReadFile2.java:31)
Exception in thread "main"

Any help much appreciated, sorry for the long posting just need to give you all the info

Many Thanks

Sean
Comments
Locked Post
New comments cannot be posted to this locked post.
Post Details
Locked on Feb 8 2008
Added on Jan 6 2004
4 comments
508 views