Make the new JDK 11 java.net.http package visible in Netbeans 10











up vote
-2
down vote

favorite
1












After opening an existing Netbeans 8 project in Apache Netbeans 10, and setting the Java version to the newest JDK 11, Netbeans is still unable to resolve references to the new java.net.http package which includes improved HTTP handling with classes such as HttpClient, HttpRequest, and HttpResponse.



What needs to be done to make the new java.net.http package visible to the existing project in Apache Netbeans 10?










share|improve this question
























  • Possible duplicate of How to access http client module in Java 11, since reading the answer mostly emphasizes on the java.xml configuration in NetBeans while the remaining part suggests the same answer.
    – nullpointer
    Nov 11 at 18:17










  • Possible duplicate of The jdk.incubator.httpclient module not found in Java11
    – nullpointer
    Nov 11 at 18:21










  • I feel the two questions deal with different things: the question you link to is about moving from the incubator version of the new http package to the finished JDK 11 version; my question is about making the finished JDK 11 version visible to a Netbeans project which has had no knowledge of that package already. The two are similar, but I think my question is different enough to justify its existence, and so I'll leave this to the Stack Overflow community to decide whether it should remain open.
    – Bobulous
    Nov 12 at 10:55










  • Alright. Makes sense, but honestly, the answer to me looks more diverged towards creating a modular project in Netbeans for the first time rather than including http client on its own.
    – nullpointer
    Nov 12 at 12:29















up vote
-2
down vote

favorite
1












After opening an existing Netbeans 8 project in Apache Netbeans 10, and setting the Java version to the newest JDK 11, Netbeans is still unable to resolve references to the new java.net.http package which includes improved HTTP handling with classes such as HttpClient, HttpRequest, and HttpResponse.



What needs to be done to make the new java.net.http package visible to the existing project in Apache Netbeans 10?










share|improve this question
























  • Possible duplicate of How to access http client module in Java 11, since reading the answer mostly emphasizes on the java.xml configuration in NetBeans while the remaining part suggests the same answer.
    – nullpointer
    Nov 11 at 18:17










  • Possible duplicate of The jdk.incubator.httpclient module not found in Java11
    – nullpointer
    Nov 11 at 18:21










  • I feel the two questions deal with different things: the question you link to is about moving from the incubator version of the new http package to the finished JDK 11 version; my question is about making the finished JDK 11 version visible to a Netbeans project which has had no knowledge of that package already. The two are similar, but I think my question is different enough to justify its existence, and so I'll leave this to the Stack Overflow community to decide whether it should remain open.
    – Bobulous
    Nov 12 at 10:55










  • Alright. Makes sense, but honestly, the answer to me looks more diverged towards creating a modular project in Netbeans for the first time rather than including http client on its own.
    – nullpointer
    Nov 12 at 12:29













up vote
-2
down vote

favorite
1









up vote
-2
down vote

favorite
1






1





After opening an existing Netbeans 8 project in Apache Netbeans 10, and setting the Java version to the newest JDK 11, Netbeans is still unable to resolve references to the new java.net.http package which includes improved HTTP handling with classes such as HttpClient, HttpRequest, and HttpResponse.



What needs to be done to make the new java.net.http package visible to the existing project in Apache Netbeans 10?










share|improve this question















After opening an existing Netbeans 8 project in Apache Netbeans 10, and setting the Java version to the newest JDK 11, Netbeans is still unable to resolve references to the new java.net.http package which includes improved HTTP handling with classes such as HttpClient, HttpRequest, and HttpResponse.



What needs to be done to make the new java.net.http package visible to the existing project in Apache Netbeans 10?







java-module java-11 module-info netbeans-10 java.net.http






share|improve this question















share|improve this question













share|improve this question




share|improve this question








edited Nov 20 at 11:26

























asked Nov 11 at 18:11









Bobulous

9,60242649




9,60242649












  • Possible duplicate of How to access http client module in Java 11, since reading the answer mostly emphasizes on the java.xml configuration in NetBeans while the remaining part suggests the same answer.
    – nullpointer
    Nov 11 at 18:17










  • Possible duplicate of The jdk.incubator.httpclient module not found in Java11
    – nullpointer
    Nov 11 at 18:21










  • I feel the two questions deal with different things: the question you link to is about moving from the incubator version of the new http package to the finished JDK 11 version; my question is about making the finished JDK 11 version visible to a Netbeans project which has had no knowledge of that package already. The two are similar, but I think my question is different enough to justify its existence, and so I'll leave this to the Stack Overflow community to decide whether it should remain open.
    – Bobulous
    Nov 12 at 10:55










  • Alright. Makes sense, but honestly, the answer to me looks more diverged towards creating a modular project in Netbeans for the first time rather than including http client on its own.
    – nullpointer
    Nov 12 at 12:29


















  • Possible duplicate of How to access http client module in Java 11, since reading the answer mostly emphasizes on the java.xml configuration in NetBeans while the remaining part suggests the same answer.
    – nullpointer
    Nov 11 at 18:17










  • Possible duplicate of The jdk.incubator.httpclient module not found in Java11
    – nullpointer
    Nov 11 at 18:21










  • I feel the two questions deal with different things: the question you link to is about moving from the incubator version of the new http package to the finished JDK 11 version; my question is about making the finished JDK 11 version visible to a Netbeans project which has had no knowledge of that package already. The two are similar, but I think my question is different enough to justify its existence, and so I'll leave this to the Stack Overflow community to decide whether it should remain open.
    – Bobulous
    Nov 12 at 10:55










  • Alright. Makes sense, but honestly, the answer to me looks more diverged towards creating a modular project in Netbeans for the first time rather than including http client on its own.
    – nullpointer
    Nov 12 at 12:29
















