Android Question [Solved]How do I import the package of Java code?

Olaan

Expert
Licensed User
Longtime User
Refer to myCode which is attached. After I have learn using javaobject with Java Code,so I can create the code. Due to I still not understand about
import javax.smartcardio.*;
it has error occured. I think jnasmartcardio.jar concern about the package of Java code
 

Attachments

Solution
I couldnt get it to work with in-line java, seems like java.smartcardio only exports javax.smartcardio to java.base

using javaobject it does work (I think under the hood it sets accessible true)

Code: Copy
    Dim j As JavaObject
    Dim factory As JavaObject
    j.InitializeStatic("javax.smartcardio.TerminalFactory")
    factory = j.RunMethod("getDefault",Null)
    Dim terminals As List = factory.RunMethodJO("terminals",Null).RunMethod("list",Null)
    Log(j)
    Log(factory)
    Log(terminals)
Theera did you load the jnasmartcardio-0.2.7.jar file into the additional directory? Additional Libraries, the (optional) folder where libraries will be searched for, in addition to the internal libraries folder. You can find this via Tools.

Update: I look into the jar and see that it want to download the javax.smartcardio.CardTerminal, javax.smartcardio.CardTerminals, javax.smartcardio.TerminalFactory, and jnasmartcardio.Smartcardio libraries. You need to make a wrapper to let it work.
 
Last edited:
Upvote 0
I couldnt get it to work with in-line java, seems like java.smartcardio only exports javax.smartcardio to java.base

using javaobject it does work (I think under the hood it sets accessible true)

Code: Copy
    Dim j As JavaObject
    Dim factory As JavaObject
    j.InitializeStatic("javax.smartcardio.TerminalFactory")
    factory = j.RunMethod("getDefault",Null)
    Dim terminals As List = factory.RunMethodJO("terminals",Null).RunMethod("list",Null)
    Log(j)
    Log(factory)
    Log(terminals)
 
Upvote 0
Solution
[QUOTE="Daestrum, post: 1013721, member: 52836

Code: Copy
    Dim j As JavaObject
    Dim factory As JavaObject
    j.InitializeStatic("javax.smartcardio.TerminalFactory")
    factory = j.RunMethod("getDefault",Null)
    Dim terminals As List = factory.RunMethodJO("terminals",Null).RunMethod("list",Null)
    Log(j)
    Log(factory)
    Log(terminals)
[/QUOTE]
Where are getDefault and terminals come from? Please help me explain. There are not java sourcecode, are them? And the
package javax.smartcardio.TerminalFactory is from? (I know only "javax.smartcardio.*)
 
Upvote 0
Upvote 0
Where are getDefault and terminals come from? Please help me explain. There are not java sourcecode, are them? And the
package javax.smartcardio.TerminalFactory is from? (I know only "javax.smartcardio.*)

if you look at the source code jar you will see that the standard java classes (like terminals) are extended. That is why the example from post 3 works. In short: you don't need a wrapper but you can implement your program using the given Java object method from post 3.

In short: you don't need a wrapper but you can implement your program using the given Java object method from post 3.
 
Upvote 0
If I understand, see the class and the example.
The documentation can be found in the file jnasmartcardio-0.2.7-sources.jar after you unzip it after you change the extension from jar to zip.
 
Upvote 0
Here is the zipped jnasmartcardio-0.2.7-sources Doclet explanation of the Java routines.
 

Attachments

Upvote 0
Thank you all of you.
 
Upvote 0
Back
Top