Link to home
Start Free TrialLog in
Avatar of Rodrigoferra
Rodrigoferra

asked on

Java applet runing SmartCard Reader

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

Avatar of Valeri
Valeri
Flag of Bulgaria image

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
Avatar of Rodrigoferra
Rodrigoferra

ASKER

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!
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>
ASKER CERTIFIED SOLUTION
Avatar of Valeri
Valeri
Flag of Bulgaria image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Hello, thanks again!

I think that exist some cache, because it is not runing, do you know any issue related to it?
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.