Solved

Java applet runing SmartCard Reader

Posted on 2013-06-24
6
903 Views
Last Modified: 2013-06-24
Hello,

First of all, sorry for my bad english, I will try my best....

I´m developping an application with Java, an Applet that read the smart card an authorize the connection throw a website.

My problem is, at the Eclipse IDE the applet works and read the smart card connected, but when I export generating a simple jar, and open it at the browser, it won´t run, even if I create a JDialog panel only to show something, below is the code I´m using.

Thanks a lot!

public class SignerPje extends JApplet  {

	private static final long serialVersionUID = 1L;
	
	private JTextField rows = new JTextField("3"), cols = new JTextField("3");
	
	public void init() {
		
		JPanel p = new JPanel();
	    p.setLayout(new GridLayout(2,2));
	    p.add(new JLabel("Rows", JLabel.CENTER));
	    p.add(rows);
	    p.add(new JLabel("Columns", JLabel.CENTER));
	    p.add(cols);
	    Container cp = getContentPane();
	    cp.add(p, BorderLayout.NORTH);
	    JButton b = new JButton("go");
	    cp.add(b, BorderLayout.SOUTH);
		
	}
		
}

Open in new window

0
Comment
Question by:Rodrigoferra
  • 4
  • 2
6 Comments
 
LVL 16

Expert Comment

by:Valeri
ID: 39271761
You have to run the applet in browser in different way. You have to create an html page and then the applet will run in browser.
Please follow this link:
http://journals.ecs.soton.ac.uk/java/tutorial/getStarted/applet/running.html
0
 

Author Comment

by:Rodrigoferra
ID: 39271779
Hello @Valeri, I did it, with this code:

<object type="application/x-java-applet;version=1.4.1" width="500" height="500" name="pjeSignerObjects" id="pjeSignerObjects" style="position: absolute; top: -100px;">
	<param name="archive" value="appTestePjeCa2.jar" />
	<param name="code" value="br.com.pol.main.SignerPje" />
</object>

Open in new window


The problem is, the applet is not executing, I heard something about sign the applet and then it will be able to run files from the client. Is that correct?

Thanks!
0
 
LVL 16

Expert Comment

by:Valeri
ID: 39271856
you should use "applet" tag, not "object"
try this:

<applet code="br.com.pol.main.SignerPje.class"
        archive="appTestePjeCa2.jar"
        width="120" height="120">
</applet>
0
Use Case: Protecting a Hybrid Cloud Infrastructure

Microsoft Azure is rapidly becoming the norm in dynamic IT environments. This document describes the challenges that organizations face when protecting data in a hybrid cloud IT environment and presents a use case to demonstrate how Acronis Backup protects all data.

 
LVL 16

Accepted Solution

by:
Valeri earned 500 total points
ID: 39272058
I tested your applet with this html and it works on my PC :

<html>
 <p> This file launches the PJE applet!</p>  
<applet code="data.SignerPje.class" archive="test.jar"
        width="400" height="300">
No Applet
</applet>
</html>

the jar file and the html file are in one and the same folder. you have to change the package name in "code" and the jar name in "archive".
0
 

Author Comment

by:Rodrigoferra
ID: 39272386
Hello, thanks again!

I think that exist some cache, because it is not runing, do you know any issue related to it?
0
 
LVL 16

Expert Comment

by:Valeri
ID: 39272791
I think it's not because of cache...
If you use windows, next to the clock /at the right bottom/ of desktop should exists java icon. right click on it and open the java console. in case there are some errors you should be able ot fix them by tracing the stack traces on the console.
0

Featured Post

VMware Disaster Recovery and Data Protection

In this expert guide, you’ll learn about the components of a Modern Data Center. You will use cases for the value-added capabilities of Veeam®, including combining backup and replication for VMware disaster recovery and using replication for data center migration.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Title # Comments Views Activity
maven project error 5 57
Java JRE greater than 1.6 5 63
Java DateChooser? 3 37
How  Can  I  resolve   this  Error "java.sql.SQLException: Invalid column index" 4 40
Java had always been an easily readable and understandable language.  Some relatively recent changes in the language seem to be changing this pretty fast, and anyone that had not seen any Java code for the last 5 years will possibly have issues unde…
Introduction This article is the first of three articles that explain why and how the Experts Exchange QA Team does test automation for our web site. This article explains our test automation goals. Then rationale is given for the tools we use to a…
This tutorial covers a practical example of lazy loading technique and early loading technique in a Singleton Design Pattern.
This tutorial explains how to use the VisualVM tool for the Java platform application. This video goes into detail on the Threads, Sampler, and Profiler tabs.

832 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question