Send APDU form an applet to another applet

Hi,
I try to send an APDU from an applet to another applet. Both runs on the same Java Card.
With a jar-file on Eclipse:
I select the cardreader,
terminal = (CardTerminal) terminalList.get(1);establish a connection with the card,
Card card = terminal.connect("T=1");
channel = card.getBasicChannel();and send the CommandAPDU
ResponseAPDU r = channel.transmit(new CommandAPDU(data));Has so. an idea how to realize with an applet?

There are three options how two applets can exchange data:
1. Shareable Interface Object, as mentioned. Mandated if applets are in different packages.
2. Same package. If applets are in the same package, all public fields and methods are accessible.
3. Library. A package without any class extending base class Applet from javacard.framework is called a library. The applet firewall is not active in this case. All applets can access public fields and methods.

Similar Messages

  • Open/Call an applet From another applet

    Hi everybody,
    I want to open/call an applet from another
    applet via a button. when the user press
    the button, next applet load.
    Appreciate your response.
    null

    try {
    URL secondpage="second appleturl.html");
    getAppletContext().showDocument(secondpage,"seconf applet_frame");
    }catch (java.net.MalformedURLExceptione){*Write your error messages here*/}
    Regards
    Sonlam
    null

  • Accessing an applet from another applet

    Hi,
    I created a web page with a bunch of applets running on it, and I need to comunicate them. Is it possible to access the public methods and variables of one applet from another applet ? How do I do it ?

    I recently read an article that described how to access other applets in the same page, but I didn't pay much attention to it because I don't write applets. However, a quick look at the API documentation for the java.applet package shows this:
    "AppletContext: This interface corresponds to an applet's environment: the document containing the applet and the other applets in the same document."
    So I would try to get an AppletContext and see what could be done with it.

  • Calling one applet to another applet

    Hi,
    How to call one applet program to another applet program.
    thanks in advance

    ManiForum wrote:
    ..How to call one applet program to another applet program.3 tips
    - How to Google.
    - How to ask [smart questions|http://catb.org/~esr/faqs/smart-questions.html].
    - How to use [question marks|http://www.google.com/search?q=question+marks] to denote a question.
    ..thanks in advanceNo wuckin' furries.

  • Load applet within another applet?

    Let's say I have two applets, A1, and A2. I'd like to load A1 on my HTML page, and I'd like A1 to load A2 within itself (i.e. not load it as another separate applet on the HTML page).
    Basically, A2 takes some parameters I would like to pass to it through A1, so I'd like to know if this is possible.
    Thanks for any help!
    James

    Totally possible. You just have to provide it an applet context
    see http://java.sun.com/j2se/1.4.2/docs/api/java/applet/AppletContext.html

  • Applet to another applet

    Hi
    How do I change my applet interface to another on some event (say, initially I show the frame to take user data and on its authenticity I need to give him another interface to enter some other data).
    Thanx

    public class Starter extends javax.swing.JApplet {
         public javax.swing.JPanel jp;
         public Menu menu;
    public void init(){
    jp = new javax.swing.JPanel();
              jp.setLayout(new java.awt.BorderLayout());
              getContentPane().setLayout(new java.awt.BorderLayout());
              menu = new Menu(this);
              jp.setDoubleBuffered(true);
              jp.add(menu.getContentPane());
              getContentPane().add(jp, "Center");
    Once in menu you choose an option that will change the menu screen to another by doing this:
    parent.jp.remove(parent.menu.getContentPane());
              DifferentFrame fb = new DifferentFrame(this);
              parent.jp.add(fb.getContentPane(), "Center");
              fb.setVisible(true);
              fb.hide();
              parent.jp.repaint();
              parent.repaint();
              repaint();
    Note the above is dealing with JFrames(DifferentFrame and Menu are JFrames), with a JPanel or other components you do not need to use the getContentPane() method.

  • Java applet calling another applet on the Javacard

    Hi, I am new to JC.
    I have some Java classes which I do not want others to extend. Hence, to hide these classes, I have created a set of helper classes that will provide services to these "hidden" Java classes to other calling applets, much like the way I do in J2SE. Something like a wrapper class.
    The problem is, I am not sure if other applet classes can call this new helper class or not? and I am also not sure how this can be done. Can someone advise? Thanks in advance.

    I'm not sure what this has to do with JavaCards.
    Sounds like a simple Facade Design Pattern. Also your classes are "hidden" when you make them package protected or package private. Read J2SE packages and you'll see what I mean.
    If you are referring to JavaCard, by design each package is it's own context therefore, there's a context firewall to protect it's objects and data. A shareable Interface object must be implemented to allow access.

  • Using an applet to call another applet

    Hi,
    I know that some of you may have heard this question many times before from other people, however this is an act of desperation as I have tried searching everywhere in vain for the solution.
    How do you call an applet from another applet? I cannot seem to find a solution that works. I have created a simple game using Java applets but I am trying to create a title screen. Since the graphics method calls itself repeatedly, I didn't bother putting the method that drew the main screen into the paint (Graphics g) method. So I have finally decided upon creating a seperate simple applet that would only show the main screen, and when a button is pressed, the game will be played. I have everything except for the "calling an applet" part. So how do I call an applet from another applet? What is the most simple / efficient way that someone with limited technology and understanding of applets can understand?
    Thanks a bunch.

    Yeah well this was also a bit tough for me.. but well mate.. finally cracked it.. ok here is the explanation and eg:
    Suppose there are 2 applets. parent and child.. and respectively they are embeded into 2 seperate html files :
    i) parent.html
    ii) child.html
    The task on our hand is .. when there is an event in the parent.. for eg a mouse-click or a button press.. it loads the child applet automatically.
    I will demonstrate this with this example:.. here is an applet .. parent which has a button.. upon button press. it loads the child applet.
    import javax.swing.*;
    import java.awt.*;
    import java.awt.event.*;
    import java.net.*;
    import java.applet.*;
    public class parent extends JApplet implements ActionListener
         JPanel p=new JPanel();
         JButton b=new JButton("Submit");
         public void init()
              b.addActionListener(this);
              p.add(b);
              getContentPane().add(p);
                   parent p=new parent();
         public void actionPerformed(ActionEvent ae)
              if (ae.getSource()==b)
              {   //pay attention here
                      AppletContext ac=getAppletContext();
                    URL url=getCodeBase();
                    try
                                 ac.showDocument(new URL(url+"child.html"));
                    catch (MalformedURLException e)
                   showStatus("URL not found");
    }Well.. i am sure you can code the html :)

  • Can I call applet in other applet???

    1.Just like a call a frame in new window.....can i call a frame in the same window.
    2.Can i call an another applet in the same window from a running applet.if yes how can i send any variables to it??

    Your first question is not really clear to me, but the second I got. You can have an applet call another applet, you need to use getApplet or getApplets (which return Applet and Applet[] respectively). If you use getApplet you need to name your applets, while getApplets just returns every single applet on the page.
    Then, when you have Applet myOtherApplet = getApplet("Applet2");
    You can do myOtherApplet.method(int parm1, String parm2);
    Applets are named in the html file, don't remember the correct syntax right now.

  • Is it possible send a SELECT APDU from one applet to another?

    Hello i want to select one applet from another. is it possible and how?. Thanks

    OK, I went to use this today, and can't figure it out.  Where do I place this code; In the SQL of a query, In the VBA of a form, or In a Modual?
    UPDATE Registrations RIGHT JOIN Registrations2
    ON Registrations.TEXT_REGISTRANT_ID = Registrations2.TEXT_REGISTRANT_ID
    SET Registrations.TEXT_REGISTRANT_ID = Registrations2.TEXT_REGISTRANT_ID,
    Registrations.[Name] = Registrations2.[Name]

  • Send APDU to the card from applet on the card

    Hi
    I would like to send an APDU command to the card, from an applet on the actual card, in the same way I do from a PC with a card reader.
    The applet would first have been triggered by an external application through a card reader.
    I have seen this done on a SIM card not based on JavaCard, but I wonder if the JavaCard API allows it.
    Thanks
    asciz

    APDU = Application Protocol Data Unit which means that this is the applicative protocol that allows a IFD to communicate with a smart card. This protocol resides on top of the TPDU (Transfer Protocol Data Unit) that defines how the data are sent to the card. I dun think that it's possible for an applet on the SIM to be able to send APDU command to another applet on the SIM without going through the smart card reader.
    To make 2 applets communicate on a java card there are other ways, like opening a door in your applet to let other applet to call a method from your applet.
    Thomas
    http://jaccal.sourceforge.net/

  • Hope u will send me the details of calling an applet from another

    hai to all
    i am trying to do an applet ,and it corrct in jdev ide,but trying to run in explorer
    i cant connect the database,
    but in applet viewer also i cant call another
    applet throught a button or any thing
    i hope u will send me details
    and thanks a lot to Joe silva
    thanks in advance
    anas
    null

    I've not done it myself but I think you must have a name for the second applet specified in the html tag. That is how the first applet will be able to identify the second applet.
    maybe..
    <APPLET CODE="FirstApplet.class"></APPLET>
    <APPLET CODE="SecondApplet.class" NAME="ReceiverName"></APPLET>
    then in your java code
    SecondApplet app = (SecondApplet) getAppletContext().getApplet("ReceiverName");
    if (app != null)
    <execute code>
    But I've not done it, so its only a suggestion...

  • Is it possible to transfer data from one applet to another?

    I have designed a calendar. Using the calendar,i have selected some dates. Is it possible to send the selected dates to another applet? If yes, please send the code to transmit data..

    I have designed a calendar. Using the calendar,i have selected some dates. Is it possible to send the selected dates to another applet? If yes, please send the code to transmit data..

  • Sharing an applet with another dosn't function

    Hi all,
    i have a problem that i share an applet with another, but it dosn't function:
    i have two applet: epurse & bank   (bank is the master)
    for that i creat a class "bankInterface" that's inherit from sharable:
    package pack4;
    import javacard.framework.APDU;
    import javacard.framework.Shareable;
    public interface bankInterface extends Shareable {
      public void debit(APDU apdu);
    bank's declaration:
    public class bank extends Applet implements bankInterface {
    public Shareable getShareableInterfaceObject (AID clientAID, byte param){
      return ((bankInterface)this);  //or return this;
    public  void deselect(){
          pin.reset();
      public boolean select() {
           return super.select();
      public static void install(byte bArray[], short bOffset, byte bLength) throws ISOException {
           new bank();
    private bank() {
      register();
    public void process(APDU apdu) throws ISOException {
    public void debit(APDU apdu){
    //empty juste for testing
    }// end class 'bank'
    epurse's declaration:
    package pack4;
    import ...
    public class epurse extends Applet {
    byte[] AIDServer=new byte[]{0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07, 0x08, 0x09, 0x00, 0x00, 0x00};
    public bankInterface sio;
    private epurse() {
      sio=(bankInterface) JCSystem.getAppletShareableInterfaceObject(JCSystem.lookupAID(AIDServer, (short)0, (byte)AIDServer.length), (byte)0);
    //methods: install, select, deselect
    public void process(APDU apdu) throws ISOException {
    byte[] apduBuffer=apdu.getBuffer()
    if(apduBuffer[ISO7816.OFFSET_CLA] == (byte)0x80){
      switch(apduBuffer[ISO7816.OFFSET_INS]){
      case (byte)0x34:
      credit(apdu);break;
    else{ ...}
    }//end process
    private void credit(APDU apdu){
    apdu.setIncomingAndReceive();
    sio.debit(apdu); // if this line is commented, i get the sw1:90 sw2: 00; else i get sw1: 6f sw2: 00 (wrong length)
    }// end class epurse
    i don't know where's the problem?

    Hi,
    If you go through the SIO concepts of JavaCard its mentioned that when "getAppletShareableInterfaceObject" is called from the client the JCRE will call "getShareableInterfaceObject" method of server with clientAID but where as you are requesting for SIO in install method before registration where the clientAID doesnt exists so the call will fail and return "null" and further references to SIO object will fail to perform expected operations.
    So put request for SIO after registration of your client applet.
    BR,
    PPT

  • What are the methods called while navigating from one applet to another one

    Hi All,
    Could any one brief me about "When you navigate from one applet to another what are the methods called ?".
    Thanks in advance.
    Best Regards,
    N.Madhusudhanan.

    http://forum.java.sun.com/thread.jsp?forum=421&thread=426771&tstart=0&trange=100

Maybe you are looking for

  • DMS configuration manual

    Dear Sir, Can Any body provide me the DMS configuration document So that i can try it on developmet server Thanks & regards Ajay pareek

  • Opening MS-DOS with Java

    I'm involved in a college programming class with Java and I'm stumped. I need to create a Java program that is able to open the MS-DOS prompt window and run a Java program in it as well as add a MS-DOS command afterwards in order to catch the output.

  • Managed servers on exalogic

    Hi, We have one full rak exalogic machine, we are running weblogic on it. The question is, on each node on exalogic, how many managed server's can we create , considering all the application does the same thing. currently we care running managed serv

  • Nokia 3109 - no brightness settings !

    It is not possible to adjust the brightness of this phone, especially during night it is very unpleasant how the tft display actually shines. I would appreciate any help in this matter, the phone itself is able to lower the brightness when going to s

  • Can't See Recipients in Mail

    Started using Lion recently.  In Mail, I can't see who the recipients are in an email that was sent to me.  Only by clicking reply all can I see who was included.  I looked in Preferences but couldn't find the answer there.  I assume this is a quick