2
I have the following code and am using a library to list the citizen card fields.
When I try to run in the DOS it doesn’t work.
import java.io.*;
import pteidlib.*;
public class main {
public String nome;
public String data;
public String pais;
public String sexo;
static
{
try
{
System.loadLibrary("pteidlibj");
}
catch (UnsatisfiedLinkError e)
{
System.err.println("Native code library failed to load.\n" + e);
System.exit(1);
}
}
public void PrintIDData(PTEID_ID idData) throws FileNotFoundException, UnsupportedEncodingException
{
nome = idData.firstname + " " + idData.name ;
data = idData.birthDate;
pais = idData.country;
sexo = idData.sex;
PrintWriter writer = new PrintWriter("the-file-name.txt", "UTF-8");
writer.println(nome);
writer.println(data);
writer.close();
System.out.print(nome);
}
public static void main(String[] args) throws UnsupportedEncodingException, FileNotFoundException, PteidException{
main test = new main();
pteid.Init("");
//test.TestChangeAddress();
// Don't check the integrity of the ID, address and photo (!)
pteid.SetSODChecking(false);
int cardtype = pteid.GetCardType();
switch (cardtype)
{
case pteid.CARD_TYPE_IAS07:
System.out.println("IAS 0.7 card\n");
break;
case pteid.CARD_TYPE_IAS101:
System.out.println("IAS 1.0.1 card\n");
break;
case pteid.CARD_TYPE_ERR:
System.out.println("Unable to get the card type\n");
break;
default:
System.out.println("Unknown card type\n");
}
// Read ID Data
PTEID_ID idData = pteid.GetID();
if (null != idData)
{
test.PrintIDData(idData);
}
}
}
I need to run this on the command line java -cp test.jar main
and then being called on the command line gives me this error:
To execute a jar per command line is java -jar seujar.jar .
– user28595
And what is the relative path of your external library?
– Math
My path to the outer bilbiotace is in the C:\
– usersantos
@user2964140 did not take a test here, but I believe that if you do
java -jar test.jar -cp .;c:\
will work– Math
Give me this error in the main manifest attribute,in test.jar
– usersantos
I can take the jar generated by my code and put it in c:\ ?
– usersantos
test there ...only print if you have a citizen card
– usersantos
does not work with this command...
– usersantos