0

I am implementing an applet that gets some information from the user, including your name, is system administrator, machine architecture and more the certificates and smartcards plugged list, all this is for checking the prerequisites of another applet.

In Windows all works perfectly, but I have problems getting smartcards info in MAC (OS X Lion Mountain), probably caused by this bug: Bug DB:- JDK-7195480 : javax.smartcardio does not detect cards on Mac OS X.

I found the following possible solutions (I think):

  1. Use of another library without the bug as https://github.com/intarsys/smartcard-io
  2. I looked at these discussions:

For the first case I have the problem of lib be compiled to version 7, I need it to version 6, I did not succeed to compile for 6, and the extra JARs are to big (+- 4MB).

For the second case, apparently this does not work on Windows (docs oracle javase 6 docs technotes guides javaws developersguide syntax) And aparently have some limitations...

Does anyone know another lib (in Java 6) to get the smartcard information? I need only reader name, card name and ATR.

Or someone would know a way to force the JVM from a Applet (simple method)?

Please, try to be clarified because I am beginner in Java!

Community
  • 1
  • 1
  • In this discussion speaking about this bug and possible solution via JNA... But I not believe to be necessary a complex solution for something as simple! Obviously get a library without bug and working on java 6 would be ideal (the world is not ideal :-( ), but I settle managing to run the same applet forcing the JVM with-d32 ... – Pablo Ernesto Vigneaux Wilton Jun 30 '14 at 15:06
  • The lib in https://github.com/intarsys/smartcard-io works fine in Windows and OS X java 7u60 (tested), but I is sought to work in java 6. – Pablo Ernesto Vigneaux Wilton Jun 30 '14 at 15:08

1 Answers1

1

..Or someone would know a way to force the JVM from a Applet (simple method)?

We cannot really 'force' the user to do anything (not that we should), but by launching the applet using Java Web Start we can request particular versions of the JRE. Here's a rundown.

Java Web Start - Runtime Versioning

Java Web Start can be used to ensure that an application gains a certain minimum version of the JRE (Java Runtime Environment) that it requires to run. Web start can also be used to ensure a specific micro-version of the JRE is available to an application, or that an earlier major release is used (e.g. using 1.3, on a system where 1.6 is installed).

Unless the system is correctly configured, the user might be prompted for download.

Minimum Version

Java web start can be used to ensure a Java project is launched with a particular minimum version of Java. For example, if the application uses generics, but nothing beyond what is available in Java 1.5, the JNLP deployment descriptor might include a section that says..

..
<resources>
    <j2se version='1.5+'>
...
</resources>

Micro Version

Besides being able to specify a minimum Java Major version, the deployer can also mandate a particular micro-version. An example of where this can be handy, might be seen in changes to JRE's based on new information about Daylight Savings Time (which can be changed by regional governments at any time they see the need to change them).

..
<resources>
    <j2se version='1.5.0_11'>
...
</resources>

Earlier Version

Web start has a handy feature in that it can allow us to test applications against specific earlier Java versions. For example, if the local build environment is based around 1.6, but an application is supposedly 1.5+, it pays to test the final product in a 1.5 JRE prior to deployment. Invoking a 1.5 JRE in the 1.6 environment can be as simple as.

..
<resources>
    <j2se version='1.5'>
...
</resources>

Note the difference to the first example, which used '1.5+', whereas this one uses '1.5' - to indicate that only a 1.5 JRE will do.

An alternative version..

..
<resources>
    <j2se version='1.5*'>
...
</resources>

Prompt for Download

A problem commonly reported by people deploying applications via web start, is that they are being prompted to download versions of Java that are already locally installed.

Even if a specific Java version is installed, it might not be flagged as being 'available' for use by web start. This can be easily fixed.

Open the Java Control Panel.

<img src="jcp-javaapplication.gif">

Select the Java tab and click the View button of Java Application Runtime Settings. You might see something like this.

<img src="jcp-javaruntimesettings.gif">

Note which ones are Enabled (right column). This PC is set up to use 1.6.0, 1.5.0_11, or 1.5.0_08. Neither of the 1.5.0-beta or 1.5.0_01 micro versions is available. That is purely by my choice - if I needed to test against these very early 1.5 versions, I could simply enable them as needed.

Ensure any versions of interest are Enabled and the problem should be fixed. Web start will be able to load that version of the JRE and use it, without any prompt for download.

If you have versions installed that do not appear in the User list, click Find to launch the JRE Finder to search for them. The (Java 1.6) JRE Finder will present a dialog with a message along these lines.

In order to launch applications, Java Web Start needs to know the locations of installed Java Runtime Environments.

You can either select a known JRE, or select a directory in the file system from which to search for JREs.

A thread on the web start forum also produced the following comments from Andy Herrick.

On Windows, the list of available JRE's is populated from the registry which contains pointers to all the publicly installed JRE's. (It will not automatically include private JRE's, such as those installed by a JDK install, where "install public JRE" is not selected.).

On unix it will only, by default, contain the JRE it came with and any installed by java web start or that came with any previous version of java web start that had previously been run.

He adds a further note on specifying a download source..

Using either:

<j2se version="1.5*" href="http://java.sun.com/products/autodl/j2se">

or

<j2se version="1.5" >

will get you any 1.5 version available on the system.

If you use the href attribute, you are asking for the particular update release, so..

<j2se version="1.5" href="http://java.sun.com/products/autodl/j2se">

..will only work with 1.5.0_00.

Community
  • 1
  • 1
Andrew Thompson
  • 168,117
  • 40
  • 217
  • 433
  • I'll test and see if it works for me! And I will present to my client and see if he approves... – Pablo Ernesto Vigneaux Wilton Jun 30 '14 at 15:12
  • I'am reading your post and from what I understand with JWS I can only determine the minimum requirements of the JVM, this is correct? what about java-vm-args = "-d32" which is spoken in http://stackoverflow.com/questions/7714102/force-java-applet-to-run-in-32-bit-instead-of-64 -bit-jre ? Although in this link http://docs.oracle.com/javase/6/docs/technotes/guides/javaws/developersguide/syntax.html-d32 it is stated that this only works on unix platforms... – Pablo Ernesto Vigneaux Wilton Jun 30 '14 at 15:30