How to migrate java application form oracle jdk to openjdk? - java

we have one java application which is deployed in jboss application server and using java 1.8.0_202 version, now we want to change it to openjdk.
how can i change?
is there any code changes required?
please help me complete steps to be performed?
Thanks in advance..

No changes required to your codebase when switching between implementations of Java 8. Java is defined by a set of specifications along with JSRs and JEPs. Any implementation that complies with those specs will run your JBoss app server. Your existing WAR or EAR file will run as-is with no changes needed.
Understand that the OpenJDK project provides an implementation of Java as source code. The OpenJDK project does not provide binary builds nor installers. For builds and installers, you must locate a vendor. You have a choice of several, some free-of-cost and some that require a fee.
Here is a flowchart I made to help you choose a vendor.
This chart is aimed at Java 11, but many of these vendors also supply Java 8. Some, such as Azul Systems, have even back-ported features to Java 8 such as Flight Recorder.

Related

Whether Java SE is the same as JDK? [duplicate]

This question already has answers here:
Java JDK, SDK, SE?
(4 answers)
Closed 5 months ago.
Me has been fighting with internet for a while for that single answer. Everything else now seems standing on it's place after this trip.
When I ask "What's Java SE" they say "Java SE is set of core Java classes ...... platform ... develop desktop apps .... contains core libraries and APIs ..... Java EE is a spec set to be implemented ...... Java EE is built on top of the Java EE". Sometimes they mention javac and JVM, sometimes they don't. What they do never (almost) is mention JDK.
When I ask "What's JDK" they say "JDK is set of stuff that lets us build apps on Java including javac, JVM etc." and never (almost) mention Java SE.
When I ask "Difference between Java SE and JDK" they give me that page and nothing more to think about. What does this mean: "Java SE product name for JDK"? Can't clearly understang right now.
Lack of terminology presicion and experiece for me? Possibly yes. I think would be able to answer this question myself if I were more experienced.
The questions:
"Whether (Java SE) == (JDK) or not?" (pls with wide explanation and terminology clarifications when needed).
Is Java SE a spec set like Java EE or not?
Can I find precise definitions somewhere to look at?
Sorry for a big writing. It proves that I would really love to put an end to this.
“Java SE” is three things:
An abbreviation of “Java Standard Edition”
A trademark owned by Oracle Corp.
A set of specifications published by Oracle Corp.
Anybody in the world is free to write software that implements the Java SE specifications. In the past, several companies have done so.
However, anybody in the world is not free to use the trademark of Java. To use that trademark, a person or company is required to come to terms with Oracle in a licensing deal. Presumably that deal would require payment.
Long story short, and over-simplified for brevity… Some of the companies that previously wrote their own implementations of Java SE decided to join forces, combine their codebases, and publish the whole thing as open-source. These companies included Oracle, IBM, and Apple. Thus was born the OpenJDK project (Wikipedia). Since then, other companies and individuals have joined the project.
The OpenJDK name is a trademark owned by Oracle. However, Oracle has published permission allowing others to use the term with no payment required.
The OpenJDK project published source code to an implementation of the Java SE specifications. The project does not publish built binaries or installers.
Several vendors do publish built binaries or installers for implementations of the Java SE specs. Nearly all of these implementations rely largely, if not entirely, in the OpenJDK source code.
These binaries/installers vendors include, in no particular order:
Azul Systems
SAP
Amazon
Microsoft
IBM
Red Hat
Oracle
Adoptium
BellSoft
… and more.
Most of those built binary or installers products use OpenJDK in their name or in their descriptions, as allowed by Oracle. A few of those products may use the term Java or Java SE with explicit permission from Oracle.
There are other editions of Java technology:
Java Card (for smart cards, badges, etc.)
Java ME, or Micro Edition (for constrained devices)
Java EE, or Enterprise Edition (a wide collection of specifications that run on top of an implementation of the Java SE specs, aimed at developers making software for enterprise oriented users)
The first two, Java Card & Java ME are owned by Oracle. The third, Java EE, was donated by Oracle Corp to the Eclipse Foundation were it is now known as Jakarta EE. Jakarta EE is a collection of specifications, with various vendors publishing implementations.
The term “JDK” refers to Java Development Kit. This kit includes an implementation of the Java SE specs, plus tools to write Java apps. These tools include a compiler.
The term “JRE” refers to Java Runtime Environment. This is a JDK minus some of the software development tools.
The term “JVM” refers to Java Virtual Machine. A JVM is a piece of software that enables a Java-based app to execute at runtime on a particular kind of host computer and operating system. Java apps are platform-agnostic, in other words, are not “native”. So a Java app needs a particular JVM to know how to run on a Mac, on a PC, or on a mainframe.
Every JDK and every JRE contains a JVM.
1 . Yes, you can think of Java SE same as JDK.
Java SE is the 'base' platform that defines the Java language specification (JLS), the Java Virtual Machine Specification (JVMS), Standard library APIs, byte-code format, compilation tools, and the class loader.
Now, this is all concepts and specifications and community proposals (via JCP) until implemented into a set of software tools. The set of software and tools that implements all of the above is called JDK.
JDK is essentially a Software Development Kit (SDK). They simply decided to name it JDK.
2 . Yes, Java SE is basically a set of specs. An implementation must follow the spec and get it reviewed & approved by Oracle before they can call their implementation Java.
In the case of Java EE the specifications deal with libraries & APIs most of the time. In case of Java SE the specs also care about language and VM details. You take Java SE (the standard JDK) + add some libraries and now you have Java EE. Oracle refers to this as Java EE SDK though.
3 . Unless your life depends on it. Just understand the relationship between Java SE, Java EE, JDK, SDK, and you are good. Just connect the dots and be done with it.
I think your confusion stems from what Java is. Originally, most languages were like C, where you write code, and it gets compiled to a specific computer architecture/ISA (x86, ARM, whatever).
Java "changed the game" when it came on the market, because it was:
Free (many langs at the time were proprietary)
Enforced object oriented programming style (which all the cool kids were doing at the time)
It added the JVM. The JVM is installed on top of the ISA, it was a piece of middleware that meant that compiled Java code could "run anywhere" (in practice, this isn't strictly true, but it's aside the point)
Anyways, if you just need to run Java programs, you can just install the JVM/JRE (of which the JVM is a component). If you actually need to develop Java programs, you need one of these "editions," which supports more or less features, depending on what you are doing with it. If you're a hobbyist programmer, SE is fine. SE, EE, and ME all include the JRE, JVM and JDK.
For a start here is the language specification (what's the meaning of for) itself and the JVM (Java Virtual Machine) specification. A JVM knows how to execute the code in the end. (see https://docs.oracle.com/javase/specs/)
"Java SE" is the "Standard Edition" as opposed to "Java EE" which is the "Enterprise Edition"
Enterprises create webservers so Java EE specifies many things needed for running Java based Webservers like how to respond to web requests. There also additional libraries and webservers that adhere to that Java EE spec but they are still written in Java, i.e. what you do with plain Java (SE). See https://www.oracle.com/java/technologies/javaee-8-sdk-downloads.html
To run any kind of Java program you you'll need a JRE (Java Runtime Environment) which is in a way part of Java SE because it bundles all the core functionality of Java. The core libraries (like the implementation of the String class) as well as a JVM implementation (Oracle, OpenJDK, ...). Even an EE webserver would still require a JRE to run.
If you want to develop a Java program, you will also need a JDK (Java Development Kit) which is essentially a JRE plus extra tools, the compiler for example. The compiler takes .java files and create .class files which is what the JVM needs.
It's also in a way part JavaSE but I wouldn't says JavaSE = JDK.
Java SE and just "Java" is probably the same, the other terms all go into different aspects of Java.

Where to download latest JDK EE instead of glassfish

When i downloaded jdk ee few years ago, got "jdk-8u231-windows-x64.exe" file and installed it. It created "jdk1.8.0_231" folder and i have used it for JAVA_HOME.
But when i tried to download latest JDK EE now, i got "glassfish" folder in it.
What is this change ? Why is this change for ?
Note: I know Oracle gave Java EE to Eclipse and it is now called as Jakarta EE. But even in eclipse site or oracle site, i could only find glassfish downloads, not jdk ee.
Please help me to understand this.
Thanks
There is no such thing as a JDK EE.
JDK
A JDK is an implementation of the Java™ SE (Standard Edition) specifications. A JDK is composed of development tools such as a compiler, and of runtime tools that include a Java Virtual Machine (JVM) and an implementation of the standard libraries including the classes such as ArrayList, LocalDate, and so on.
The first sentence of the linked Wikipedia article on JDK is incorrect in claiming Oracle is the sole vendor. Oracle Corporation is but one of several vendors providing builds and installers for a JDK. Other vendors include, off the top of my head: Amazon, Azul Systems, Microsoft, Adoptium, SAP, BellSoft, Red Hat/IBM, Pivotal, and maybe more. Nowadays, most of these companies’ offerings are based largely or entirely on the open-source code base collaboratively built at the OpenJDK project. So you will find the quality and performance to be largely the same across these JDK products.
So your first chore is to choose a vendor and obtain and install a JDK. Some JDK products are free-of-cost and some require a fee. Be aware at the time of download. See Java Is Still Free for more information.
Choose a version of JDK appropriate to your choice of Jakarta EE product discussed below. Be aware that Java 8, 11, and 17 are the long-term support (LTS) versions of Java.
Jakarta EE
Jakarta EE, formerly known as Java EE (Enterprise Edition), is a collection of dozens of specifications for various kinds of enterprise-oriented software you may want to run on top of your Java SE JDK installation.
Most of these products are aimed at server-side usage. A few can also be used in desktop apps, such as Jakarta Bean Validation and Jakarta Contexts and Dependency Injection.
The Jakarta EE specifications are owned by the Eclipse Foundation, having been donated by Oracle Corp. Their further development is proceeding in a transparent open-source manner.
Several vendors provide implementations of the various Jakarta EE specifications. Some are available individually as a library to include in your app. And some vendors offer an assortment of products bundled together to be run as an application server.
The Glassfish product you mentioned in your Question is one such application server offering. Similar products from various vendors include Payara, Open Liberty, Wildfly, JBoss, and more.
Your second chore is to choose a vendor and obtain a Jakarta EE compliant application server product. You then install that on the same machine you installed the JDK.
If you are starting fresh on a new project, I would suggest using Java 17 with an app server compliant with Jakarta EE 9.1. Eclipse GlassFish 6.2.3 is one such product to consider. The Jakarta EE site maintains a list of compliant products.

How do I upgrade to jlink (JDK 9+) from Java Web Start (JDK 8) for an auto-updating application?

Java 8 and prior versions have Java Web Start, which auto-updates the application when we change it. Oracle has recommended that users migrate to jlink, as that is the new Oracle technology. So far, this sounds good. This comes with a host of benefits:
Native code on Windows, Mac and Linux
Modularization of the code (although Proguard does this as well)
The use of new, supported technology.
The problem: I can't find the canonical Java solution to auto-update with jlink.
One would think that Java Web Start could continue to be used, especially if one casually reads this document. Notice the fact that Java Web Start continues to be prominently listed. But there's a fly in the ointment: Oracle is deprecating Java Web Start. It's slated for removal in JDK 11. So, what's the official path forward. Failing that, is there a standard way that people proceed?
For the purposes of this question the following are out of scope:
Paying huge amounts of money yearly to someone with an feature-packed enterprise solution. The application to be distributed is already packaged into a single jar that is smaller than 50MB.
Forcing users to run an InstallShield style app to reinstall the new version, and then manually uninstall the old version every time an update is pushed. That's sooo 1990's.
Porting the entire app to be a webapp, rewriting the UI and client side logic to fit in a browser and dealing with all the incompatibilities that entails. The authors of the application worked on GWT and know exactly what web browsers are capable of. Unfortunately, they also know the level of effort required.
Allowing users to continue to run old versions of the application. That, too, is sooo 1980's. Modern apps update quickly, and supporting every version of the application ever released is not tenable. That's what my father's COBOL application had to deal with, and he didn't enjoy it. I'm hoping technology has progressed.
Continuing to use Java Web Start. Until/unless Oracle changes its mind, Java Web Start is a doomed technology.
In May 2019 commented to watch the OpenWebStart project.
Now (October 2019) it is time to give OpenWebStart serious consideration. While not yet feature complete, a alpha beta release of OpenWebStart is now available for download under a "GPL with Classpath exception" license.
The OpenWebStart Technical Details page states:
OpenWebStart is based on Iced-Tea-Web and the JNLP-specification defined in JSR-56. It will implement the most commonly used features of Java Web Start and it will be able to handle any typical JWS-based application. We plan to support all future versions of Java, starting with Java 11. In addition to Java 11, the first release of OpenWebStart will also support Java 8.
The page goes on to state that OpenWebStart will support interactive installers with auto-update, and non-interactive installers. Some JNLP features will be supported, and it will include a replacement for the Java Control Panel. A more comprehensive list of planned features1 and their implementation status is provided in the feature table.
1 - If you have a requirement that is not on their feature list (e.g. jlink support), you could contact the OpenWebStart team, and offer a suitable incentive (e.g. money to pay developers) to implement the feature for you. They also offer commercial versions of the software for paying customers.
Disclaimer: I have no connection with the OpenWebStart project, the company (Karakun) or the project sponsors. This is not a recommendation.
I had a similar problem in a past project. We needed to migrate from Webstart to another technology.
The first approach was to install IcedTea. It is directly bundled with the AdoptOpenJDK Project.
But as far as I understood the problem, Java wasn't meant to be installed on the Client side like this anymore and we didn't want problems with all of our customers.
Our solution was then building an own specific Executable, which connects to the server, ask for enviroment settings from the server side, and then download and extracts the JLink Java. So we could use the old technologies and just wrapped it in an Executable.
Last thing done then was redirecting to the download location of the Executable when calling the jnlp-URL.
Do you use maven?
I've resolved my similar problem with maven (I need to update an EAR).
My main app (the ear package) has a pom.xml with listed the dependencies and repositories.
The dependencies have the <version> tag with a range (documentation) as in this example
<version>[1.0.0,)</version>
That means : get version 1.0.0 or newer of the dependency. (You can put also an upper bound to the version, [1.0.0, 2.0.0) so if you develope a new version, it is not used in old app)
In the repository section I added my personal repository.
Now, in the remote machine I need only to rebuild my ear package with maven : the compiler download the newer version of my jar and put it together.
You need a system to check if there are newer dependencies version and warn the user to update the app and also lock its work (you can't work if you don't update). Maybe you need a little app to make users do the rebuild process easily. It's 1990's but a lot of desktop-app works in this way
PRO
This schema can be used in a lot of different projects.
CONTRO
You need to build the app in the remote machine, so the client must have a JDK and access to your repository (like artifactory);
You must write code in different jars and add them like dependencies in the main archive.
You must change JAR version each time and publish on the repository (this could be a good practice)

Can I install java but not Java SE?

I've got a little question (just for a cultural purpose).
Would it be possible to download and install Java but not the standard edition ?
I know that Java SE contains basic and usefull functions / librairies (such as input /output).
Installing java without the "SE" is maybe useless and without any interest, but is it possible? if yes how ?
Many thanks,
Installing java without the "SE" is maybe useless and without any interest, but is it possible?
It is not possible. Oracle don't distribute a form of Java without libraries.
In fact, there is no such thing as Java without the libraries (SE or ME). The libraries are part of Java(tm) platform. If you managed to create something with the Java language and a JVM, but with partial, missing or incompatible libraries you couldn't call it Java1. Oracle owns the Java trademark, and they dictate the terms under which you are allowed to use it. If you used "Java" for a JVM / Library combination that doesn't pass the standard Java compatibility tests, you would likely get a "cease and desist" letter from Oracle's lawyers!
But more importantly, there is a significant subset of the Java SE runtime libraries that are essential for bootstrapping a JVM. If you were to build your own (ahem) Java build that left out critical classes, your JVM wouldn't work.
(And you cannot just simply2 write your own replacement for the Java SE library subset that the JVM depends on. There are many places where the C / C++ codebase for the OpenJDK JVM has intimate knowledge of the implementation details of the Java libraries. Figuring it all out ... from scratch ... would be challenging.)
Having said that, in Java 9 they introduced a tool called jlink which will produce a cut-down Java SE runtime for an application that only contains the libraries that are required by the application. Your can read about it here.
1 - For example, the Sun vs Microsoft lawsuit over Microsoft's attempt to "embrace and extend" Java 1.1. See What does Sun's lawsuit against Microsoft mean for Java developers?
2 - It's not impossible. Just a lot of really hard work.
The java command is traditionally from a SE installation. Typically in the JRE form, but occasionally I the JDK variation for advanced users. Others exist but are not for desktop usage.
So in that view you cannot install java without SE.
(note: Java EE is not a distribution as such but an API typically provides by big web servers)
Can I install Java but not Java SE?
Install? No. Not from any "official" distributions provided by Oracle, at least.
Why not?
Because Oracle doesn't package it that way. They offer 1) a Java SE development kit (JDK) which lets you create Java programs for yourself, or 2) a Java SE JRE which just lets you run Java programs that someone else created. There is no 3) Java without SE.
But couldn't they have given us option #3?
Could they have? Probably. Well, OK, maybe. Did they? No.
But theoretically it's possible, right?
Theoretically, I don't see why not. Theoretically, it ought to be possible to come up with a "Java" that's little more than a virtual machine and a compiler. Then, theoretically, using only this non-Java-SE Java language, you could either replicate the Java SE environment or develop an entirely new Java-based development platform.

sun's application server?

in a tutorial they asked me to install the application server which could be downloaded from their site.
what do they mean with application server?
the link they provided: http://java.sun.com/javaee/downloads/index.jsp
i mean come on sun, all these names. jdk then j2ee..and when i wanna download j2se it says jdk6. r they insane? a lot of people are wondering what is what...they just dont know how to name things.
however, back to the question. so with application they mean java ee server?
i've got a mac and people say java is already installed. what is installed exactly? the j2ee or j2se? do i have do download j2ee? Java is just killing me...
EDIT: read something about that the application server is a name for ee server. and there are many ee servers like tomcat, jetty and glassfish. and i know these sometimes are called servlet containers.
so that makes application server = ee server = servlet container?
and jdk = j2se? so j2ee != jdk?
Sun's Application Server has been superseded by the community app server, GlassFish.
The JavaEE download page only has two JavaEE6 download links and both contain versions GlassFish v3. Chances are you only need the web profile, but download the full version if you aren't sure.
Note that GlassFish is just the reference Application Server. You also have other Application servers, such as Apache Geronimo and Oracle Weblogic... as well as ones that are just servlet containers, like Apache Tomcat and Jetty. These types should correspond to GlassFish's normal and web profiles respectively.
These other servers only require a JRE to run applications, or the JDK to develop for them.
Side Note: GlassFish v3 is the only JavaEE 6-compliant server... JavaEE 6 is brand new. The others should be JavaEE 5 compliant.
Also, JavaEE is the new name for J2EE, as sun tries to move away from the Java 2 name.
What do they mean with application server? The link they provided: http://java.sun.com/javaee/downloads/index.jsp
An application server is a component-based middleware used in server centric N-tier architecture. It manages the life-cycle of components deployed on it, it provides services for state maintenance, data access (with pooling of resources), security, clustering and fail-over.
AFAIK, one of the first application server (as just defined above) was ATG Dynamo. Other proprietary application servers include BroadVision, ColdFusion, etc. But none of them really survived to the advent of Java application servers (understand application servers based on the standards defined by Java EE and the Java language).
I mean come on sun, all these names. (...)
Wikipedia does a pretty good job at defining what Java SE is:
Java Platform, Standard Edition or Java SE is a widely used platform for programming in the Java language. It is the Java Platform used to deploy portable applications for general use. In practical terms, Java SE consists of a virtual machine, which must be used to run Java programs, together with a set of libraries (or "packages") needed to allow the use of file systems, networks, graphical interfaces, and so on, from within those programs.
The JRE (Java Runtime Environment) provides the virtual machine and the set of libraries i.e. everything you need to run Java software. The JDK (Java Development Kit) provides a JRE plus a compiler (javac) and some other tools i.e. everything you need to run and develop Java software.
Java EE is a specification (more precisely, a set of specifications) built on top of the libraries provided by Java SE and is more server-side oriented. Implementations of this specification are provided by Java application servers: GlassFish is Sun's implementation, JBoss is RedHat's implementation, WebLogic is BEA Oracle's implementation, WebSphere is IBM's implementation, etc.
Regarding the versions and nomenclature, yes, Sun is crazy. It was an horrible mistake to introduce this "Java 2 Platform, Standard Edition" naming when the version 1.2 came out. I can imagine how confusing this is. But, again, Wikipedia does a great job at clarifying this in the section Nomenclature, standards and specifications:
Java SE was known as Java 2 Platform, Standard Edition or J2SE from version 1.2 until version 1.5. The "SE" is used to distinguish the base platform from Java EE and Java ME. The "2" was originally intended to emphasize the major changes introduced in version 1.2, but was removed in version 1.6. The naming convention has been changed several times over the Java version history. (...)
This should make things more clear.
(...) however, back to the question. so with application server they mean java ee server?
Yes, this is what they mean or, more precisely, they mean Sun GlassFish Enterprise Server (previously named Sun Java System Application Server). Source: http://developers.sun.com/appserver/.
I've got a mac and people say java is already installed. what is installed exactly? the j2ee or j2se? do i have do download j2ee? Java is just killing me...
A JRE or a JDK (if javac available, it's a JDK), so only the Java SE part. And actually, if you are still following me, you don't download Java EE, you download something providing an implementation of it (i.e. an application server).
(...) so that makes application server = ee server = servlet container?
No. To simplify, a Java EE server = Servlet container + EJB Container. Some server are only Servlet container (like Tomcat, Jetty), they don't provide the EJB container part and thus don't fully implement the Java EE specification and can't be considered as full Java EE servers.
and jdk = j2se? so j2ee != jdk?
I hope I covered this with my answer.
In order to run you Java EE applications you need an application server.
The link you provided is to download GlassFish that is one application server.
There are others application servers like Apache Tomcat, Jboss.
JDK stands for Java Development Kit
You need this to develop Java applications.
JRE stands for Java Runtime Environment
You need this to run Java applications.
GlassFish with the Java EE SDK (provided on the link you gave) is what you need. Java EE server = application server.
What is installed on your Mac by default is probably only a JRE (runtime environment) and not a JDK (development kit). Which means, you can run Java apps but not develop. By downloading GlassFish with the Java EE SDK, you'll get the full-blown SDK you need and a server to deploy on.
Hope that helps.

Categories