Solved

Java applet runing SmartCard Reader

Posted on 2013-06-24
6
883 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
How your wiki can always stay up-to-date

Quip doubles as a “living” wiki and a project management tool that evolves with your organization. As you finish projects in Quip, the work remains, easily accessible to all team members, new and old.
- Increase transparency
- Onboard new hires faster
- Access from mobile/offline

 
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

What Is Threat Intelligence?

Threat intelligence is often discussed, but rarely understood. Starting with a precise definition, along with clear business goals, is essential.

Join & Write a Comment

Suggested Solutions

After being asked a question last year, I went into one of my moods where I did some research and code just for the fun and learning of it all.  Subsequently, from this journey, I put together this article on "Range Searching Using Visual Basic.NET …
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…
Viewers learn about the third conditional statement “else if” and use it in an example program. Then additional information about conditional statements is provided, covering the topic thoroughly. Viewers learn about the third conditional statement …
This theoretical tutorial explains exceptions, reasons for exceptions, different categories of exception and exception hierarchy.

758 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

Need Help in Real-Time?

Connect with top rated Experts

22 Experts available now in Live!

Get 1:1 Help Now