?
Solved

Java applet runing SmartCard Reader

Posted on 2013-06-24
6
Medium Priority
?
986 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
Concerto Cloud for Software Providers & ISVs

Can Concerto Cloud Services help you focus on evolving your application offerings, while delivering the best cloud experience to your customers? From DevOps to revenue models and customer support, the answer is yes!

Learn how Concerto can help you.

 
LVL 16

Accepted Solution

by:
Valeri earned 2000 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

Vote for the Most Valuable Expert

It’s time to recognize experts that go above and beyond with helpful solutions and engagement on site. Choose from the top experts in the Hall of Fame or on the right rail of your favorite topic page. Look for the blue “Nominate” button on their profile to vote.

Question has a verified solution.

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

Introduction Java can be integrated with native programs using an interface called JNI(Java Native Interface). Native programs are programs which can directly run on the processor. JNI is simply a naming and calling convention so that the JVM (Java…
In this post we will learn different types of Android Layout and some basics of an Android App.
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 …
Viewers will learn about arithmetic and Boolean expressions in Java and the logical operators used to create Boolean expressions. We will cover the symbols used for arithmetic expressions and define each logical operator and how to use them in Boole…
Suggested Courses
Course of the Month13 days, 8 hours left to enroll

749 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