Require a specific minimal Java version for an Applet - java

My clients have JRE 1.3.x and 1.5.x installed, and when I use the <applet> tag, 1.3.x is often loaded by default by the browser. How can I request the browser to use JRE 1.5.x in this case?
Note: JRE upgrade on customer side is not an option.

Not sure how it works for other browser. Here is an article to where you can specify a JRE family version for a Java applet to run in Java Plug-in for Internet Explorer.
Reference doc : JavaTM Plug-in and Applet Architecture

Use deployJava.js to deploy the applet. For the version, specify it as:
var version = '1.5';

Related

JDK and JRE minimal versions required for GWT (compiling and running)

What is JDK minimal version is required for compiling GWT client code (I think JDK 1.7 for GWT 2.7) ?
What is JRE minimal version is required for running GWT RPC on servlet container (I think JRE 1.5 for GWT 2.7) ?
The only answer I found is GWT FAQ is JRE 1.5 but for compiling or running ? It is not clear for me.
In fact, I want to know what the JDK required for a developer computer and what the JRE required for a production server.
According to the build files, GWT 2.7 (and actually since 2.5.0) required Java 6: GWT is compiled with Java 6, producing Java 6-compatible classes, and runs its own tests with Java 6.
Note that GWT 2.8.0, to be released later this spring, will require Java 7.

Java Applet deployment to multiple JRE

Folks,
I have the following challenge, I would like to deploy an Applet which relies on Java 1.8 syntax into hundreds of client workstations already running an old Java Applet which relies on Java 1.5
The problem is, I do not have access to the Java 1.5 Applet code and even not to it's launcher Html page. Alas, this launcher Html page relies on the Applet tag and will therefore attempts to load the most recent Java plugin version installed on the workstation.
I don't like to rely on any virtualization solution, I have to run as a Java Applet, perhaps Web Start can be considered if you think it would help.
My questions are:
Is there a local workstation configuration/hack to tell the browser to load a specific (old) Java version when rendering the Applet tag ?
Otherwise, is there a way to use Java Web Start to workaround this problem and somehow run my newer Java Applet without updating the "official" workstation Java plugin version ?
Ok you ask several questions, here are some answers:
It is not possible to run Java 1.8 code with a "lower" JRE/JDK like 1.7, 1.6 or 1.5. The other way around however is possible - you can use Java 1.8 to run a java 1.5 applet...
You don't need to hack your workstation - if you only install one java version (even if it is an older one) and it is installed/configured correctly that version will be used to start your applet
With the next generation plugin (introduced since 6u10) it is possible to start your applets with a jnlp file. The jnlp syntax allows you to specify a specific java version and if that one is not installed it will/can be downloaded. One example would be:
<j2se version="1.6.0_10" href="http://java.sun.com/products/autodl/j2se"/>
Some general idea, please correct me if I didn't fully understand you:
You want both applets to run, right?
For that to work you will have to change something at some point. Possibilities (My answer disregards security - from this perspective always use the latest java version):
Install the latest Java 1.8 and sign your old applet. Signing an applet doesn't require the source code - just access your webpage, run the applet and then search java cache for the applet.jar. Sign it with an official certificate and deploy it on your server. (Additionally this may require adding some Manifest attributes as well)
Downgrade your new applet to java 1.7 or 1.6 and install an older Java like 1.7.0_17. Until Java 1.7.0_21 signing was not mandatory. If you see the baseline for Java 6 it would be version 1.6.0_43.
Theoretically you can use jnlp to define an exact java version which should be used to run an applet. The problem is, that it was introduced starting with 1.6.0_10 - thus your 1.5 java does not suffice. If it is possible to run your old applet with a slightly newer java and also add a jnlp file to your webpage then it could work. For that you would need to: Install two newer java versions: One 1.6.0_10 or higher (until 1.6.0_43, or 1.7_17) and the latest 1.8.0_X. Then in the jnlp file define your exact 1.6/1.7 java. When accessing your web page the 1.8 plugin will be started which detects that an older java version is required and then the older version will be started afterwards. For your newer applet the latest java will be used...

Install4J with Java 1.6 & security