Possible duplicate of How to access http client module in Java 11, since reading the answer mostly emphasizes on the java.xml configuration in NetBeans while the remaining part suggests the same answer.
– nullpointer
Nov 11 at 18:17




Possible duplicate of How to access http client module in Java 11, since reading the answer mostly emphasizes on the java.xml configuration in NetBeans while the remaining part suggests the same answer.
– nullpointer
Nov 11 at 18:17












Possible duplicate of The jdk.incubator.httpclient module not found in Java11
– nullpointer
Nov 11 at 18:21




Possible duplicate of The jdk.incubator.httpclient module not found in Java11
– nullpointer
Nov 11 at 18:21












I feel the two questions deal with different things: the question you link to is about moving from the incubator version of the new http package to the finished JDK 11 version; my question is about making the finished JDK 11 version visible to a Netbeans project which has had no knowledge of that package already. The two are similar, but I think my question is different enough to justify its existence, and so I'll leave this to the Stack Overflow community to decide whether it should remain open.
– Bobulous
Nov 12 at 10:55




I feel the two questions deal with different things: the question you link to is about moving from the incubator version of the new http package to the finished JDK 11 version; my question is about making the finished JDK 11 version visible to a Netbeans project which has had no knowledge of that package already. The two are similar, but I think my question is different enough to justify its existence, and so I'll leave this to the Stack Overflow community to decide whether it should remain open.
– Bobulous
Nov 12 at 10:55












Alright. Makes sense, but honestly, the answer to me looks more diverged towards creating a modular project in Netbeans for the first time rather than including http client on its own.
– nullpointer
Nov 12 at 12:29




Alright. Makes sense, but honestly, the answer to me looks more diverged towards creating a modular project in Netbeans for the first time rather than including http client on its own.
– nullpointer
Nov 12 at 12:29












1 Answer
1






active

oldest

votes

















up vote
0
down vote



accepted










In order to make the new java.net.http package visible to your project, you'll need to configure your project so that it includes the module name "java.net.http" (found at the top of the Javadoc page for the package).



The existing Java project imported from Netbeans 8 will not have any knowledge of the module system introduced in Java 9, so initially you'll have no way to add a module requirement. To fix this, right-click on your Java project in Apache Netbeans 10 and then select "New" and then "Java Module Info...". In the dialog which appears, check the details and click the "Next" button and then confirm that you're happy to move entries out of the classpath and into the modulepath if offered. You'll now find a new file "module-info.java" in the default package of your project (under "Source Packages"/"<default package>").



Open the "module-info.java" file and then check your project for error markers (the angry red circles on the file icon, showing that the file contains a parsing or compilation error). Open the files which report errors and you'll probably find that some of the import statements at the top of your Java files now report an error such as this:




"Package javax.xml.stream is not visible:

(package javax.xml.stream is declared in module java.xml but module MyApplication does not read it)"




This error would mean that you'd need to add the following line to the module MyApplication definition (where "MyApplication" will be a name based on your own project) found within your "module-info.java" file:



requires java.xml;


Save that change and you should now see the specific error about javax.xml.stream disappear. Repeat this process until all of the visibility errors vanish from your project. (If your project doesn't use any non-core modules then you may not see any errors at all.)



Finally, once all other visibility errors are out of the way, add this line to your module MyApplication definition:



requires java.net.http;


Save that change, and now when editing your project code in Apache Netbeans IDE 10 you should be able to see and use the new java.net.http classes such as HttpClient.






share|improve this answer





















  • Is this about java.xml or java.net.http?
    – nullpointer
    Nov 11 at 18:15










  • It's about the process of resolving any visibility problems which will be introduced for the first time when adding a module-info.java file to a project. The java.xml module requirement is simply included as an example, and such errors would need to be fixed before adding the requirement for the new http module.
    – Bobulous
    Nov 12 at 10:56











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',
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
});


}
});














