- Java use old version
- Important Oracle JDK License Update
- Java Language Java Compiler — ‘javac’ Compiling for a different version of Java
- Compiling old Java with a newer compiler
- Compiling for an older execution platform
- Customer Support
- How to Downgrade Java Version (Windows User) Print
- How to Fix the Unsupported Class Version Runtime Error in Java
- What is the UnsupportedClassVersionError Error and Why Does it Happen?
- How to Fix the UnsupportedClassVersionError Error
- Maven Projects
Java use old version
The JDK is a development environment for building applications using the Java programming language.
The JDK includes tools useful for developing and testing programs written in the Java programming language and running on the Java TM platform.
Important Oracle JDK License Update
The Oracle JDK License has changed for releases starting April 16, 2019.
The new Oracle Technology Network License Agreement for Oracle Java SE is substantially different from prior Oracle JDK licenses. The new license permits certain uses, such as personal use and development use, at no cost — but other uses authorized under prior Oracle JDK licenses may no longer be available. Please review the terms carefully before downloading and using this product. An FAQ is available here.
Commercial license and support is available with a low cost Java SE Subscription.
Oracle also provides the latest OpenJDK release under the open source GPL License at jdk.java.net.
WARNING: These older versions of the JRE and JDK are provided to help developers debug issues in older systems. They are not updated with the latest security patches and are not recommended for use in production.
These Java SE 8 update releases are provided under the Java SE OTN License.
Java SE 8u202 and older updates are available, under the Binary Code License (“BCL”).
For production use Oracle recommends downloading the latest JDK and JRE versions and allowing auto-update.
Only developers and Enterprise administrators should download these releases.
Downloading these releases requires an oracle.com account. If you don’t have an oracle.com account you can use the links on the top of this page to learn more about it and register for one for free.
For current Java releases, please consult the Oracle Software Download page.
Java Language Java Compiler — ‘javac’ Compiling for a different version of Java
The Java programming language (and its runtime) has undergone numerous changes since its release since its initial public release. These changes include:
- Changes in the Java programming language syntax and semantics
- Changes in the APIs provided by the Java standard class libraries.
- Changes in the Java (bytecode) instruction set and classfile format.
With very few exceptions (for example the enum keyword, changes to some «internal» classes, etc), these changes are backwards compatible.
- A Java program that was compiled using an older version of the Java toolchain will run on a newer version Java platform without recompilation.
- A Java program that was written in an older version of Java will compile successfully with a new Java compiler.
Compiling old Java with a newer compiler
If you need to (re-)compile older Java code on a newer Java platform to run on the newer platform, you generally don’t need to give any special compilation flags. In a few cases (e.g. if you had used enum as an identifier) you could use the -source option to disable the new syntax. For example, given the following class:
the following is required to compile the class using a Java 5 compiler (or later):
$ javac -source 1.4 OldSyntax.java
Compiling for an older execution platform
If you need to compile Java to run on an older Java platforms, the simplest approach is to install a JDK for the oldest version you need to support, and use that JDK’s compiler in your builds.
You can also compile with a newer Java compiler, but there are complicated. First of all, there some important preconditions that must be satisfied:
- The code you are compiling must not use Java language constructs that were not available in the version of Java that you are targeting.
- The code must not depend on standard Java classes, fields, methods and so on that were not available in the older platforms.
- Third party libraries that the code depends must also be built for the older platform and available at compile-time and run-time.
Given the preconditions are met, you can recompile code for an older platform using the -target option. For example,
$ javac -target 1.4 SomeClass.java
will compile the above class to produce bytecodes that are compatible with Java 1.4 or later JVM. (In fact, the -source option implies a compatible -target , so javac -source 1.4 . would have the same effect. The relationship between -source and -target is described in the Oracle documentation.)
Having said that, if you simply use -target or -source , you will still be compiling against the standard class libraries provided by the compiler’s JDK. If you are not careful, you can end up with classes with the correct bytecode version, but with dependencies on APIs that are not available. The solution is to use the -bootclasspath option. For example:
$ javac -target 1.4 --bootclasspath path/to/java1.4/rt.jar SomeClass.java
will compile against an alternative set of runtime libraries. If the class being compiled has (accidental) dependencies on newer libraries, this will give you compilation errors.
PDF — Download Java Language for free
Customer Support
How to Downgrade Java Version (Windows User) Print
Modified on: Wed, 19 Sep, 2018 at 8:26 AM
With upcoming changes to Java it may be necessary to revert back to an older version in order to continue using the streamer’s Web Start Installer without issue. In order to complete this task the first step will be to remove your current Java version, then follow our link to download an older version. The steps below will outline this:
— Click your Windows Icon (bottom left on your screen) to open the Start Menu, depending on your Windows version the Control Panel will be in a different place. The images below show how you can search within Windows 10, and also the location within Windows 7.
— Within Control Panel, select Install/Uninstall a Program
— You can choose to order this list alphabetically by clicking the Name Bar. Locate Java on this list and select Uninstall (Note: You may have multiple versions, if so, please contact our Support Department for assistance on which version to remove)
— The following window (or something similar) should appear, proceed by clicking Yes to remove Java. Please disregard the version number below, these images are for example purposes only.
— Windows should then being the Uninstall Process. You will see a window with a green bar appear, similar to below:
— Check your Program Files folder and ensure that Java is no longer present, you will notice Java is no longer present within the Uninstall or Change a program list from one of our previous steps (Start Menu > Computer ? (C:) Drive > Program Files)
— Following this link to Java 8u172 and select the Java SE Runtime Environment 8u172 (Note: x86 = 32-bit), we find that this works best with the Web Start Installer for the streamer. You will need to click Accept License Agreement (shown below in red)
— You may need to create an Oracle Account, this is a relatively short and simple process.
— An .exe (Executable) file will be downloaded, you will need to locate and open this file. If you use Google Chrome, the downloads bar is along the bottom of the Web Browser, Mozilla Firefox downloads are along the to the right hand side of the screen (see image). Click on the file to open
— This warning may appear, please click Run
— The Download should now begin, the following Window will appear and the green bar will start to load
— Java 8u172 is now installed on your Computer, you can confirm this on the Java Control Panel. Search: Java > Configure Java > General > About
— If you have any queries or run into any difficulty please contact our Support Department on 1877-367-5970 on via email [email protected]
Did you find it helpful? Yes No
How to Fix the Unsupported Class Version Runtime Error in Java
Runtime errors occur when a program is being executed and, in the case of compiled languages, after the program has been successfully compiled. Runtime errors are, therefore, harder to detect and prevent than compile-time errors [1]. In Java, some of these runtime errors (namely throwable objects which are not exceptions) are triggered at a very early stage, while the program is basically starting up. Namely, there is a process of dynamic loading, linking, and initializing of classes and interfaces by the Java Virtual Machine (JVM) that occurs at the very beginning of execution of any Java application [2]. This allows for a certain category of errors to be captured and dealt with before the program effectively starts.
This category of high level runtime errors in Java is represented by classes which are direct descendants of the java.lang.Error class [3], including the java.lang.LinkageError class which denotes errors occurring during the aforementioned startup process [4]. An instance of the Error class (or any of its subclasses) is a throwable object that a program is not expected or advised to handle, but instead, should cause immediate termination of the program. This is because most of these errors occur as a result of abnormal conditions, often so severe that it is impossible to know or control what further execution of the program might do. LinkageError instances in particular indicate critical class-related errors triggered during the class linking phase of the startup process, usually as a consequence of some post-compilation changes in the bytecode or the Java environment.
What is the UnsupportedClassVersionError Error and Why Does it Happen?
The java.lang.UnsupportedClassVersionError class extends java.lang.ClassFormatError which is thrown whenever the JVM attempts to read a class file and determines that the file is malformed or otherwise cannot be interpreted as a class file [5][6]. As per Java’s error class hierarchy (Figure 1), an instance of UnsupportedClassVersionError is also a LinkageError which means that the error is identified during the JVM class linking process.
The specific issue that the UnsupportedClassVersionError error raises is the detection of a class file which had been compiled with a newer version of Java than the one used to run it. For instance, if a specific .class file has been compiled with Java Development Kit (JDK) 15, trying to run it with Java Runtime Environment (JRE) 8 will trigger the UnsupportedClassVersionError error. This almost invariably happens when someone attempts to run a program with a JDK or a JRE version that is incompatible with, i.e., lower than the Java version in which the code was compiled.
How to Fix the UnsupportedClassVersionError Error
The solution to the UnsupportedClassVersionError error generally boils down to two options:
- Run the code with a newer version of Java/JRE, or
- Recompile the code with an older Java/JDK compiler.
As a variant of #2, recompiling the code can also be done by specifying the “target” or “release” parameter of a newer Java/JDK compiler to an earlier version of Java, to produce backward-compatible bytecode.
Before recompiling any code, it is important to know the runtime version of both the already compiled code and the environment in which it needs to run on. The message accompanying the UnsupportedClassVersionError error provides this information in the form of class file versions, which can be mapped directly to a specific Java version, using the values from the table below.
Maven Projects
When dealing with Maven projects, which the majority of both small and large enterprise Java programs are, it is possible to control the Java version targeted by the compilation process from the Maven configuration, i.e. Maven Project Object Model (POM) file. The relevant settings are shown in the Figure below.
Note that while it is possible to control the source and target versions independently, it is recommended to set them to equal values, as backward compatibility of the compiled bytecode cannot be guaranteed [8].
Can Constructors Throw Exceptions in Java
How to Fix and Avoid NullPointerException in Java
How to Fix «Illegal Start of Expression» in Java
«Rollbar allows us to go from alerting to impact analysis and resolution in a matter of minutes. Without it we would be flying blind.»