I'm about to release a new version of my app. I'd prefer to stick with Java 1.6 since it's been fully tested using that JVM. I use install4J.
On the Mac I don't package a JVM, relying on the presence of Apple's JVM. As I understand it they've disabled the browser plugin by default so security isn't an issue.
I do however package a 1.6 JVM with the windows version. Am I correct in believing that the packaged 1.6 JVM doesn't have and more security risks than the latest 1.7 JVM since it won't be used by the browsers?
Thanks.
Thats just a question of updated software, older versions still safe. but using then in the browser can be such a problem just because of websites checking java version.
http://www.java.com/en/download/faq/remove_olderversions.xml
take a look at that link it should help

How to open html file in default browser in JDK 1.4

I see a lot of JDK 1.6 notes about how to open an HTML file in the default browser but none for JDK 1.4.
Does anyone have any experience with that?
browserlaunch2 has worked for me in the past.
You can use same code as in version 1.6, just add a reference to JDesktop integration jar. I think (but I'm not 100% sure) this is actually the same library you get with Java 1.6, it was developed as a separate project by Sun before they include in Jdk 1.6.

Where's javax.servlet?

I have jdk1.6.0_13 installed, but when I try to find a javax.servlet package, or press Ctrl+Space in Eclipse after Servlet I cannot get anything. Where can I download this package, and why isn't it included in standard distribution for developers?
javax.servlet is a package that's part of Java EE (Java Enterprise Edition). You've got the JDK for Java SE (Java Standard Edition).
You could use the Java EE SDK for example.
Alternatively simple servlet containers such as Apache Tomcat also come with this API (look for servlet-api.jar).
A bit more detail to Joachim Sauer's answer:
On Ubuntu at least, the metapackage tomcat6 depends on metapackage tomcat6-common (and others), which depends on metapackage libtomcat6-java, which depends on package libservlet2.5-java (and others). It contains, among others, the files /usr/share/java/servlet-api-2.5.jar and /usr/share/java/jsp-api-2.1.jar, which are the servlet and JSP libraries you need. So if you've installed Tomcat 6 through apt-get or the Ubuntu Software Centre, you already have the libraries; all that's left is to get Tomcat to use them in your project.
Place libraries /usr/share/java/servlet-api-2.5.jar and /usr/share/java/jsp-api-2.1.jar on the class path like this:
For all projects, by configuring Eclipse by selecting Window ->
Preferences -> Java -> Installed JREs, then selecting the JRE you're
using, pressing Edit, then pressing Add External JARs, and then by
selecting the files from the locations given above.
For just one
project, by right-clicking on the project in the Project Explorer
pane, then selecting Properties -> Java Build Path, and then pressing
Add External JARs, and then by selecting the files from the locations
given above.
Further note 1: These are the correct versions of those libraries for use with Tomcat 6; for the other Tomcat versions, see the table on page http://tomcat.apache.org/whichversion.html, though I would suppose each Tomcat version includes the versions of these libraries that are appropriate for it.
Further note 2: Package libservlet2.5-java's description (dpkg-query -s libservlet2.5-java) says: 'Apache Tomcat implements the Java Servlet and the JavaServer Pages (JSP) specifications from Sun Microsystems, and provides a "pure Java" HTTP web server environment for Java code to run. This package contains the Java Servlet and JSP library.'
Have you instaled the J2EE? If you installed just de standard (J2SE) it won´t find.
The normal procedure with Eclipse and Java EE webapplications is to install a servlet container (Tomcat, Jetty, etc) or application server (Glassfish (which is bundled in the "Sun Java EE" download), JBoss AS, WebSphere, Weblogic, etc) and integrate it in Eclipse using a (builtin) plugin in the Servers view.
During the creation wizard of a new Dynamic Web Project, you can then pick the integrated server from the list. If you happen to have an existing Dynamic Web Project without a server or want to change the associated one, then you need to modify it in the Targeted Rutimes section of the project's properties.
Either way, Eclipse will automatically place the necessary server-specific libraries in the project's classpath (buildpath).
You should absolutely in no way extract and copy server-specific libraries into /WEB-INF/lib or even worse the JRE/lib yourself, to "fix" the compilation errors in Eclipse. It would make your webapplication tied to a specific server and thus completely unportable.
If you've got the Java EE JDK with Glassfish, it's in glassfish3/glassfish/modules/javax.servlet-api.jar.
those classes are usually part of servlet.jar
http://www.java2s.com/Code/Jar/wsit/Downloadservletjar.htm

Categories

Resources