Jsp 's are compiled into older java version - java

At the moment i'm migrating an application to java 8. This application id deployes on WAS 8.5.5.9 (Full profile). The application is working fine. Java 8 code is also working. So sar so good. But when I take a closer look to the compiled jsp's I see that they are compiled into java 6. Anyone who knows whats the problem and how I can solve this?

Related

Java dynamic web project error on startup

migrating from C++ to java so starting today wanted to follow some tutorials but, when I create new dynamic web project, get error straight away in web.xml file. I installed java 11 se and downloaded java 8ee but not linked anywhere yet, also installed and linked tomcat 10.
ERRORS
Could anyone know problem here?
Thank you in advance
SOLVED:
To get rid of first 5 errors change Java version to the installed on machine
To get rid of xml error, change xmlns="http://java.sun.com/xml/ns/j2ee to
xmlns="http://Java.sun.com/xml/ns/j2ee make Java upper case

Bad class file magic or version NOT related with versions of JDK

This is definitely not a duplicate of other similar questions, since in my case no Java lower that 8 in used anywhere.
In fact, I am trying to built my Android app and a new version of jar libraries cause this problem.
The thing is that these libraries run only on Java 8 and I have only Java 8 installed in my system.
Any ideas on where I should look? I am stuck here for days.
Thanks!

How to set NetBeans project properties to use Java 7?

I am new to NetBeans, and have previously been using Eclipse. I have started using NetBeans now because I need to learn a variety of Java EE concept, and I have found more relevant tutorials for the NetBeans IDE. A lot of the abstract concepts in EE still has me confused, so I have found that step-by-step holding hands-tutorials works best for me for now.
I have however met a dead end. I am following this tutorial, on setting up a web service client. However, one of the lines include a try-with-resource statement, which is new in java 7. Picture here:
When I started this tutorial, I was using Netbeans 7.1.3, with Glassfish 3.1.2. I knew it didn't have support for EE7, so i downloaded NetBeans 8.0.1 with Glassfish 4.1. I have realized later on that the try-with-resources is a part of SE, and my upgrade was in this matter reduntant.
I figured there was something wrong with my project settings, so i right-clicked it and opened it's properties. Under the Libraries option, I found that the JDK was correctly set to Java 1.7 (update 51). Picture here:
I also checked the oter options, and under Run I found that Java EE is set to 6, even though Glassfish 4.1 is selected as server. I figured this was an implementation of EE7, but the option is locked to EE6. This confuses me a bit, but shouldn't be the cause of the problem. I still attach a picture of it, just in case it is relevant:
So what is wrong with my Java settings for this project? Why can't it accept a Java 7 feature, when it seems like it is set to use Java 7? Are there other places where i need to set java version/home?
You use Java7 for the system library but compile your source code to be compatible with Java6.
To change this you have to go to sources in your project settings and change the source compatibility to Java7.

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...

Java : Is there a tool to make code (in a 3rd party JAR) forward compatible (1.4 - 1.6)

I have a 3rd party JAR file that is compiled using Java 1.4. Is there a tool that can make the jar file compatible with Java 1.6? (Something like 'retrotranslator' but what does the reverse of it).
I tried decompiling the class files and re compile them in 1.6 but it fails.
Here is the issue:
My project uses 'rsadapter.jar' for was 5.1 and I had my project setup in Eclipse 2.0 + JDK 1.4 and it used to work fine. Now, I have migrated to Java 1.6 and Eclipse Ganymede (as per the requirements) and the same project (exactly same setup) started complaining about the missing class files in the 'rsadapter.jar'. I put the JAR in classpath explicitly too but it still could not load the classes. Then I changed the Java Compiler version to 1.4 and it started working.
Regards,
- Ashish
Classes compiled by JDK 1.4 should be usable in a Java 6 runtime as-is. If you have actually encountered a problem, please describe it.
Update: I can only reproduce this with types in the "default" package (that is, not in a package). Are the classes you are trying to use in the default package? Also, this happens to me regardless of the JDK version used to compile.
Update: Okay, after a little research, I realized that you can never reference a type in the unnamed package from a named package. Makes sense, but definitely not what you are running into.
I can compile code under JDK 1.4.2_19 and utilize it just fine in a Java 6 Eclipse project. I think that this problem is something specific to your environment. In this situation, I would backup Eclipse and recreate everything (JDK installation, workspace, projects) from scratch, to see if I could clear it up.
I had another issue with some legacy code written in Java 1.4.x: the authors loved enumerations and loved to name the corresponding variables 'enum'. They even used it for package names. And this prevents from compiling the code under Java 1.5 (or higher) quite successfully.
Changing that automatically is quite an issue.
May be you have defined Eclipse to throw compiler errors on use of deprecated methods or classes?

Categories

Resources