Click here to Skip to main content
15,890,123 members
Home / Discussions / Java
   

Java

 
Questionadding smileys to client server program in java Pin
Member 1111353426-Sep-14 23:02
Member 1111353426-Sep-14 23:02 
AnswerRe: adding smileys to client server program in java Pin
Richard MacCutchan27-Sep-14 2:24
mveRichard MacCutchan27-Sep-14 2:24 
QuestionRunning Java Code Errors: Console Output Result Termination Pin
Member 1109874321-Sep-14 9:59
Member 1109874321-Sep-14 9:59 
AnswerRe: Running Java Code Errors: Console Output Result Termination Pin
Richard MacCutchan21-Sep-14 21:14
mveRichard MacCutchan21-Sep-14 21:14 
GeneralRe: Running Java Code Errors: Console Output Result Termination Pin
Member 1111160626-Sep-14 0:52
Member 1111160626-Sep-14 0:52 
QuestionRe: Running Java Code Errors: Console Output Result Termination Pin
Richard MacCutchan26-Sep-14 0:59
mveRichard MacCutchan26-Sep-14 0:59 
AnswerRe: Running Java Code Errors: Console Output Result Termination Pin
Member 1115477414-Oct-14 23:59
Member 1115477414-Oct-14 23:59 
Questionhow to read mifare card using java smratcardio? Pin
Member 1102461020-Sep-14 17:40
Member 1102461020-Sep-14 17:40 
hello, Im having a trouble on how to read the Mifare card using Java smartcardio.

For now, I write a code that can only read the apdu of the card. hope i can help from you guys, thanks
Java
package nfctry;
//import java.io.*;
import javax.swing.*;
import java.util.*;
import javax.smartcardio.*;
import javax.swing.JOptionPane;

//import java.security.*;
//import java.net.URL;

public class NFCr {

  final protected static char[] hexArray = "0123456789ABCDEF".toCharArray();

  public static String bytesToHex(byte[] bytes) {
    char[] hexChars = new char[bytes.length * 2];
    int v;
    for ( int j = 0; j < bytes.length; j++ ) {
      v = bytes[j] & 0xFF;
      hexChars[j * 2] = hexArray[v >>> 4];
      hexChars[j * 2 + 1] = hexArray[v & 0x0F];
      
    }
    return new String(hexChars);
    
  }

  public static void main(String[] args) throws Exception {
    TerminalFactory factory = TerminalFactory.getInstance("PC/SC",null);
    System.out.println(factory);
   
    
    List<CardTerminal> terminals = factory.terminals().list();
    System.out.println("Terminals: " + terminals);
    if (terminals.isEmpty()) {
      throw new Exception("No card terminals available");
    }

    CardTerminal terminal = terminals.get(0);
      
    // Keep looping looking for cards until the application is closed
    while( true )
    {
      terminal.waitForCardPresent( 0 );
      try {
        Card card = terminal.connect("*");
        CardChannel channel = card.getBasicChannel();

       CommandAPDU command = new CommandAPDU(new byte[]{(byte)0xFF,(byte)0xCA,(byte)0x00,(byte)0x00,(byte)0x04});
     
        
        
        ResponseAPDU response = channel.transmit(command);

        byte[] byteArray = response.getBytes();
       
        //JOptionPane.showMessageDialog(null, bytesToHex( byteArray ) );
      System.out.println(bytesToHex( byteArray ) );
         
        
        //System.out.println("Name : " + bytesToHex.convertHexToString(byteArray));
      
     
        Thread.sleep(1000);
      } catch (CardException e) {
        e.printStackTrace();
      } finally {
	}
    }
  }
}

QuestionRe: how to read mifare card using java smratcardio? Pin
Richard MacCutchan20-Sep-14 20:48
mveRichard MacCutchan20-Sep-14 20:48 
AnswerRe: how to read mifare card using java smartcardio? Pin
Member 1102461020-Sep-14 21:08
Member 1102461020-Sep-14 21:08 
GeneralRe: how to read mifare card using java smartcardio? Pin
Richard MacCutchan20-Sep-14 21:24
mveRichard MacCutchan20-Sep-14 21:24 
Questiondate validation Pin
20siva20-Sep-14 4:43
20siva20-Sep-14 4:43 
AnswerRe: date validation Pin
Richard MacCutchan20-Sep-14 20:48
mveRichard MacCutchan20-Sep-14 20:48 
GeneralRe: date validation Pin
20siva21-Sep-14 4:11
20siva21-Sep-14 4:11 
GeneralRe: date validation Pin
Richard MacCutchan21-Sep-14 7:48
mveRichard MacCutchan21-Sep-14 7:48 
QuestionEncoding / Decoding 7 bit User Data for SMS PDU (PDU Bit Packer) using java Pin
Member 1104686618-Sep-14 20:54
Member 1104686618-Sep-14 20:54 
AnswerRe: Encoding / Decoding 7 bit User Data for SMS PDU (PDU Bit Packer) using java Pin
Richard MacCutchan18-Sep-14 22:20
mveRichard MacCutchan18-Sep-14 22:20 
QuestionJSoup and XSoup "Couldn't parse query" Pin
DevvsBugs18-Sep-14 5:13
DevvsBugs18-Sep-14 5:13 
Generalhow to close the modal dialog so that it return to parent window by using button ? Pin
Member 1087484117-Sep-14 1:08
Member 1087484117-Sep-14 1:08 
GeneralRe: how to close the modal dialog so that it return to parent window by using button ? Pin
Richard MacCutchan17-Sep-14 2:43
mveRichard MacCutchan17-Sep-14 2:43 
GeneralRe: how to close the modal dialog so that it return to parent window by using button ? Pin
Member 1115477415-Oct-14 0:09
Member 1115477415-Oct-14 0:09 
QuestionPulling data from QC and displaying it as graphically Using Java Pin
Member 1108581215-Sep-14 23:23
Member 1108581215-Sep-14 23:23 
QuestionCrossword Pin
Madhusudan H15-Sep-14 10:29
Madhusudan H15-Sep-14 10:29 
AnswerRe: Crossword Pin
Richard MacCutchan15-Sep-14 21:29
mveRichard MacCutchan15-Sep-14 21:29 
Questionneed help for creation of graph in main memory and traversing the graph in java Pin
Member 1108183214-Sep-14 11:05
Member 1108183214-Sep-14 11:05 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.