Solved

Java applet runing SmartCard Reader

Posted on 2013-06-24
6
911 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
Active Directory Webinar

We all know we need to protect and secure our privileges, but where to start? Join Experts Exchange and ManageEngine on Tuesday, April 11, 2017 10:00 AM PDT to learn how to track and secure privileged users in Active Directory.

 
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

Free Tool: SSL Checker

Scans your site and returns information about your SSL implementation and certificate. Helpful for debugging and validating your SSL configuration.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

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

Suggested Solutions

Java contains several comparison operators (e.g., <, <=, >, >=, ==, !=) that allow you to compare primitive values. However, these operators cannot be used to compare the contents of objects. Interface Comparable is used to allow objects of a cl…
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…
Viewers learn about the “while” loop and how to utilize it correctly in Java. Additionally, viewers begin exploring how to include conditional statements within a while loop and avoid an endless loop. Define While Loop: Basic Example: Explanatio…
Video by: Michael
Viewers learn about how to reduce the potential repetitiveness of coding in main by developing methods to perform specific tasks for their program. Additionally, objects are introduced for the purpose of learning how to call methods in Java. Define …

828 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