jeudi 26 mars 2015

javabean in oracle forms calling .dll error while running oracle form

I must used javabean calling .dll file while running oracle form but it doesn't work.


here is java bean that will export to jar file.


It work while I did not have "static scapi_ope s_ope = new scapi_ope(); "


scapi_ope not only call .dll but also run exe file for it's certs.


my project include lib folder and file need to use .



public class SMC_BEAN extends VBean{

protected static final ID CARD_TYPEB = ID.registerProperty("CARD_TYPEB");
static String error_ = "";
static scapi_ope s_ope = new scapi_ope(); //it error while I used this line when call in oracle form.
private IHandler m_handler;
public void init(IHandler handler)
{
m_handler = handler;
super.init(handler);
}
public boolean setProperty(ID pId, Object Value) {
if (pId == CARD_TYPEB){
return true;
}
else {
return super.setProperty(pId, Value);
}
}
public Object getProperty(ID pId) // Get the current pressed button ID
{
if (pId == CARD_TYPEB){
return "test";
}
else
{
return super.getProperty(pId);
}

}


and call dll file with this



import java.io.IOException;
import com.sun.jna.ptr.IntByReference;
public class scapi_ope {

//scapi_ope s_ope = (scapi_ope)Native.loadLibrary( "scapi_ope", scapi_ope.class); //error
static
{
//System.loadLibrary("scapi_ope"); // change to but error too
try {
NativeUtils.loadLibraryFromJar("/lib/scapi_ope.dll"); // change to but error too
} catch (IOException e) {
e.printStackTrace();
}
}
public short ListReader(byte[] reader_list, IntByReference err_code){
return ListReader( reader_list, err_code);
}
public short CloseReader(){
return CloseReader();
}
}

Aucun commentaire:

Enregistrer un commentaire