Porting a Java 8 application to Java 11
I have been trying to port a Java 8 desktop application to Java 11. I have a high level idea of how Java 9 and after are different from Java 8. eg: support for modularization, JDK is modular, no separate JRE.
Overall it is my understanding that the process of porting to Java 11 consists of the following steps:
- Find out what dependencies are going out of support in Java 9 or later. We use
jdeps -jdkinternals
tool found in Java 8 jdk for this. - The dependencies found in
Step 1
may be handled in two ways:
a. If the dependency package is still there in Java 9 or later, but is just encapsulated, then use --add-exports command to make the JDK export those packages.
b. If the dependency package has been removed from Java, I will have to change the application's code to use a replacement package.jdeps
tool will give me the replacement package to use. - Once the issue of unsupported dependencies has been resolved, we use
jdeps --list-deps
on all the jars (both generated by our program and used by our program) to get to know about the packages of JDK to include in runtime. - Once the dependencies are listed, we provide
jlink
of Java 11 to build a runtime for the application.
Am I correct in understanding this process? What are the surprises I might face?
UPDATE:
The comments below say that a custom runtime using jlink may not be required. However, we had problems using normal Java 8 runtime. Posting details below for more context.
The project we have been trying to port is Arduino and are using Mac OS to do that. Arduino uses Ant
to build. The build.xml
is here. What we initially did is change JAVA_HOME to point to Java 11 and use ant dist to compile it. For some reason, the application doesn't compile on Java 11 till you remove ../ at the end of line 69 in build.xml. After this the application compiled and provided an executable at the path given at line 512 of build.xml. But when we try to run the executable, it gives the error Java Runtime
not found.
java java-8 arduino-ide java-11
|
show 3 more comments
I have been trying to port a Java 8 desktop application to Java 11. I have a high level idea of how Java 9 and after are different from Java 8. eg: support for modularization, JDK is modular, no separate JRE.
Overall it is my understanding that the process of porting to Java 11 consists of the following steps:
- Find out what dependencies are going out of support in Java 9 or later. We use
jdeps -jdkinternals
tool found in Java 8 jdk for this. - The dependencies found in
Step 1
may be handled in two ways:
a. If the dependency package is still there in Java 9 or later, but is just encapsulated, then use --add-exports command to make the JDK export those packages.
b. If the dependency package has been removed from Java, I will have to change the application's code to use a replacement package.jdeps
tool will give me the replacement package to use. - Once the issue of unsupported dependencies has been resolved, we use
jdeps --list-deps
on all the jars (both generated by our program and used by our program) to get to know about the packages of JDK to include in runtime. - Once the dependencies are listed, we provide
jlink
of Java 11 to build a runtime for the application.
Am I correct in understanding this process? What are the surprises I might face?
UPDATE:
The comments below say that a custom runtime using jlink may not be required. However, we had problems using normal Java 8 runtime. Posting details below for more context.
The project we have been trying to port is Arduino and are using Mac OS to do that. Arduino uses Ant
to build. The build.xml
is here. What we initially did is change JAVA_HOME to point to Java 11 and use ant dist to compile it. For some reason, the application doesn't compile on Java 11 till you remove ../ at the end of line 69 in build.xml. After this the application compiled and provided an executable at the path given at line 512 of build.xml. But when we try to run the executable, it gives the error Java Runtime
not found.
java java-8 arduino-ide java-11
Do you have a reason to build a custom runtime? Its not strictly required you can still use the standard install like you did in Java 8. Do you have a plan in place to distribute your custom JRE already?
– Deadron
Nov 14 '18 at 19:46
@Deadron I thought we ought to make a custom runtime. How do we use the runtime of Java 8 with Java 11 ported app?
– Avinash Kumar
Nov 14 '18 at 19:53
Now that I remember, I did try to use the Java 8 runtime. But when I ran the application (we usedant run
), the app started, but gave an errorJava Runtime Engine not found
– Avinash Kumar
Nov 14 '18 at 19:57
This probably means your box is not setup properly for your ant script. The installation process has changed installation directories and environment variables. We would need to know the details of your ant script to help further.
– Deadron
Nov 14 '18 at 19:59
1
On thejlink
step, there would be a blocker if you still have automatic modules on your modulepath. I would suggest you to detail out the migration process step by step and try solving one step at a time. There is a significant effort while you migrate that would be spend on understanding the changes that you might rely on your dependent libraries/frameworks as well. Just for e.g. Ant's support for Java11.
– nullpointer
Nov 15 '18 at 3:24
|
show 3 more comments
I have been trying to port a Java 8 desktop application to Java 11. I have a high level idea of how Java 9 and after are different from Java 8. eg: support for modularization, JDK is modular, no separate JRE.
Overall it is my understanding that the process of porting to Java 11 consists of the following steps:
- Find out what dependencies are going out of support in Java 9 or later. We use
jdeps -jdkinternals
tool found in Java 8 jdk for this. - The dependencies found in
Step 1
may be handled in two ways:
a. If the dependency package is still there in Java 9 or later, but is just encapsulated, then use --add-exports command to make the JDK export those packages.
b. If the dependency package has been removed from Java, I will have to change the application's code to use a replacement package.jdeps
tool will give me the replacement package to use. - Once the issue of unsupported dependencies has been resolved, we use
jdeps --list-deps
on all the jars (both generated by our program and used by our program) to get to know about the packages of JDK to include in runtime. - Once the dependencies are listed, we provide
jlink
of Java 11 to build a runtime for the application.
Am I correct in understanding this process? What are the surprises I might face?
UPDATE:
The comments below say that a custom runtime using jlink may not be required. However, we had problems using normal Java 8 runtime. Posting details below for more context.
The project we have been trying to port is Arduino and are using Mac OS to do that. Arduino uses Ant
to build. The build.xml
is here. What we initially did is change JAVA_HOME to point to Java 11 and use ant dist to compile it. For some reason, the application doesn't compile on Java 11 till you remove ../ at the end of line 69 in build.xml. After this the application compiled and provided an executable at the path given at line 512 of build.xml. But when we try to run the executable, it gives the error Java Runtime
not found.
java java-8 arduino-ide java-11
I have been trying to port a Java 8 desktop application to Java 11. I have a high level idea of how Java 9 and after are different from Java 8. eg: support for modularization, JDK is modular, no separate JRE.
Overall it is my understanding that the process of porting to Java 11 consists of the following steps:
- Find out what dependencies are going out of support in Java 9 or later. We use
jdeps -jdkinternals
tool found in Java 8 jdk for this. - The dependencies found in
Step 1
may be handled in two ways:
a. If the dependency package is still there in Java 9 or later, but is just encapsulated, then use --add-exports command to make the JDK export those packages.
b. If the dependency package has been removed from Java, I will have to change the application's code to use a replacement package.jdeps
tool will give me the replacement package to use. - Once the issue of unsupported dependencies has been resolved, we use
jdeps --list-deps
on all the jars (both generated by our program and used by our program) to get to know about the packages of JDK to include in runtime. - Once the dependencies are listed, we provide
jlink
of Java 11 to build a runtime for the application.
Am I correct in understanding this process? What are the surprises I might face?
UPDATE:
The comments below say that a custom runtime using jlink may not be required. However, we had problems using normal Java 8 runtime. Posting details below for more context.
The project we have been trying to port is Arduino and are using Mac OS to do that. Arduino uses Ant
to build. The build.xml
is here. What we initially did is change JAVA_HOME to point to Java 11 and use ant dist to compile it. For some reason, the application doesn't compile on Java 11 till you remove ../ at the end of line 69 in build.xml. After this the application compiled and provided an executable at the path given at line 512 of build.xml. But when we try to run the executable, it gives the error Java Runtime
not found.
java java-8 arduino-ide java-11
java java-8 arduino-ide java-11
edited Nov 15 '18 at 6:27
Avinash Kumar
asked Nov 14 '18 at 19:40
Avinash KumarAvinash Kumar
1,55433275
1,55433275
Do you have a reason to build a custom runtime? Its not strictly required you can still use the standard install like you did in Java 8. Do you have a plan in place to distribute your custom JRE already?
– Deadron
Nov 14 '18 at 19:46
@Deadron I thought we ought to make a custom runtime. How do we use the runtime of Java 8 with Java 11 ported app?
– Avinash Kumar
Nov 14 '18 at 19:53
Now that I remember, I did try to use the Java 8 runtime. But when I ran the application (we usedant run
), the app started, but gave an errorJava Runtime Engine not found
– Avinash Kumar
Nov 14 '18 at 19:57
This probably means your box is not setup properly for your ant script. The installation process has changed installation directories and environment variables. We would need to know the details of your ant script to help further.
– Deadron
Nov 14 '18 at 19:59
1
On thejlink
step, there would be a blocker if you still have automatic modules on your modulepath. I would suggest you to detail out the migration process step by step and try solving one step at a time. There is a significant effort while you migrate that would be spend on understanding the changes that you might rely on your dependent libraries/frameworks as well. Just for e.g. Ant's support for Java11.
– nullpointer
Nov 15 '18 at 3:24
|
show 3 more comments
Do you have a reason to build a custom runtime? Its not strictly required you can still use the standard install like you did in Java 8. Do you have a plan in place to distribute your custom JRE already?
– Deadron
Nov 14 '18 at 19:46
@Deadron I thought we ought to make a custom runtime. How do we use the runtime of Java 8 with Java 11 ported app?
– Avinash Kumar
Nov 14 '18 at 19:53
Now that I remember, I did try to use the Java 8 runtime. But when I ran the application (we usedant run
), the app started, but gave an errorJava Runtime Engine not found
– Avinash Kumar
Nov 14 '18 at 19:57
This probably means your box is not setup properly for your ant script. The installation process has changed installation directories and environment variables. We would need to know the details of your ant script to help further.
– Deadron
Nov 14 '18 at 19:59
1
On thejlink
step, there would be a blocker if you still have automatic modules on your modulepath. I would suggest you to detail out the migration process step by step and try solving one step at a time. There is a significant effort while you migrate that would be spend on understanding the changes that you might rely on your dependent libraries/frameworks as well. Just for e.g. Ant's support for Java11.
– nullpointer
Nov 15 '18 at 3:24
Do you have a reason to build a custom runtime? Its not strictly required you can still use the standard install like you did in Java 8. Do you have a plan in place to distribute your custom JRE already?
– Deadron
Nov 14 '18 at 19:46
Do you have a reason to build a custom runtime? Its not strictly required you can still use the standard install like you did in Java 8. Do you have a plan in place to distribute your custom JRE already?
– Deadron
Nov 14 '18 at 19:46
@Deadron I thought we ought to make a custom runtime. How do we use the runtime of Java 8 with Java 11 ported app?
– Avinash Kumar
Nov 14 '18 at 19:53
@Deadron I thought we ought to make a custom runtime. How do we use the runtime of Java 8 with Java 11 ported app?
– Avinash Kumar
Nov 14 '18 at 19:53
Now that I remember, I did try to use the Java 8 runtime. But when I ran the application (we used
ant run
), the app started, but gave an error Java Runtime Engine not found
– Avinash Kumar
Nov 14 '18 at 19:57
Now that I remember, I did try to use the Java 8 runtime. But when I ran the application (we used
ant run
), the app started, but gave an error Java Runtime Engine not found
– Avinash Kumar
Nov 14 '18 at 19:57
This probably means your box is not setup properly for your ant script. The installation process has changed installation directories and environment variables. We would need to know the details of your ant script to help further.
– Deadron
Nov 14 '18 at 19:59
This probably means your box is not setup properly for your ant script. The installation process has changed installation directories and environment variables. We would need to know the details of your ant script to help further.
– Deadron
Nov 14 '18 at 19:59
1
1
On the
jlink
step, there would be a blocker if you still have automatic modules on your modulepath. I would suggest you to detail out the migration process step by step and try solving one step at a time. There is a significant effort while you migrate that would be spend on understanding the changes that you might rely on your dependent libraries/frameworks as well. Just for e.g. Ant's support for Java11.– nullpointer
Nov 15 '18 at 3:24
On the
jlink
step, there would be a blocker if you still have automatic modules on your modulepath. I would suggest you to detail out the migration process step by step and try solving one step at a time. There is a significant effort while you migrate that would be spend on understanding the changes that you might rely on your dependent libraries/frameworks as well. Just for e.g. Ant's support for Java11.– nullpointer
Nov 15 '18 at 3:24
|
show 3 more comments
0
active
oldest
votes
Your Answer
StackExchange.ifUsing("editor", function () {
StackExchange.using("externalEditor", function () {
StackExchange.using("snippets", function () {
StackExchange.snippets.init();
});
});
}, "code-snippets");
StackExchange.ready(function() {
var channelOptions = {
tags: "".split(" "),
id: "1"
};
initTagRenderer("".split(" "), "".split(" "), channelOptions);
StackExchange.using("externalEditor", function() {
// Have to fire editor after snippets, if snippets enabled
if (StackExchange.settings.snippets.snippetsEnabled) {
StackExchange.using("snippets", function() {
createEditor();
});
}
else {
createEditor();
}
});
function createEditor() {
StackExchange.prepareEditor({
heartbeatType: 'answer',
autoActivateHeartbeat: false,
convertImagesToLinks: true,
noModals: true,
showLowRepImageUploadWarning: true,
reputationToPostImages: 10,
bindNavPrevention: true,
postfix: "",
imageUploader: {
brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
allowUrls: true
},
onDemand: true,
discardSelector: ".discard-answer"
,immediatelyShowMarkdownHelp:true
});
}
});
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f53307642%2fporting-a-java-8-application-to-java-11%23new-answer', 'question_page');
}
);
Post as a guest
Required, but never shown
0
active
oldest
votes
0
active
oldest
votes
active
oldest
votes
active
oldest
votes
Thanks for contributing an answer to Stack Overflow!
- Please be sure to answer the question. Provide details and share your research!
But avoid …
- Asking for help, clarification, or responding to other answers.
- Making statements based on opinion; back them up with references or personal experience.
To learn more, see our tips on writing great answers.
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f53307642%2fporting-a-java-8-application-to-java-11%23new-answer', 'question_page');
}
);
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Do you have a reason to build a custom runtime? Its not strictly required you can still use the standard install like you did in Java 8. Do you have a plan in place to distribute your custom JRE already?
– Deadron
Nov 14 '18 at 19:46
@Deadron I thought we ought to make a custom runtime. How do we use the runtime of Java 8 with Java 11 ported app?
– Avinash Kumar
Nov 14 '18 at 19:53
Now that I remember, I did try to use the Java 8 runtime. But when I ran the application (we used
ant run
), the app started, but gave an errorJava Runtime Engine not found
– Avinash Kumar
Nov 14 '18 at 19:57
This probably means your box is not setup properly for your ant script. The installation process has changed installation directories and environment variables. We would need to know the details of your ant script to help further.
– Deadron
Nov 14 '18 at 19:59
1
On the
jlink
step, there would be a blocker if you still have automatic modules on your modulepath. I would suggest you to detail out the migration process step by step and try solving one step at a time. There is a significant effort while you migrate that would be spend on understanding the changes that you might rely on your dependent libraries/frameworks as well. Just for e.g. Ant's support for Java11.– nullpointer
Nov 15 '18 at 3:24