draft saved

draft discarded


















StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f53251708%2fmake-the-new-jdk-11-java-net-http-package-visible-in-netbeans-10%23new-answer', 'question_page');
}
);

Post as a guest















Required, but never shown

























1 Answer
1






active

oldest

votes








1 Answer
1






active

oldest

votes









active

oldest

votes






active

oldest

votes








up vote
0
down vote



accepted










In order to make the new java.net.http package visible to your project, you'll need to configure your project so that it includes the module name "java.net.http" (found at the top of the Javadoc page for the package).



The existing Java project imported from Netbeans 8 will not have any knowledge of the module system introduced in Java 9, so initially you'll have no way to add a module requirement. To fix this, right-click on your Java project in Apache Netbeans 10 and then select "New" and then "Java Module Info...". In the dialog which appears, check the details and click the "Next" button and then confirm that you're happy to move entries out of the classpath and into the modulepath if offered. You'll now find a new file "module-info.java" in the default package of your project (under "Source Packages"/"<default package>").



Open the "module-info.java" file and then check your project for error markers (the angry red circles on the file icon, showing that the file contains a parsing or compilation error). Open the files which report errors and you'll probably find that some of the import statements at the top of your Java files now report an error such as this:




"Package javax.xml.stream is not visible:

(package javax.xml.stream is declared in module java.xml but module MyApplication does not read it)"




This error would mean that you'd need to add the following line to the module MyApplication definition (where "MyApplication" will be a name based on your own project) found within your "module-info.java" file:



requires java.xml;


