This discussion is archived
1 Reply Latest reply: Dec 13, 2012 11:25 PM by Sebastien_Lorquet RSS

Opencard framework - 2 questions

936354 Newbie
Currently Being Moderated
I encounter the following errors when I try to run the following code.
1)
import opencard.core.event.CTListener;
import opencard.core.event.CardTerminalEvent;
import opencard.core.service.SmartCard;
import opencard.core.terminal.CardTerminalException;
import javax.swing.*;
 
public class HostSideApp extends JApplet implements CTListener {
   public HostSideApp() {
 
    try {
        SmartCard.start();
        // use OCF...
    } catch OpenCard Exceptions {
        // handle error...
    } finally {
    try {
             SmartCard.shutdown();
    } catch OpenCard Exceptions {
        // handle error...
    }
   }
    
    public static void main(String[] args)
    {
        HostSideApp app = new HostSideApp();
 
    }
 

    @Override
    public void cardInserted(CardTerminalEvent cte) throws CardTerminalException {
        throw new UnsupportedOperationException("Not supported yet.");
    }

    @Override
    public void cardRemoved(CardTerminalEvent cte) throws CardTerminalException {
        throw new UnsupportedOperationException("Not supported yet.");
    }
}
      
D:\users\Documents\NetbeansProjects\Enterprise-System\src\Payroll\HostSideApp.java:20: error: '(' expected
} catch OpenCard Exceptions {

2)
import opencard.core.event.CTListener;
import opencard.core.event.CardTerminalEvent;
import opencard.core.service.SmartCard;
import opencard.core.terminal.CardTerminalException;
import opencard.core.event.EventGenerator;
import javax.swing.*;
 
public class HostSideApp extends JApplet implements CTListener {
 
  
 
  private SmartCard card = null;
 
  
 
  public HostSideApp() {
 
    try {
 
      SmartCard.start();
       
    } catch (Exception e) {
      e.printStackTrace(System.err);
     
      }
    }
    
    public static void main(String[] args)
    {
        HostSideApp app = new HostSideApp();
 
    }
 

    @Override
    public void cardInserted(CardTerminalEvent cte) throws CardTerminalException {
        throw new UnsupportedOperationException("Not supported yet.");
    }

    @Override
    public void cardRemoved(CardTerminalEvent cte) throws CardTerminalException {
        throw new UnsupportedOperationException("Not supported yet.");
    }
}
      
debug:
opencard.core.util.OpenCardPropertyLoadingException: property file not found
     at opencard.opt.util.OpenCardPropertyFileLoader.loadProperties(Unknown Source)
     at opencard.core.service.SmartCard.start(Unknown Source)
     at HostSideApp.<init>(HostSideApp.java:20)
     at HostSideApp.main(HostSideApp.java:30)
BUILD SUCCESSFUL (total time: 1 second)

Legend

  • Correct Answers - 10 points
  • Helpful Answers - 5 points