Save that change and you should now see the specific error about javax.xml.stream disappear. Repeat this process until all of the visibility errors vanish from your project. (If your project doesn't use any non-core modules then you may not see any errors at all.)



Finally, once all other visibility errors are out of the way, add this line to your module MyApplication definition:



requires java.net.http;


Save that change, and now when editing your project code in Apache Netbeans IDE 10 you should be able to see and use the new java.net.http classes such as HttpClient.






share|improve this answer





















  • Is this about java.xml or java.net.http?
    – nullpointer
    Nov 11 at 18:15










  • It's about the process of resolving any visibility problems which will be introduced for the first time when adding a module-info.java file to a project. The java.xml module requirement is simply included as an example, and such errors would need to be fixed before adding the requirement for the new http module.
    – Bobulous
    Nov 12 at 10:56















up vote
0
down vote



accepted










In order to make the new java.net.http package visible to your project, you'll need to configure your project so that it includes the module name "java.net.http" (found at the top of the Javadoc page for the package).



The existing Java project imported from Netbeans 8 will not have any knowledge of the module system introduced in Java 9, so initially you'll have no way to add a module requirement. To fix this, right-click on your Java project in Apache Netbeans 10 and then select "New" and then "Java Module Info...". In the dialog which appears, check the details and click the "Next" button and then confirm that you're happy to move entries out of the classpath and into the modulepath if offered. You'll now find a new file "module-info.java" in the default package of your project (under "Source Packages"/"<default package>").



Open the "module-info.java" file and then check your project for error markers (the angry red circles on the file icon, showing that the file contains a parsing or compilation error). Open the files which report errors and you'll probably find that some of the import statements at the top of your Java files now report an error such as this:




"Package javax.xml.stream is not visible:

(package javax.xml.stream is declared in module java.xml but module MyApplication does not read it)"




This error would mean that you'd need to add the following line to the module MyApplication definition (where "MyApplication" will be a name based on your own project) found within your "module-info.java" file:



requires java.xml;


Save that change and you should now see the specific error about javax.xml.stream disappear. Repeat this process until all of the visibility errors vanish from your project. (If your project doesn't use any non-core modules then you may not see any errors at all.)



Finally, once all other visibility errors are out of the way, add this line to your module MyApplication definition:



requires java.net.http;


Save that change, and now when editing your project code in Apache Netbeans IDE 10 you should be able to see and use the new java.net.http classes such as HttpClient.






share|improve this answer





















  • Is this about java.xml or java.net.http?
    – nullpointer
    Nov 11 at 18:15










  • It's about the process of resolving any visibility problems which will be introduced for the first time when adding a module-info.java file to a project. The java.xml module requirement is simply included as an example, and such errors would need to be fixed before adding the requirement for the new http module.
    – Bobulous
    Nov 12 at 10:56













up vote
0
down vote



accepted







up vote
0
down vote



accepted






In order to make the new java.net.http package visible to your project, you'll need to configure your project so that it includes the module name "java.net.http" (found at the top of the Javadoc page for the package).



The existing Java project imported from Netbeans 8 will not have any knowledge of the module system introduced in Java 9, so initially you'll have no way to add a module requirement. To fix this, right-click on your Java project in Apache Netbeans 10 and then select "New" and then "Java Module Info...". In the dialog which appears, check the details and click the "Next" button and then confirm that you're happy to move entries out of the classpath and into the modulepath if offered. You'll now find a new file "module-info.java" in the default package of your project (under "Source Packages"/"<default package>").



Open the "module-info.java" file and then check your project for error markers (the angry red circles on the file icon, showing that the file contains a parsing or compilation error). Open the files which report errors and you'll probably find that some of the import statements at the top of your Java files now report an error such as this:




"Package javax.xml.stream is not visible:

(package javax.xml.stream is declared in module java.xml but module MyApplication does not read it)"




This error would mean that you'd need to add the following line to the module MyApplication definition (where "MyApplication" will be a name based on your own project) found within your "module-info.java" file:



requires java.xml;


Save that change and you should now see the specific error about javax.xml.stream disappear. Repeat this process until all of the visibility errors vanish from your project. (If your project doesn't use any non-core modules then you may not see any errors at all.)



Finally, once all other visibility errors are out of the way, add this line to your module MyApplication definition:



requires java.net.http;


Save that change, and now when editing your project code in Apache Netbeans IDE 10 you should be able to see and use the new java.net.http classes such as HttpClient.






share|improve this answer












In order to make the new java.net.http package visible to your project, you'll need to configure your project so that it includes the module name "java.net.http" (found at the top of the Javadoc page for the package).



The existing Java project imported from Netbeans 8 will not have any knowledge of the module system introduced in Java 9, so initially you'll have no way to add a module requirement. To fix this, right-click on your Java project in Apache Netbeans 10 and then select "New" and then "Java Module Info...". In the dialog which appears, check the details and click the "Next" button and then confirm that you're happy to move entries out of the classpath and into the modulepath if offered. You'll now find a new file "module-info.java" in the default package of your project (under "Source Packages"/"<default package>").



Open the "module-info.java" file and then check your project for error markers (the angry red circles on the file icon, showing that the file contains a parsing or compilation error). Open the files which report errors and you'll probably find that some of the import statements at the top of your Java files now report an error such as this:




"Package javax.xml.stream is not visible:

(package javax.xml.stream is declared in module java.xml but module MyApplication does not read it)"




This error would mean that you'd need to add the following line to the module MyApplication definition (where "MyApplication" will be a name based on your own project) found within your "module-info.java" file:



requires java.xml;


Save that change and you should now see the specific error about javax.xml.stream disappear. Repeat this process until all of the visibility errors vanish from your project. (If your project doesn't use any non-core modules then you may not see any errors at all.)



Finally, once all other visibility errors are out of the way, add this line to your module MyApplication definition:



requires java.net.http;


Save that change, and now when editing your project code in Apache Netbeans IDE 10 you should be able to see and use the new java.net.http classes such as HttpClient.







share|improve this answer












share|improve this answer



share|improve this answer










answered Nov 11 at 18:11









Bobulous

9,60242649




9,60242649












  • Is this about java.xml or java.net.http?
    – nullpointer
    Nov 11 at 18:15










  • It's about the process of resolving any visibility problems which will be introduced for the first time when adding a module-info.java file to a project. The java.xml module requirement is simply included as an example, and such errors would need to be fixed before adding the requirement for the new http module.
    – Bobulous
    Nov 12 at 10:56


















  • Is this about java.xml or java.net.http?
    – nullpointer
    Nov 11 at 18:15










  • It's about the process of resolving any visibility problems which will be introduced for the first time when adding a module-info.java file to a project. The java.xml module requirement is simply included as an example, and such errors would need to be fixed before adding the requirement for the new http module.
    – Bobulous
    Nov 12 at 10:56
















Is this about java.xml or java.net.http?
– nullpointer
Nov 11 at 18:15




Is this about java.xml or java.net.http?
– nullpointer
Nov 11 at 18:15












It's about the process of resolving any visibility problems which will be introduced for the first time when adding a module-info.java file to a project. The java.xml module requirement is simply included as an example, and such errors would need to be fixed before adding the requirement for the new http module.
– Bobulous
Nov 12 at 10:56




It's about the process of resolving any visibility problems which will be introduced for the first time when adding a module-info.java file to a project. The java.xml module requirement is simply included as an example, and such errors would need to be fixed before adding the requirement for the new http module.
– Bobulous
Nov 12 at 10:56


















draft saved

draft discarded




















































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.





Some of your past answers have not been well-received, and you're in danger of being blocked from answering.


Please pay close attention to the following guidance:


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




draft saved


draft discarded














StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f53251708%2fmake-the-new-jdk-11-java-net-http-package-visible-in-netbeans-10%23new-answer', 'question_page');
}
);

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







Popular posts from this blog

Florida Star v. B. J. F.

Danny Elfman

Retrieve a Users Dashboard in Tumblr with R and TumblR. Oauth Issues