You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@netbeans.apache.org by Amitabh Choudhury <am...@gmail.com> on 2023/02/13 17:45:14 UTC

java.sql missing from java.base in Netbeans 16 JDK 18 defaults

Hello

This is in continuation of my previous mail related to Netbeans 14.

Got aware that Netbeans 14 isn't supported, so downloaded Netbeans 16 and
configured with Java 18.

Created Ant project and checked java.base.
java.sql is missing in this as well.

Please guide to configure Netbeans 16 to include java.sql in java.base
module of Default Library.
Images attached ...

Warm wishes

~~~
Amitabh Choudhury

Re: java.sql missing from java.base in Netbeans 16 JDK 18 defaults

Posted by Sean Carrick <se...@pekinsoft.com>.
Amitabh,

Give me a few minutes...I'm answering you off list due to this thread 
getting a little crowded...

-SC

On 2/13/23 9:26 PM, Amitabh Choudhury wrote:
> Sean
>
> Thanks for the heads up. Getting hang of the flow.
>
> How different would that modular structure be from adding a JAR file 
> with "java.sql" files, as a third party file in the Libraries?
>
> Including an sql.jar will have less "baggage" than including a 
> "Wrapper" sort of. Isn't it? With the changing versions of Netbeans, 
> "Java module" will have to be upgraded. Isn't it?
>
> ~~~
> Amitabh
>
> On Tue, Feb 14, 2023 at 8:50 AM Sean Carrick <sean@pekinsoft.com 
> <ma...@pekinsoft.com>> wrote:
>
>     Amitabh,
>
>     If you want to convert your project that is open in that
>     screenshot to be a modular project, the first thing that you
>     should do is create a /module-info.java/ file in the default
>     package of each of those JAR projects. Then, create a new Java
>     Modular Project (for example "MyModularProject"), then copy/paste
>     all of your JAR projects into the directory
>     /~/NetBeansProjects/MyModularProject/src//. They /should be/
>     picked up by the main project as modules. You will need to delete
>     all of the extraneous folders and files out of those directories
>     and rename each of their "src" directories to "classes". Whatever
>     the name of the directory in which the "src" directories are
>     currently located is named will become the default module name for
>     the new modules.
>
>     -SC
>
>     On 2/13/23 9:10 PM, Sean Carrick wrote:
>>
>>     Hey Amitabh,
>>
>>     I'm glad that I finally got it explained fully for you. Using
>>     your own screenshot, I circled the project type:
>>
>>     The Modular Java Project type.
>>
>>     When you choose this Project Template, you will get a project
>>     like the one in the screenshots I sent earlier. Basically, you
>>     end up with a project structure like this:
>>
>>     The modular project structure.
>>
>>     Each module in this project structure (i.e., another.mod,
>>     api.mod, and base.mod) is a separate "subproject" for the main
>>     project "TestModApp". What this means in real terms is that each
>>     module may rely on different third-party libraries and they have
>>     to be managed within that specific module. This is why each of
>>     those modules have a Libraries node. Having said that, once one
>>     module adds a third-party library to its Libraries node, that
>>     third-party library may be /required/ by any other module within
>>     the top-level project ("TestModApp").
>>
>>     I hope this helps you out...
>>
>>     -SC
>>
>>     On 2/13/23 8:58 PM, Amitabh Choudhury wrote:
>>>     This is what I mean by "category of project".
>>>
>>>     I was working with "Java with Ant" and "Java Application"
>>>     project. Hence "module-info.java" didn't show up.
>>>
>>>     How would you include "module-info.java" in "Java with Ant" and
>>>     "Java Application" project?
>>>
>>>     I am trying to replicate the project structure you showed. If
>>>     the inclusion of "module-info.java" with "Module" as the
>>>     data-structure, permitted in "Java with Ant" and "Java
>>>     Application" projects?
>>>
>>>
>>>     On Tue, Feb 14, 2023 at 8:21 AM Amitabh Choudhury
>>>     <amitabhisgood@gmail.com <ma...@gmail.com>> wrote:
>>>
>>>         Hi Sean.
>>>
>>>         Got out of bed sometime back. Saw this post now. Awesome!!!
>>>
>>>         As I mentioned, I had to get the solution previous night at
>>>         earliest. So did what I did, then.
>>>
>>>         Now I have flexibility to study the modular structure.
>>>
>>>         Browsing through your code and screenshot now.
>>>
>>>         Which category of project did you use to create the project?
>>>         "Netbeans Module"? "Java with Maven"? "Java with Ant"?
>>>
>>>         I used "Java with Ant" and "Java Application".
>>>         I haven't come across "module-info.java" hence I suspect
>>>         that the project isn't a "Java with Ant" category project.
>>>
>>>         I suspect that for each category, default code generated by
>>>         Netbeans is different, hence I wasn't aware of
>>>         "module-info.java".
>>>
>>>         I could comprehend, your information. Now, I need to know
>>>         which category of project was created? The directory
>>>         structure isn't "Java with Ant" category.
>>>
>>>         Is "module-info.java" generated by Netbeans or you created it?
>>>         Seems like the "category of project" matters.
>>>
>>>         Which category of project was created?
>>>
>>>
>>>
>>>         Warm wishes
>>>
>>>
>>>
>>>
>>>
>>>         On Tue, Feb 14, 2023 at 4:06 AM Sean Carrick
>>>         <sean@pekinsoft.com <ma...@pekinsoft.com>> wrote:
>>>
>>>             Amitabh,
>>>
>>>             NO! What you just said is /_*NOT*_/ how you do it! Look
>>>             at this screenshot:
>>>
>>>             Proper way to get Java SQL API into a modular project.
>>>
>>>             The code window on the right shows a class that is able
>>>             to import and access the Java SQL API. Notice the
>>>             Libraries nodes in the Project window toward the
>>>             upper-left: the only thing imported is the JDK and the
>>>             current module.../*nothing else*/.
>>>
>>>             To accomplish this, all I did was to fill out the
>>>             module-info.java file for the "another.mod" module:
>>>
>>>             module-info.java contents for another.mod module.
>>>
>>>             As you can see, even though I have /no third-party/ SQL
>>>             library in the Libraries node, I am requiring the use of
>>>             java.sql in my module. This is because the Java SQL API
>>>             is located in the module /java.sql/ within the JDK. So,
>>>             to use it in my project, I have to /require/ it, as I
>>>             have done in the image above.
>>>
>>>             Now, once I have my DatabaseAccess class written, if I
>>>             want to use it my module named "base.mod", I would need
>>>             to place the following statement into the
>>>             /base.mod:module-info.java/ file:
>>>
>>>             module base.module {
>>>                  requires java.sql;	// To be able to import SQLException class.
>>>                  requires another.mod;	// To import the exported class from my other module.
>>>             }
>>>
>>>             This is how modular development using Project Jigsaw
>>>             works. You /*must*/ create /explicit/ contracts between
>>>             the modules. Furthermore, if "base.mod" requires
>>>             "another.mod" for the DatabaseAccess class, then
>>>             "another.mod" /*cannot*/ require "base.mod" because that
>>>             would be a cyclic dependency and the compiler would not
>>>             be able to determine which module to compile first.
>>>
>>>             So, to properly develop a modular application in Java,
>>>             you need to think through all of your requirements very
>>>             carefully. You will want to create a module that is an
>>>             API for your application, which can be required by any
>>>             or all other modules in your application, but which
>>>             itself has no requirements on any of the other modules.
>>>             When you create this API module, it would be best if it
>>>             only contained interfaces and abstract classes that must
>>>             be implemented elsewhere. Then, you create
>>>             implementations in the other modules and can use the
>>>             Java class java.util.ServiceLoader to load the
>>>             implementations where you need them, without needing to
>>>             require the modules in which the implementations are
>>>             defined. For example, if my example created an API
>>>             module, it could look like this:
>>>
>>>             Modular application with an API module.
>>>
>>>             In this screenshot, you can see both the API
>>>             module-info.java file and the interface that module
>>>             contains (the two windows on top to the right). Also,
>>>             you can see the module-info.java file and the
>>>             implementation of the interface for "another.mod" module
>>>             (lower two windows to the right). Let's talk about the
>>>             api.mod:module-info.java file:
>>>
>>>             Notice that /module api.mod/ requires "java.sql", but
>>>             uses the "transitive" keyword. This allows for any
>>>             module that requires the module "api.mod" to also get a
>>>             reference to the "java.sql" module without needing to
>>>             declare so explicitly. We'll get to that in a minute.
>>>             Notice the interface named "Database" on the
>>>             upper-right...It is able to import both
>>>             java.sql.ResultSet and java.sql.SQLException. This is
>>>             due to the statement in the module-info.java file
>>>             "requires java.sql". /*This*/ is how you are able to use
>>>             the Java SQL API in a modular Java application. Now,
>>>             let's look at the implementation...
>>>
>>>             In the two lower windows to the right, you see the
>>>             another.mod:module-info.java file (left one) and the
>>>             implementation of the Database interface (right one). In
>>>             order to implement the Database interface, another.mod
>>>             had to place the "requires api.mod" statement in its
>>>             module-info.java file. Furthermore, notice that
>>>             DatabaseAccess class imports classes from the java.sql
>>>             package, but /does not/ have a "requires java.sql"
>>>             statement in its module-info.java file. This is because
>>>             of the api.mod:module-info.java requiring java.sql as
>>>             /transitive/. The /transitive/ keyword means that
>>>             another.module gets access to the java.sql module
>>>             /implicitly/ due to it dependency on api.module.
>>>
>>>             Now, let's have our base module use the implementation
>>>             of the Database interface, /without having a dependency
>>>             on the another.mod module/...
>>>
>>>             To implement the project API, we will create a main
>>>             class in the base.mod module, place a "requires api.mod"
>>>             statement in its module-info.java file, and then use the
>>>             ServiceLoader to get the implementation defined in
>>>             another.mod:
>>>
>>>             Implementing the API
>>>
>>>             The top window on the right is the module-info.java file
>>>             for another.mod. It declares that it /provides/ an
>>>             implementation of the Database interface /with/ the
>>>             DatabaseAccess class.
>>>
>>>             In the middle window on the right, you can see that the
>>>             base.mod module /only/ requires the api.mod module, so
>>>             that it has access to the Database interface. Then, in
>>>             the constructor of the MainClass, you see the use of the
>>>             /java.util.ServiceLoader/ class to get to the
>>>             implementation of the Database interface that is defined
>>>             by the module another.mod.
>>>
>>>             With these screenshots and explanations, hopefully it
>>>             makes more sense to you why you are not seeing the
>>>             java.sql in your Libraries node in NetBeans. I've
>>>             expanded the Libraries node in each of these screenshots
>>>             so that you can see no where have I added a library for
>>>             java.sql, but am able to use that package because of how
>>>             I /require/ it in my module-info.java files...
>>>
>>>             -SC
>>>
>>>             On 2/13/23 2:53 PM, Amitabh Choudhury wrote:
>>>>             Hi Sean
>>>>
>>>>             Thanks for all the effort to explain the reasons. Very
>>>>             much appreciated. Especially this third message.
>>>>
>>>>             I had to close the project fast. So your statement of
>>>>             "third party" gave the hint to pack required classes
>>>>             (java.sql package) in a "third party" jar and add it to
>>>>             the "Project Window".
>>>>             Did basic search on "Project jigsaw" and noted that it
>>>>             would take very slow reading to grasp that flow.
>>>>
>>>>             Fortunately there was "sql.jar" available online that
>>>>             had packaged the "java.sql" class files in .jar.
>>>>
>>>>             Used that to get the project rolling.
>>>>
>>>>             This is standalone desktop Ant project.
>>>>             Couldn't find any "module-info.java" file generated by
>>>>             Netbeans.
>>>>             So I am yet to figure out what this "module-info.java"
>>>>             file is and where to place it in project structure.
>>>>             Then I will be able to add "requires java.sql;"
>>>>             statement in that file.
>>>>
>>>>             Thanks for the guidance. Have to figure out where to
>>>>             find this 'module-info.java'.
>>>>
>>>>             @Ernie - Thanks for the guidance.
>>>>
>>>>             @László - Thanks for the guidance.
>>>>
>>>>             Screenshots indicate that the "java.sql" is accepted.
>>>>
>>>>             Thanks.
>>>>
>>>>             Warm wishes
>>>>
>>>>
>>>>             On Tue, Feb 14, 2023 at 1:02 AM Sean Carrick
>>>>             <sean@pekinsoft.com <ma...@pekinsoft.com>> wrote:
>>>>
>>>>                 Amitabh,
>>>>
>>>>                 Just to clarify, since I missed stating this in my
>>>>                 last two messages regarding your issue...
>>>>
>>>>                 When developing a /modular/ Java project, the only
>>>>                 items that should be listed in your Libraries node
>>>>                 in the Projects window of NetBeans IDE should be
>>>>                 the JDK that you are currently using and any
>>>>                 third-party libraries that you have added as
>>>>                 dependencies to your project.
>>>>
>>>>                 Within the JDK18 library that is currently in your
>>>>                 Libraries node, the java.sql package is located. In
>>>>                 order for your project to use the SQL API
>>>>                 libraries, you must type a "requires java.sql;"
>>>>                 statement in the module-info.java /in each module
>>>>                 that relies upon the SQL API/. Until such time that
>>>>                 you place those requires statements in each module
>>>>                 needing it, none of your modules will be able to
>>>>                 access the SQL API.
>>>>
>>>>                 One further note: This is /not/ a NetBeans, nor a
>>>>                 NetBeans configuration, issue. This is completely
>>>>                 due to the way the JDK has been organized since
>>>>                 JDK9, when the JDK was modularized under Project
>>>>                 Jigsaw. Google the phrase "Project Jigsaw" and do
>>>>                 some reading so that you can better understand how
>>>>                 the JDK is organized. By doing this, it will help
>>>>                 you to better understand how to use the JDK more
>>>>                 effectively.
>>>>
>>>>                 -SC
>>>>
>>>>                 On 2/13/23 1:21 PM, Sean Carrick wrote:
>>>>>
>>>>>                 One more time...
>>>>>
>>>>>                 You _/*must add the dependency in your module.info
>>>>>                 <http://module.info> file*/_. The only module of
>>>>>                 the JDK that is included by default in any modular
>>>>>                 Java project is the java.base module. /All other
>>>>>                 needed modules *must be* manually included in your
>>>>>                 module-info.java file. /For example:
>>>>>
>>>>>                 module my.module {
>>>>>                      requires java.sql;    // java.base is IMPLICITLY required
>>>>>                      requires java.desktop; // For developing Java/Swing GUI applications
>>>>>                      
>>>>>                      // Add your exports, uses, and provides statements below.
>>>>>                 }
>>>>>
>>>>>                 To see which modules are included with the
>>>>>                 java.base module, see
>>>>>                 https://docs.oracle.com/en/java/javase/11/docs/api/java.base/module-summary.html
>>>>>                 <https://docs.oracle.com/en/java/javase/11/docs/api/java.base/module-summary.html>.
>>>>>                 If the module (such as java.sql) is not listed on
>>>>>                 this page, then it is /not /part of java.base. You
>>>>>                 could save a lot of "requires" statements in your
>>>>>                 module-info.java file by including a grouping such
>>>>>                 as java.se <http://java.se>. This will give you
>>>>>                 access to java.desktop packages, java.sql
>>>>>                 packages, as well as many others that are
>>>>>                 typically needed for J2SE application development.
>>>>>
>>>>>                 You ought to bookmark this link:
>>>>>                 https://docs.oracle.com/en/java/javase/14/docs/api/
>>>>>                 <https://docs.oracle.com/en/java/javase/14/docs/api/>
>>>>>
>>>>>                 That link is to the Java API JavaDoc pages for JDK
>>>>>                 14. If you need a different version of the JDK,
>>>>>                 change the 14 in the link above to the version you
>>>>>                 are interested in.
>>>>>
>>>>>                 -SC
>>>>>
>>>>>                 On 2/13/23 12:57 PM, Amitabh Choudhury wrote:
>>>>>>                 This is the bunch of  screenshots.
>>>>>>
>>>>>>                 On Tue, Feb 14, 2023 at 12:15 AM Amitabh
>>>>>>                 Choudhury <amitabhisgood@gmail.com
>>>>>>                 <ma...@gmail.com>> wrote:
>>>>>>
>>>>>>                     Hi Ernie (and others)
>>>>>>
>>>>>>                     Have used all default configurations. There
>>>>>>                     is java.sql module. That is being displayed
>>>>>>                     in "Java Platform Manager" but not getting
>>>>>>                     displayed in "Libraries" of the Ant
>>>>>>                     application. Screenshots are attached.
>>>>>>                     All settings are defaults.
>>>>>>
>>>>>>                     So, the action required is to include the
>>>>>>                     java.sql module in the Libraries of the
>>>>>>                     application. Even though it is in Java
>>>>>>                     Platform Manager, its missing in the default
>>>>>>                     libraries.
>>>>>>
>>>>>>                     Please guide.
>>>>>>
>>>>>>                     Warm wishes
>>>>>>
>>>>>>
>>>>>>
>>>>>>                     On Mon, Feb 13, 2023 at 11:42 PM Ernie Rael
>>>>>>                     <errael@raelity.com
>>>>>>                     <ma...@raelity.com>> wrote:
>>>>>>
>>>>>>                         The sql stuff is not in the "java.base"
>>>>>>                         module; there are separate
>>>>>>                         modules for the sql stuff. I don't use
>>>>>>                         modules, but I'm guessing the
>>>>>>                         problem is how your app (not NetBeans) is
>>>>>>                         configured.
>>>>>>
>>>>>>                         -ernie
>>>>>>
>>>>>>                         On 23/02/13 9:45 AM, Amitabh Choudhury wrote:
>>>>>>                         > Hello
>>>>>>                         >
>>>>>>                         > This is in continuation of my previous
>>>>>>                         mail related to Netbeans 14.
>>>>>>                         >
>>>>>>                         > Got aware that Netbeans 14 isn't
>>>>>>                         supported, so downloaded Netbeans 16
>>>>>>                         > and configured with Java 18.
>>>>>>                         >
>>>>>>                         > Created Ant project and checked java.base.
>>>>>>                         > java.sql is missing in this as well.
>>>>>>                         >
>>>>>>                         > Please guide to configure Netbeans 16
>>>>>>                         to include java.sql in java.base
>>>>>>                         > module of Default Library.
>>>>>>                         > Images attached ...
>>>>>>                         >
>>>>>>                         > Warm wishes
>>>>>>                         >
>>>>>>                         > ~~~
>>>>>>                         > Amitabh Choudhury
>>>>>>                         >
>>>>>>                         >
>>>>>>                         ---------------------------------------------------------------------
>>>>>>                         > To unsubscribe, e-mail:
>>>>>>                         users-unsubscribe@netbeans.apache.org
>>>>>>                         <ma...@netbeans.apache.org>
>>>>>>                         > For additional commands, e-mail:
>>>>>>                         users-help@netbeans.apache.org
>>>>>>                         <ma...@netbeans.apache.org>
>>>>>>                         >
>>>>>>                         > For further information about the
>>>>>>                         NetBeans mailing lists, visit:
>>>>>>                         >
>>>>>>                         https://cwiki.apache.org/confluence/display/NETBEANS/Mailing+lists
>>>>>>                         <https://cwiki.apache.org/confluence/display/NETBEANS/Mailing+lists>
>>>>>>
>>>>>>
>>>>>>
>>>>>>                         ---------------------------------------------------------------------
>>>>>>                         To unsubscribe, e-mail:
>>>>>>                         users-unsubscribe@netbeans.apache.org
>>>>>>                         <ma...@netbeans.apache.org>
>>>>>>                         For additional commands, e-mail:
>>>>>>                         users-help@netbeans.apache.org
>>>>>>                         <ma...@netbeans.apache.org>
>>>>>>
>>>>>>                         For further information about the
>>>>>>                         NetBeans mailing lists, visit:
>>>>>>                         https://cwiki.apache.org/confluence/display/NETBEANS/Mailing+lists
>>>>>>                         <https://cwiki.apache.org/confluence/display/NETBEANS/Mailing+lists>
>>>>>>
>>>>>>
>>>>>>                 ---------------------------------------------------------------------
>>>>>>                 To unsubscribe, e-mail:users-unsubscribe@netbeans.apache.org  <ma...@netbeans.apache.org>
>>>>>>                 For additional commands, e-mail:users-help@netbeans.apache.org  <ma...@netbeans.apache.org>
>>>>>>
>>>>>>                 For further information about the NetBeans mailing lists, visit:
>>>>>>                 https://cwiki.apache.org/confluence/display/NETBEANS/Mailing+lists  <https://cwiki.apache.org/confluence/display/NETBEANS/Mailing+lists>
>>>>
>>>>
>>>>             ---------------------------------------------------------------------
>>>>             To unsubscribe, e-mail:users-unsubscribe@netbeans.apache.org  <ma...@netbeans.apache.org>
>>>>             For additional commands, e-mail:users-help@netbeans.apache.org  <ma...@netbeans.apache.org>
>>>>
>>>>             For further information about the NetBeans mailing lists, visit:
>>>>             https://cwiki.apache.org/confluence/display/NETBEANS/Mailing+lists  <https://cwiki.apache.org/confluence/display/NETBEANS/Mailing+lists>
>>>

Re: java.sql missing from java.base in Netbeans 16 JDK 18 defaults

Posted by Amitabh Choudhury <am...@gmail.com>.
Sean

Thanks for the heads up. Getting hang of the flow.

How different would that modular structure be from adding a JAR file with
"java.sql" files, as a third party file in the Libraries?

Including an sql.jar will have less "baggage" than including a "Wrapper"
sort of. Isn't it? With the changing versions of Netbeans, "Java module"
will have to be upgraded. Isn't it?

~~~
Amitabh

On Tue, Feb 14, 2023 at 8:50 AM Sean Carrick <se...@pekinsoft.com> wrote:

> Amitabh,
>
> If you want to convert your project that is open in that screenshot to be
> a modular project, the first thing that you should do is create a
> *module-info.java* file in the default package of each of those JAR
> projects. Then, create a new Java Modular Project (for example
> "MyModularProject"), then copy/paste all of your JAR projects into the
> directory *~/NetBeansProjects/MyModularProject/src/*. They *should be*
> picked up by the main project as modules. You will need to delete all of
> the extraneous folders and files out of those directories and rename each
> of their "src" directories to "classes". Whatever the name of the directory
> in which the "src" directories are currently located is named will become
> the default module name for the new modules.
>
> -SC
> On 2/13/23 9:10 PM, Sean Carrick wrote:
>
> Hey Amitabh,
>
> I'm glad that I finally got it explained fully for you. Using your own
> screenshot, I circled the project type:
>
> [image: The Modular Java Project type.]
>
> When you choose this Project Template, you will get a project like the one
> in the screenshots I sent earlier. Basically, you end up with a project
> structure like this:
>
> [image: The modular project structure.]
>
> Each module in this project structure (i.e., another.mod, api.mod, and
> base.mod) is a separate "subproject" for the main project "TestModApp".
> What this means in real terms is that each module may rely on different
> third-party libraries and they have to be managed within that specific
> module. This is why each of those modules have a Libraries node. Having
> said that, once one module adds a third-party library to its Libraries
> node, that third-party library may be *required* by any other module
> within the top-level project ("TestModApp").
>
> I hope this helps you out...
>
> -SC
> On 2/13/23 8:58 PM, Amitabh Choudhury wrote:
>
> This is what I mean by "category of project".
>
> I was working with "Java with Ant" and "Java Application" project. Hence
> "module-info.java" didn't show up.
>
> How would you include "module-info.java" in "Java with Ant" and "Java
> Application" project?
>
> I am trying to replicate the project structure you showed. If the
> inclusion of "module-info.java" with "Module" as the data-structure,
> permitted in "Java with Ant" and "Java Application" projects?
>
>
> On Tue, Feb 14, 2023 at 8:21 AM Amitabh Choudhury <am...@gmail.com>
> wrote:
>
>> Hi Sean.
>>
>> Got out of bed sometime back. Saw this post now. Awesome!!!
>>
>> As I mentioned, I had to get the solution previous night at earliest. So
>> did what I did, then.
>>
>> Now I have flexibility to study the modular structure.
>>
>> Browsing through your code and screenshot now.
>>
>> Which category of project did you use to create the project? "Netbeans
>> Module"? "Java with Maven"? "Java with Ant"?
>>
>> I used "Java with Ant" and "Java Application".
>> I haven't come across "module-info.java" hence I suspect that the project
>> isn't a "Java with Ant" category project.
>>
>> I suspect that for each category, default code generated by Netbeans is
>> different, hence I wasn't aware of "module-info.java".
>>
>> I could comprehend, your information. Now, I need to know which category
>> of project was created? The directory structure isn't "Java with Ant"
>> category.
>>
>> Is "module-info.java" generated by Netbeans or you created it?
>> Seems like the "category of project" matters.
>>
>> Which category of project was created?
>>
>>
>>
>> Warm wishes
>>
>>
>>
>>
>>
>> On Tue, Feb 14, 2023 at 4:06 AM Sean Carrick <se...@pekinsoft.com> wrote:
>>
>>> Amitabh,
>>>
>>> NO! What you just said is *NOT* how you do it! Look at this screenshot:
>>>
>>> [image: Proper way to get Java SQL API into a modular project.]
>>>
>>> The code window on the right shows a class that is able to import and
>>> access the Java SQL API. Notice the Libraries nodes in the Project window
>>> toward the upper-left: the only thing imported is the JDK and the current
>>> module...*nothing else*.
>>>
>>> To accomplish this, all I did was to fill out the module-info.java file
>>> for the "another.mod" module:
>>>
>>> [image: module-info.java contents for another.mod module.]
>>>
>>> As you can see, even though I have *no third-party* SQL library in the
>>> Libraries node, I am requiring the use of java.sql in my module. This is
>>> because the Java SQL API is located in the module *java.sql* within the
>>> JDK. So, to use it in my project, I have to *require* it, as I have
>>> done in the image above.
>>>
>>> Now, once I have my DatabaseAccess class written, if I want to use it my
>>> module named "base.mod", I would need to place the following statement into
>>> the *base.mod:module-info.java* file:
>>>
>>> module base.module {
>>>     requires java.sql;	// To be able to import SQLException class.
>>>     requires another.mod;	// To import the exported class from my other module.
>>> }
>>>
>>> This is how modular development using Project Jigsaw works. You *must*
>>> create *explicit* contracts between the modules. Furthermore, if
>>> "base.mod" requires "another.mod" for the DatabaseAccess class, then
>>> "another.mod" *cannot* require "base.mod" because that would be a
>>> cyclic dependency and the compiler would not be able to determine which
>>> module to compile first.
>>>
>>> So, to properly develop a modular application in Java, you need to think
>>> through all of your requirements very carefully. You will want to create a
>>> module that is an API for your application, which can be required by any or
>>> all other modules in your application, but which itself has no requirements
>>> on any of the other modules. When you create this API module, it would be
>>> best if it only contained interfaces and abstract classes that must be
>>> implemented elsewhere. Then, you create implementations in the other
>>> modules and can use the Java class java.util.ServiceLoader to load the
>>> implementations where you need them, without needing to require the modules
>>> in which the implementations are defined. For example, if my example
>>> created an API module, it could look like this:
>>>
>>> [image: Modular application with an API module.]
>>>
>>> In this screenshot, you can see both the API module-info.java file and
>>> the interface that module contains (the two windows on top to the right).
>>> Also, you can see the module-info.java file and the implementation of the
>>> interface for "another.mod" module (lower two windows to the right). Let's
>>> talk about the api.mod:module-info.java file:
>>>
>>> Notice that *module api.mod* requires "java.sql", but uses the
>>> "transitive" keyword. This allows for any module that requires the module
>>> "api.mod" to also get a reference to the "java.sql" module without needing
>>> to declare so explicitly. We'll get to that in a minute. Notice the
>>> interface named "Database" on the upper-right...It is able to import both
>>> java.sql.ResultSet and java.sql.SQLException. This is due to the statement
>>> in the module-info.java file "requires java.sql". *This* is how you are
>>> able to use the Java SQL API in a modular Java application. Now, let's look
>>> at the implementation...
>>>
>>> In the two lower windows to the right, you see the
>>> another.mod:module-info.java file (left one) and the implementation of the
>>> Database interface (right one). In order to implement the Database
>>> interface, another.mod had to place the "requires api.mod" statement in its
>>> module-info.java file. Furthermore, notice that DatabaseAccess class
>>> imports classes from the java.sql package, but *does not* have a
>>> "requires java.sql" statement in its module-info.java file. This is because
>>> of the api.mod:module-info.java requiring java.sql as *transitive*. The
>>> *transitive* keyword means that another.module gets access to the
>>> java.sql module *implicitly* due to it dependency on api.module.
>>>
>>> Now, let's have our base module use the implementation of the Database
>>> interface, *without having a dependency on the another.mod module*...
>>>
>>> To implement the project API, we will create a main class in the
>>> base.mod module, place a "requires api.mod" statement in its
>>> module-info.java file, and then use the ServiceLoader to get the
>>> implementation defined in another.mod:
>>>
>>> [image: Implementing the API]
>>>
>>> The top window on the right is the module-info.java file for
>>> another.mod. It declares that it *provides* an implementation of the
>>> Database interface *with* the DatabaseAccess class.
>>>
>>> In the middle window on the right, you can see that the base.mod module
>>> *only* requires the api.mod module, so that it has access to the
>>> Database interface. Then, in the constructor of the MainClass, you see the
>>> use of the *java.util.ServiceLoader* class to get to the implementation
>>> of the Database interface that is defined by the module another.mod.
>>>
>>> With these screenshots and explanations, hopefully it makes more sense
>>> to you why you are not seeing the java.sql in your Libraries node in
>>> NetBeans. I've expanded the Libraries node in each of these screenshots so
>>> that you can see no where have I added a library for java.sql, but am able
>>> to use that package because of how I *require* it in my
>>> module-info.java files...
>>>
>>> -SC
>>> On 2/13/23 2:53 PM, Amitabh Choudhury wrote:
>>>
>>> Hi Sean
>>>
>>> Thanks for all the effort to explain the reasons. Very much appreciated.
>>> Especially this third message.
>>>
>>> I had to close the project fast. So your statement of "third party" gave
>>> the hint to pack required classes (java.sql package) in a "third party" jar
>>> and add it to the "Project Window".
>>> Did basic search on "Project jigsaw" and noted that it would take very
>>> slow reading to grasp that flow.
>>>
>>> Fortunately there was "sql.jar" available online that had packaged the
>>> "java.sql" class files in .jar.
>>>
>>> Used that to get the project rolling.
>>>
>>> This is standalone desktop Ant project.
>>> Couldn't find any "module-info.java" file generated by Netbeans.
>>> So I am yet to figure out what this "module-info.java" file is and where
>>> to place it in project structure.
>>> Then I will be able to add "requires java.sql;" statement in that file.
>>>
>>> Thanks for the guidance. Have to figure out where to find this
>>> 'module-info.java'.
>>>
>>> @Ernie - Thanks for the guidance.
>>>
>>> @László - Thanks for the guidance.
>>>
>>> Screenshots indicate that the "java.sql" is accepted.
>>>
>>> Thanks.
>>>
>>> Warm wishes
>>>
>>>
>>> On Tue, Feb 14, 2023 at 1:02 AM Sean Carrick <se...@pekinsoft.com> wrote:
>>>
>>>> Amitabh,
>>>>
>>>> Just to clarify, since I missed stating this in my last two messages
>>>> regarding your issue...
>>>>
>>>> When developing a *modular* Java project, the only items that should
>>>> be listed in your Libraries node in the Projects window of NetBeans IDE
>>>> should be the JDK that you are currently using and any third-party
>>>> libraries that you have added as dependencies to your project.
>>>>
>>>> Within the JDK18 library that is currently in your Libraries node, the
>>>> java.sql package is located. In order for your project to use the SQL API
>>>> libraries, you must type a "requires java.sql;" statement in the
>>>> module-info.java *in each module that relies upon the SQL API*. Until
>>>> such time that you place those requires statements in each module needing
>>>> it, none of your modules will be able to access the SQL API.
>>>>
>>>> One further note: This is *not* a NetBeans, nor a NetBeans
>>>> configuration, issue. This is completely due to the way the JDK has been
>>>> organized since JDK9, when the JDK was modularized under Project Jigsaw.
>>>> Google the phrase "Project Jigsaw" and do some reading so that you can
>>>> better understand how the JDK is organized. By doing this, it will help you
>>>> to better understand how to use the JDK more effectively.
>>>>
>>>> -SC
>>>> On 2/13/23 1:21 PM, Sean Carrick wrote:
>>>>
>>>> One more time...
>>>>
>>>> You *must add the dependency in your module.info <http://module.info>
>>>> file*. The only module of the JDK that is included by default in any
>>>> modular Java project is the java.base module. *All other needed
>>>> modules must be manually included in your module-info.java file. *For
>>>> example:
>>>>
>>>> module my.module {
>>>>     requires java.sql;    // java.base is IMPLICITLY required
>>>>     requires java.desktop; // For developing Java/Swing GUI applications
>>>>
>>>>     // Add your exports, uses, and provides statements below.
>>>> }
>>>>
>>>> To see which modules are included with the java.base module, see
>>>> https://docs.oracle.com/en/java/javase/11/docs/api/java.base/module-summary.html.
>>>> If the module (such as java.sql) is not listed on this page, then it is *not
>>>> *part of java.base. You could save a lot of "requires" statements in
>>>> your module-info.java file by including a grouping such as java.se.
>>>> This will give you access to java.desktop packages, java.sql packages, as
>>>> well as many others that are typically needed for J2SE application
>>>> development.
>>>>
>>>> You ought to bookmark this link:
>>>> https://docs.oracle.com/en/java/javase/14/docs/api/
>>>>
>>>> That link is to the Java API JavaDoc pages for JDK 14. If you need a
>>>> different version of the JDK, change the 14 in the link above to the
>>>> version you are interested in.
>>>>
>>>> -SC
>>>> On 2/13/23 12:57 PM, Amitabh Choudhury wrote:
>>>>
>>>> This is the bunch of  screenshots.
>>>>
>>>> On Tue, Feb 14, 2023 at 12:15 AM Amitabh Choudhury <
>>>> amitabhisgood@gmail.com> wrote:
>>>>
>>>>> Hi Ernie (and others)
>>>>>
>>>>> Have used all default configurations. There is java.sql module. That
>>>>> is being displayed in "Java Platform Manager" but not getting displayed in
>>>>> "Libraries" of the Ant application. Screenshots are attached.
>>>>> All settings are defaults.
>>>>>
>>>>> So, the action required is to include the java.sql module in the
>>>>> Libraries of the application. Even though it is in Java Platform Manager,
>>>>> its missing in the default libraries.
>>>>>
>>>>> Please guide.
>>>>>
>>>>> Warm wishes
>>>>>
>>>>>
>>>>>
>>>>> On Mon, Feb 13, 2023 at 11:42 PM Ernie Rael <er...@raelity.com>
>>>>> wrote:
>>>>>
>>>>>> The sql stuff is not in the "java.base" module; there are separate
>>>>>> modules for the sql stuff. I don't use modules, but I'm guessing the
>>>>>> problem is how your app (not NetBeans) is configured.
>>>>>>
>>>>>> -ernie
>>>>>>
>>>>>> On 23/02/13 9:45 AM, Amitabh Choudhury wrote:
>>>>>> > Hello
>>>>>> >
>>>>>> > This is in continuation of my previous mail related to Netbeans 14.
>>>>>> >
>>>>>> > Got aware that Netbeans 14 isn't supported, so downloaded Netbeans
>>>>>> 16
>>>>>> > and configured with Java 18.
>>>>>> >
>>>>>> > Created Ant project and checked java.base.
>>>>>> > java.sql is missing in this as well.
>>>>>> >
>>>>>> > Please guide to configure Netbeans 16 to include java.sql in
>>>>>> java.base
>>>>>> > module of Default Library.
>>>>>> > Images attached ...
>>>>>> >
>>>>>> > Warm wishes
>>>>>> >
>>>>>> > ~~~
>>>>>> > Amitabh Choudhury
>>>>>> >
>>>>>> >
>>>>>> ---------------------------------------------------------------------
>>>>>> > To unsubscribe, e-mail: users-unsubscribe@netbeans.apache.org
>>>>>> > For additional commands, e-mail: users-help@netbeans.apache.org
>>>>>> >
>>>>>> > For further information about the NetBeans mailing lists, visit:
>>>>>> > https://cwiki.apache.org/confluence/display/NETBEANS/Mailing+lists
>>>>>>
>>>>>>
>>>>>>
>>>>>> ---------------------------------------------------------------------
>>>>>> To unsubscribe, e-mail: users-unsubscribe@netbeans.apache.org
>>>>>> For additional commands, e-mail: users-help@netbeans.apache.org
>>>>>>
>>>>>> For further information about the NetBeans mailing lists, visit:
>>>>>> https://cwiki.apache.org/confluence/display/NETBEANS/Mailing+lists
>>>>>>
>>>>>>
>>>> ---------------------------------------------------------------------
>>>> To unsubscribe, e-mail: users-unsubscribe@netbeans.apache.org
>>>> For additional commands, e-mail: users-help@netbeans.apache.org
>>>>
>>>> For further information about the NetBeans mailing lists, visit:https://cwiki.apache.org/confluence/display/NETBEANS/Mailing+lists
>>>>
>>>>
>>> ---------------------------------------------------------------------
>>> To unsubscribe, e-mail: users-unsubscribe@netbeans.apache.org
>>> For additional commands, e-mail: users-help@netbeans.apache.org
>>>
>>> For further information about the NetBeans mailing lists, visit:https://cwiki.apache.org/confluence/display/NETBEANS/Mailing+lists
>>>
>>>

Re: java.sql missing from java.base in Netbeans 16 JDK 18 defaults

Posted by Sean Carrick <se...@pekinsoft.com>.
Amitabh,

If you want to convert your project that is open in that screenshot to 
be a modular project, the first thing that you should do is create a 
/module-info.java/ file in the default package of each of those JAR 
projects. Then, create a new Java Modular Project (for example 
"MyModularProject"), then copy/paste all of your JAR projects into the 
directory /~/NetBeansProjects/MyModularProject/src//. They /should be/ 
picked up by the main project as modules. You will need to delete all of 
the extraneous folders and files out of those directories and rename 
each of their "src" directories to "classes". Whatever the name of the 
directory in which the "src" directories are currently located is named 
will become the default module name for the new modules.

-SC

On 2/13/23 9:10 PM, Sean Carrick wrote:
>
> Hey Amitabh,
>
> I'm glad that I finally got it explained fully for you. Using your own 
> screenshot, I circled the project type:
>
> The Modular Java Project type.
>
> When you choose this Project Template, you will get a project like the 
> one in the screenshots I sent earlier. Basically, you end up with a 
> project structure like this:
>
> The modular project structure.
>
> Each module in this project structure (i.e., another.mod, api.mod, and 
> base.mod) is a separate "subproject" for the main project 
> "TestModApp". What this means in real terms is that each module may 
> rely on different third-party libraries and they have to be managed 
> within that specific module. This is why each of those modules have a 
> Libraries node. Having said that, once one module adds a third-party 
> library to its Libraries node, that third-party library may be 
> /required/ by any other module within the top-level project 
> ("TestModApp").
>
> I hope this helps you out...
>
> -SC
>
> On 2/13/23 8:58 PM, Amitabh Choudhury wrote:
>> This is what I mean by "category of project".
>>
>> I was working with "Java with Ant" and "Java Application" project. 
>> Hence "module-info.java" didn't show up.
>>
>> How would you include "module-info.java" in "Java with Ant" and "Java 
>> Application" project?
>>
>> I am trying to replicate the project structure you showed. If the 
>> inclusion of "module-info.java" with "Module" as the data-structure, 
>> permitted in "Java with Ant" and "Java Application" projects?
>>
>>
>> On Tue, Feb 14, 2023 at 8:21 AM Amitabh Choudhury 
>> <amitabhisgood@gmail.com <ma...@gmail.com>> wrote:
>>
>>     Hi Sean.
>>
>>     Got out of bed sometime back. Saw this post now. Awesome!!!
>>
>>     As I mentioned, I had to get the solution previous night at
>>     earliest. So did what I did, then.
>>
>>     Now I have flexibility to study the modular structure.
>>
>>     Browsing through your code and screenshot now.
>>
>>     Which category of project did you use to create the project?
>>     "Netbeans Module"? "Java with Maven"? "Java with Ant"?
>>
>>     I used "Java with Ant" and "Java Application".
>>     I haven't come across "module-info.java" hence I suspect that the
>>     project isn't a "Java with Ant" category project.
>>
>>     I suspect that for each category, default code generated by
>>     Netbeans is different, hence I wasn't aware of "module-info.java".
>>
>>     I could comprehend, your information. Now, I need to know which
>>     category of project was created? The directory structure isn't
>>     "Java with Ant" category.
>>
>>     Is "module-info.java" generated by Netbeans or you created it?
>>     Seems like the "category of project" matters.
>>
>>     Which category of project was created?
>>
>>
>>
>>     Warm wishes
>>
>>
>>
>>
>>
>>     On Tue, Feb 14, 2023 at 4:06 AM Sean Carrick <sean@pekinsoft.com
>>     <ma...@pekinsoft.com>> wrote:
>>
>>         Amitabh,
>>
>>         NO! What you just said is /_*NOT*_/ how you do it! Look at
>>         this screenshot:
>>
>>         Proper way to get Java SQL API into a modular project.
>>
>>         The code window on the right shows a class that is able to
>>         import and access the Java SQL API. Notice the Libraries
>>         nodes in the Project window toward the upper-left: the only
>>         thing imported is the JDK and the current module.../*nothing
>>         else*/.
>>
>>         To accomplish this, all I did was to fill out the
>>         module-info.java file for the "another.mod" module:
>>
>>         module-info.java contents for another.mod module.
>>
>>         As you can see, even though I have /no third-party/ SQL
>>         library in the Libraries node, I am requiring the use of
>>         java.sql in my module. This is because the Java SQL API is
>>         located in the module /java.sql/ within the JDK. So, to use
>>         it in my project, I have to /require/ it, as I have done in
>>         the image above.
>>
>>         Now, once I have my DatabaseAccess class written, if I want
>>         to use it my module named "base.mod", I would need to place
>>         the following statement into the /base.mod:module-info.java/
>>         file:
>>
>>         module base.module {
>>              requires java.sql;	// To be able to import SQLException class.
>>              requires another.mod;	// To import the exported class from my other module.
>>         }
>>
>>         This is how modular development using Project Jigsaw works.
>>         You /*must*/ create /explicit/ contracts between the modules.
>>         Furthermore, if "base.mod" requires "another.mod" for the
>>         DatabaseAccess class, then "another.mod" /*cannot*/ require
>>         "base.mod" because that would be a cyclic dependency and the
>>         compiler would not be able to determine which module to
>>         compile first.
>>
>>         So, to properly develop a modular application in Java, you
>>         need to think through all of your requirements very
>>         carefully. You will want to create a module that is an API
>>         for your application, which can be required by any or all
>>         other modules in your application, but which itself has no
>>         requirements on any of the other modules. When you create
>>         this API module, it would be best if it only contained
>>         interfaces and abstract classes that must be implemented
>>         elsewhere. Then, you create implementations in the other
>>         modules and can use the Java class java.util.ServiceLoader to
>>         load the implementations where you need them, without needing
>>         to require the modules in which the implementations are
>>         defined. For example, if my example created an API module, it
>>         could look like this:
>>
>>         Modular application with an API module.
>>
>>         In this screenshot, you can see both the API module-info.java
>>         file and the interface that module contains (the two windows
>>         on top to the right). Also, you can see the module-info.java
>>         file and the implementation of the interface for
>>         "another.mod" module (lower two windows to the right). Let's
>>         talk about the api.mod:module-info.java file:
>>
>>         Notice that /module api.mod/ requires "java.sql", but uses
>>         the "transitive" keyword. This allows for any module that
>>         requires the module "api.mod" to also get a reference to the
>>         "java.sql" module without needing to declare so explicitly.
>>         We'll get to that in a minute. Notice the interface named
>>         "Database" on the upper-right...It is able to import both
>>         java.sql.ResultSet and java.sql.SQLException. This is due to
>>         the statement in the module-info.java file "requires
>>         java.sql". /*This*/ is how you are able to use the Java SQL
>>         API in a modular Java application. Now, let's look at the
>>         implementation...
>>
>>         In the two lower windows to the right, you see the
>>         another.mod:module-info.java file (left one) and the
>>         implementation of the Database interface (right one). In
>>         order to implement the Database interface, another.mod had to
>>         place the "requires api.mod" statement in its
>>         module-info.java file. Furthermore, notice that
>>         DatabaseAccess class imports classes from the java.sql
>>         package, but /does not/ have a "requires java.sql" statement
>>         in its module-info.java file. This is because of the
>>         api.mod:module-info.java requiring java.sql as /transitive/.
>>         The /transitive/ keyword means that another.module gets
>>         access to the java.sql module /implicitly/ due to it
>>         dependency on api.module.
>>
>>         Now, let's have our base module use the implementation of the
>>         Database interface, /without having a dependency on the
>>         another.mod module/...
>>
>>         To implement the project API, we will create a main class in
>>         the base.mod module, place a "requires api.mod" statement in
>>         its module-info.java file, and then use the ServiceLoader to
>>         get the implementation defined in another.mod:
>>
>>         Implementing the API
>>
>>         The top window on the right is the module-info.java file for
>>         another.mod. It declares that it /provides/ an implementation
>>         of the Database interface /with/ the DatabaseAccess class.
>>
>>         In the middle window on the right, you can see that the
>>         base.mod module /only/ requires the api.mod module, so that
>>         it has access to the Database interface. Then, in the
>>         constructor of the MainClass, you see the use of the
>>         /java.util.ServiceLoader/ class to get to the implementation
>>         of the Database interface that is defined by the module
>>         another.mod.
>>
>>         With these screenshots and explanations, hopefully it makes
>>         more sense to you why you are not seeing the java.sql in your
>>         Libraries node in NetBeans. I've expanded the Libraries node
>>         in each of these screenshots so that you can see no where
>>         have I added a library for java.sql, but am able to use that
>>         package because of how I /require/ it in my module-info.java
>>         files...
>>
>>         -SC
>>
>>         On 2/13/23 2:53 PM, Amitabh Choudhury wrote:
>>>         Hi Sean
>>>
>>>         Thanks for all the effort to explain the reasons. Very much
>>>         appreciated. Especially this third message.
>>>
>>>         I had to close the project fast. So your statement of "third
>>>         party" gave the hint to pack required classes (java.sql
>>>         package) in a "third party" jar and add it to the "Project
>>>         Window".
>>>         Did basic search on "Project jigsaw" and noted that it would
>>>         take very slow reading to grasp that flow.
>>>
>>>         Fortunately there was "sql.jar" available online that had
>>>         packaged the "java.sql" class files in .jar.
>>>
>>>         Used that to get the project rolling.
>>>
>>>         This is standalone desktop Ant project.
>>>         Couldn't find any "module-info.java" file generated by
>>>         Netbeans.
>>>         So I am yet to figure out what this "module-info.java" file
>>>         is and where to place it in project structure.
>>>         Then I will be able to add "requires java.sql;" statement in
>>>         that file.
>>>
>>>         Thanks for the guidance. Have to figure out where to find
>>>         this 'module-info.java'.
>>>
>>>         @Ernie - Thanks for the guidance.
>>>
>>>         @László - Thanks for the guidance.
>>>
>>>         Screenshots indicate that the "java.sql" is accepted.
>>>
>>>         Thanks.
>>>
>>>         Warm wishes
>>>
>>>
>>>         On Tue, Feb 14, 2023 at 1:02 AM Sean Carrick
>>>         <sean@pekinsoft.com <ma...@pekinsoft.com>> wrote:
>>>
>>>             Amitabh,
>>>
>>>             Just to clarify, since I missed stating this in my last
>>>             two messages regarding your issue...
>>>
>>>             When developing a /modular/ Java project, the only items
>>>             that should be listed in your Libraries node in the
>>>             Projects window of NetBeans IDE should be the JDK that
>>>             you are currently using and any third-party libraries
>>>             that you have added as dependencies to your project.
>>>
>>>             Within the JDK18 library that is currently in your
>>>             Libraries node, the java.sql package is located. In
>>>             order for your project to use the SQL API libraries, you
>>>             must type a "requires java.sql;" statement in the
>>>             module-info.java /in each module that relies upon the
>>>             SQL API/. Until such time that you place those requires
>>>             statements in each module needing it, none of your
>>>             modules will be able to access the SQL API.
>>>
>>>             One further note: This is /not/ a NetBeans, nor a
>>>             NetBeans configuration, issue. This is completely due to
>>>             the way the JDK has been organized since JDK9, when the
>>>             JDK was modularized under Project Jigsaw. Google the
>>>             phrase "Project Jigsaw" and do some reading so that you
>>>             can better understand how the JDK is organized. By doing
>>>             this, it will help you to better understand how to use
>>>             the JDK more effectively.
>>>
>>>             -SC
>>>
>>>             On 2/13/23 1:21 PM, Sean Carrick wrote:
>>>>
>>>>             One more time...
>>>>
>>>>             You _/*must add the dependency in your module.info
>>>>             <http://module.info> file*/_. The only module of the
>>>>             JDK that is included by default in any modular Java
>>>>             project is the java.base module. /All other needed
>>>>             modules *must be* manually included in your
>>>>             module-info.java file. /For example:
>>>>
>>>>             module my.module {
>>>>                  requires java.sql;    // java.base is IMPLICITLY required
>>>>                  requires java.desktop; // For developing Java/Swing GUI applications
>>>>                  
>>>>                  // Add your exports, uses, and provides statements below.
>>>>             }
>>>>
>>>>             To see which modules are included with the java.base
>>>>             module, see
>>>>             https://docs.oracle.com/en/java/javase/11/docs/api/java.base/module-summary.html
>>>>             <https://docs.oracle.com/en/java/javase/11/docs/api/java.base/module-summary.html>.
>>>>             If the module (such as java.sql) is not listed on this
>>>>             page, then it is /not /part of java.base. You could
>>>>             save a lot of "requires" statements in your
>>>>             module-info.java file by including a grouping such as
>>>>             java.se <http://java.se>. This will give you access to
>>>>             java.desktop packages, java.sql packages, as well as
>>>>             many others that are typically needed for J2SE
>>>>             application development.
>>>>
>>>>             You ought to bookmark this link:
>>>>             https://docs.oracle.com/en/java/javase/14/docs/api/
>>>>             <https://docs.oracle.com/en/java/javase/14/docs/api/>
>>>>
>>>>             That link is to the Java API JavaDoc pages for JDK 14.
>>>>             If you need a different version of the JDK, change the
>>>>             14 in the link above to the version you are interested in.
>>>>
>>>>             -SC
>>>>
>>>>             On 2/13/23 12:57 PM, Amitabh Choudhury wrote:
>>>>>             This is the bunch of screenshots.
>>>>>
>>>>>             On Tue, Feb 14, 2023 at 12:15 AM Amitabh Choudhury
>>>>>             <amitabhisgood@gmail.com
>>>>>             <ma...@gmail.com>> wrote:
>>>>>
>>>>>                 Hi Ernie (and others)
>>>>>
>>>>>                 Have used all default configurations. There is
>>>>>                 java.sql module. That is being displayed in "Java
>>>>>                 Platform Manager" but not getting displayed in
>>>>>                 "Libraries" of the Ant application.
>>>>>                 Screenshots are attached.
>>>>>                 All settings are defaults.
>>>>>
>>>>>                 So, the action required is to include the java.sql
>>>>>                 module in the Libraries of the application. Even
>>>>>                 though it is in Java Platform Manager, its missing
>>>>>                 in the default libraries.
>>>>>
>>>>>                 Please guide.
>>>>>
>>>>>                 Warm wishes
>>>>>
>>>>>
>>>>>
>>>>>                 On Mon, Feb 13, 2023 at 11:42 PM Ernie Rael
>>>>>                 <errael@raelity.com <ma...@raelity.com>>
>>>>>                 wrote:
>>>>>
>>>>>                     The sql stuff is not in the "java.base"
>>>>>                     module; there are separate
>>>>>                     modules for the sql stuff. I don't use
>>>>>                     modules, but I'm guessing the
>>>>>                     problem is how your app (not NetBeans) is
>>>>>                     configured.
>>>>>
>>>>>                     -ernie
>>>>>
>>>>>                     On 23/02/13 9:45 AM, Amitabh Choudhury wrote:
>>>>>                     > Hello
>>>>>                     >
>>>>>                     > This is in continuation of my previous mail
>>>>>                     related to Netbeans 14.
>>>>>                     >
>>>>>                     > Got aware that Netbeans 14 isn't supported,
>>>>>                     so downloaded Netbeans 16
>>>>>                     > and configured with Java 18.
>>>>>                     >
>>>>>                     > Created Ant project and checked java.base.
>>>>>                     > java.sql is missing in this as well.
>>>>>                     >
>>>>>                     > Please guide to configure Netbeans 16 to
>>>>>                     include java.sql in java.base
>>>>>                     > module of Default Library.
>>>>>                     > Images attached ...
>>>>>                     >
>>>>>                     > Warm wishes
>>>>>                     >
>>>>>                     > ~~~
>>>>>                     > Amitabh Choudhury
>>>>>                     >
>>>>>                     >
>>>>>                     ---------------------------------------------------------------------
>>>>>                     > To unsubscribe, e-mail:
>>>>>                     users-unsubscribe@netbeans.apache.org
>>>>>                     <ma...@netbeans.apache.org>
>>>>>                     > For additional commands, e-mail:
>>>>>                     users-help@netbeans.apache.org
>>>>>                     <ma...@netbeans.apache.org>
>>>>>                     >
>>>>>                     > For further information about the NetBeans
>>>>>                     mailing lists, visit:
>>>>>                     >
>>>>>                     https://cwiki.apache.org/confluence/display/NETBEANS/Mailing+lists
>>>>>                     <https://cwiki.apache.org/confluence/display/NETBEANS/Mailing+lists>
>>>>>
>>>>>
>>>>>
>>>>>                     ---------------------------------------------------------------------
>>>>>                     To unsubscribe, e-mail:
>>>>>                     users-unsubscribe@netbeans.apache.org
>>>>>                     <ma...@netbeans.apache.org>
>>>>>                     For additional commands, e-mail:
>>>>>                     users-help@netbeans.apache.org
>>>>>                     <ma...@netbeans.apache.org>
>>>>>
>>>>>                     For further information about the NetBeans
>>>>>                     mailing lists, visit:
>>>>>                     https://cwiki.apache.org/confluence/display/NETBEANS/Mailing+lists
>>>>>                     <https://cwiki.apache.org/confluence/display/NETBEANS/Mailing+lists>
>>>>>
>>>>>
>>>>>             ---------------------------------------------------------------------
>>>>>             To unsubscribe, e-mail:users-unsubscribe@netbeans.apache.org  <ma...@netbeans.apache.org>
>>>>>             For additional commands, e-mail:users-help@netbeans.apache.org  <ma...@netbeans.apache.org>
>>>>>
>>>>>             For further information about the NetBeans mailing lists, visit:
>>>>>             https://cwiki.apache.org/confluence/display/NETBEANS/Mailing+lists  <https://cwiki.apache.org/confluence/display/NETBEANS/Mailing+lists>
>>>
>>>
>>>         ---------------------------------------------------------------------
>>>         To unsubscribe, e-mail:users-unsubscribe@netbeans.apache.org  <ma...@netbeans.apache.org>
>>>         For additional commands, e-mail:users-help@netbeans.apache.org  <ma...@netbeans.apache.org>
>>>
>>>         For further information about the NetBeans mailing lists, visit:
>>>         https://cwiki.apache.org/confluence/display/NETBEANS/Mailing+lists  <https://cwiki.apache.org/confluence/display/NETBEANS/Mailing+lists>
>>

Re: java.sql missing from java.base in Netbeans 16 JDK 18 defaults

Posted by Amitabh Choudhury <am...@gmail.com>.
Hi Sean

Thanks.

In essence, I should have a "Java module" ready, to include in my JDBC
projects, as a Library.

Right?

~~~
Amitabh

On Tue, Feb 14, 2023 at 8:40 AM Sean Carrick <se...@pekinsoft.com> wrote:

> Hey Amitabh,
>
> I'm glad that I finally got it explained fully for you. Using your own
> screenshot, I circled the project type:
>
> [image: The Modular Java Project type.]
>
> When you choose this Project Template, you will get a project like the one
> in the screenshots I sent earlier. Basically, you end up with a project
> structure like this:
>
> [image: The modular project structure.]
>
> Each module in this project structure (i.e., another.mod, api.mod, and
> base.mod) is a separate "subproject" for the main project "TestModApp".
> What this means in real terms is that each module may rely on different
> third-party libraries and they have to be managed within that specific
> module. This is why each of those modules have a Libraries node. Having
> said that, once one module adds a third-party library to its Libraries
> node, that third-party library may be *required* by any other module
> within the top-level project ("TestModApp").
>
> I hope this helps you out...
>
> -SC
> On 2/13/23 8:58 PM, Amitabh Choudhury wrote:
>
> This is what I mean by "category of project".
>
> I was working with "Java with Ant" and "Java Application" project. Hence
> "module-info.java" didn't show up.
>
> How would you include "module-info.java" in "Java with Ant" and "Java
> Application" project?
>
> I am trying to replicate the project structure you showed. If the
> inclusion of "module-info.java" with "Module" as the data-structure,
> permitted in "Java with Ant" and "Java Application" projects?
>
>
> On Tue, Feb 14, 2023 at 8:21 AM Amitabh Choudhury <am...@gmail.com>
> wrote:
>
>> Hi Sean.
>>
>> Got out of bed sometime back. Saw this post now. Awesome!!!
>>
>> As I mentioned, I had to get the solution previous night at earliest. So
>> did what I did, then.
>>
>> Now I have flexibility to study the modular structure.
>>
>> Browsing through your code and screenshot now.
>>
>> Which category of project did you use to create the project? "Netbeans
>> Module"? "Java with Maven"? "Java with Ant"?
>>
>> I used "Java with Ant" and "Java Application".
>> I haven't come across "module-info.java" hence I suspect that the project
>> isn't a "Java with Ant" category project.
>>
>> I suspect that for each category, default code generated by Netbeans is
>> different, hence I wasn't aware of "module-info.java".
>>
>> I could comprehend, your information. Now, I need to know which category
>> of project was created? The directory structure isn't "Java with Ant"
>> category.
>>
>> Is "module-info.java" generated by Netbeans or you created it?
>> Seems like the "category of project" matters.
>>
>> Which category of project was created?
>>
>>
>>
>> Warm wishes
>>
>>
>>
>>
>>
>> On Tue, Feb 14, 2023 at 4:06 AM Sean Carrick <se...@pekinsoft.com> wrote:
>>
>>> Amitabh,
>>>
>>> NO! What you just said is *NOT* how you do it! Look at this screenshot:
>>>
>>> [image: Proper way to get Java SQL API into a modular project.]
>>>
>>> The code window on the right shows a class that is able to import and
>>> access the Java SQL API. Notice the Libraries nodes in the Project window
>>> toward the upper-left: the only thing imported is the JDK and the current
>>> module...*nothing else*.
>>>
>>> To accomplish this, all I did was to fill out the module-info.java file
>>> for the "another.mod" module:
>>>
>>> [image: module-info.java contents for another.mod module.]
>>>
>>> As you can see, even though I have *no third-party* SQL library in the
>>> Libraries node, I am requiring the use of java.sql in my module. This is
>>> because the Java SQL API is located in the module *java.sql* within the
>>> JDK. So, to use it in my project, I have to *require* it, as I have
>>> done in the image above.
>>>
>>> Now, once I have my DatabaseAccess class written, if I want to use it my
>>> module named "base.mod", I would need to place the following statement into
>>> the *base.mod:module-info.java* file:
>>>
>>> module base.module {
>>>     requires java.sql;	// To be able to import SQLException class.
>>>     requires another.mod;	// To import the exported class from my other module.
>>> }
>>>
>>> This is how modular development using Project Jigsaw works. You *must*
>>> create *explicit* contracts between the modules. Furthermore, if
>>> "base.mod" requires "another.mod" for the DatabaseAccess class, then
>>> "another.mod" *cannot* require "base.mod" because that would be a
>>> cyclic dependency and the compiler would not be able to determine which
>>> module to compile first.
>>>
>>> So, to properly develop a modular application in Java, you need to think
>>> through all of your requirements very carefully. You will want to create a
>>> module that is an API for your application, which can be required by any or
>>> all other modules in your application, but which itself has no requirements
>>> on any of the other modules. When you create this API module, it would be
>>> best if it only contained interfaces and abstract classes that must be
>>> implemented elsewhere. Then, you create implementations in the other
>>> modules and can use the Java class java.util.ServiceLoader to load the
>>> implementations where you need them, without needing to require the modules
>>> in which the implementations are defined. For example, if my example
>>> created an API module, it could look like this:
>>>
>>> [image: Modular application with an API module.]
>>>
>>> In this screenshot, you can see both the API module-info.java file and
>>> the interface that module contains (the two windows on top to the right).
>>> Also, you can see the module-info.java file and the implementation of the
>>> interface for "another.mod" module (lower two windows to the right). Let's
>>> talk about the api.mod:module-info.java file:
>>>
>>> Notice that *module api.mod* requires "java.sql", but uses the
>>> "transitive" keyword. This allows for any module that requires the module
>>> "api.mod" to also get a reference to the "java.sql" module without needing
>>> to declare so explicitly. We'll get to that in a minute. Notice the
>>> interface named "Database" on the upper-right...It is able to import both
>>> java.sql.ResultSet and java.sql.SQLException. This is due to the statement
>>> in the module-info.java file "requires java.sql". *This* is how you are
>>> able to use the Java SQL API in a modular Java application. Now, let's look
>>> at the implementation...
>>>
>>> In the two lower windows to the right, you see the
>>> another.mod:module-info.java file (left one) and the implementation of the
>>> Database interface (right one). In order to implement the Database
>>> interface, another.mod had to place the "requires api.mod" statement in its
>>> module-info.java file. Furthermore, notice that DatabaseAccess class
>>> imports classes from the java.sql package, but *does not* have a
>>> "requires java.sql" statement in its module-info.java file. This is because
>>> of the api.mod:module-info.java requiring java.sql as *transitive*. The
>>> *transitive* keyword means that another.module gets access to the
>>> java.sql module *implicitly* due to it dependency on api.module.
>>>
>>> Now, let's have our base module use the implementation of the Database
>>> interface, *without having a dependency on the another.mod module*...
>>>
>>> To implement the project API, we will create a main class in the
>>> base.mod module, place a "requires api.mod" statement in its
>>> module-info.java file, and then use the ServiceLoader to get the
>>> implementation defined in another.mod:
>>>
>>> [image: Implementing the API]
>>>
>>> The top window on the right is the module-info.java file for
>>> another.mod. It declares that it *provides* an implementation of the
>>> Database interface *with* the DatabaseAccess class.
>>>
>>> In the middle window on the right, you can see that the base.mod module
>>> *only* requires the api.mod module, so that it has access to the
>>> Database interface. Then, in the constructor of the MainClass, you see the
>>> use of the *java.util.ServiceLoader* class to get to the implementation
>>> of the Database interface that is defined by the module another.mod.
>>>
>>> With these screenshots and explanations, hopefully it makes more sense
>>> to you why you are not seeing the java.sql in your Libraries node in
>>> NetBeans. I've expanded the Libraries node in each of these screenshots so
>>> that you can see no where have I added a library for java.sql, but am able
>>> to use that package because of how I *require* it in my
>>> module-info.java files...
>>>
>>> -SC
>>> On 2/13/23 2:53 PM, Amitabh Choudhury wrote:
>>>
>>> Hi Sean
>>>
>>> Thanks for all the effort to explain the reasons. Very much appreciated.
>>> Especially this third message.
>>>
>>> I had to close the project fast. So your statement of "third party" gave
>>> the hint to pack required classes (java.sql package) in a "third party" jar
>>> and add it to the "Project Window".
>>> Did basic search on "Project jigsaw" and noted that it would take very
>>> slow reading to grasp that flow.
>>>
>>> Fortunately there was "sql.jar" available online that had packaged the
>>> "java.sql" class files in .jar.
>>>
>>> Used that to get the project rolling.
>>>
>>> This is standalone desktop Ant project.
>>> Couldn't find any "module-info.java" file generated by Netbeans.
>>> So I am yet to figure out what this "module-info.java" file is and where
>>> to place it in project structure.
>>> Then I will be able to add "requires java.sql;" statement in that file.
>>>
>>> Thanks for the guidance. Have to figure out where to find this
>>> 'module-info.java'.
>>>
>>> @Ernie - Thanks for the guidance.
>>>
>>> @László - Thanks for the guidance.
>>>
>>> Screenshots indicate that the "java.sql" is accepted.
>>>
>>> Thanks.
>>>
>>> Warm wishes
>>>
>>>
>>> On Tue, Feb 14, 2023 at 1:02 AM Sean Carrick <se...@pekinsoft.com> wrote:
>>>
>>>> Amitabh,
>>>>
>>>> Just to clarify, since I missed stating this in my last two messages
>>>> regarding your issue...
>>>>
>>>> When developing a *modular* Java project, the only items that should
>>>> be listed in your Libraries node in the Projects window of NetBeans IDE
>>>> should be the JDK that you are currently using and any third-party
>>>> libraries that you have added as dependencies to your project.
>>>>
>>>> Within the JDK18 library that is currently in your Libraries node, the
>>>> java.sql package is located. In order for your project to use the SQL API
>>>> libraries, you must type a "requires java.sql;" statement in the
>>>> module-info.java *in each module that relies upon the SQL API*. Until
>>>> such time that you place those requires statements in each module needing
>>>> it, none of your modules will be able to access the SQL API.
>>>>
>>>> One further note: This is *not* a NetBeans, nor a NetBeans
>>>> configuration, issue. This is completely due to the way the JDK has been
>>>> organized since JDK9, when the JDK was modularized under Project Jigsaw.
>>>> Google the phrase "Project Jigsaw" and do some reading so that you can
>>>> better understand how the JDK is organized. By doing this, it will help you
>>>> to better understand how to use the JDK more effectively.
>>>>
>>>> -SC
>>>> On 2/13/23 1:21 PM, Sean Carrick wrote:
>>>>
>>>> One more time...
>>>>
>>>> You *must add the dependency in your module.info <http://module.info>
>>>> file*. The only module of the JDK that is included by default in any
>>>> modular Java project is the java.base module. *All other needed
>>>> modules must be manually included in your module-info.java file. *For
>>>> example:
>>>>
>>>> module my.module {
>>>>     requires java.sql;    // java.base is IMPLICITLY required
>>>>     requires java.desktop; // For developing Java/Swing GUI applications
>>>>
>>>>     // Add your exports, uses, and provides statements below.
>>>> }
>>>>
>>>> To see which modules are included with the java.base module, see
>>>> https://docs.oracle.com/en/java/javase/11/docs/api/java.base/module-summary.html.
>>>> If the module (such as java.sql) is not listed on this page, then it is *not
>>>> *part of java.base. You could save a lot of "requires" statements in
>>>> your module-info.java file by including a grouping such as java.se.
>>>> This will give you access to java.desktop packages, java.sql packages, as
>>>> well as many others that are typically needed for J2SE application
>>>> development.
>>>>
>>>> You ought to bookmark this link:
>>>> https://docs.oracle.com/en/java/javase/14/docs/api/
>>>>
>>>> That link is to the Java API JavaDoc pages for JDK 14. If you need a
>>>> different version of the JDK, change the 14 in the link above to the
>>>> version you are interested in.
>>>>
>>>> -SC
>>>> On 2/13/23 12:57 PM, Amitabh Choudhury wrote:
>>>>
>>>> This is the bunch of  screenshots.
>>>>
>>>> On Tue, Feb 14, 2023 at 12:15 AM Amitabh Choudhury <
>>>> amitabhisgood@gmail.com> wrote:
>>>>
>>>>> Hi Ernie (and others)
>>>>>
>>>>> Have used all default configurations. There is java.sql module. That
>>>>> is being displayed in "Java Platform Manager" but not getting displayed in
>>>>> "Libraries" of the Ant application. Screenshots are attached.
>>>>> All settings are defaults.
>>>>>
>>>>> So, the action required is to include the java.sql module in the
>>>>> Libraries of the application. Even though it is in Java Platform Manager,
>>>>> its missing in the default libraries.
>>>>>
>>>>> Please guide.
>>>>>
>>>>> Warm wishes
>>>>>
>>>>>
>>>>>
>>>>> On Mon, Feb 13, 2023 at 11:42 PM Ernie Rael <er...@raelity.com>
>>>>> wrote:
>>>>>
>>>>>> The sql stuff is not in the "java.base" module; there are separate
>>>>>> modules for the sql stuff. I don't use modules, but I'm guessing the
>>>>>> problem is how your app (not NetBeans) is configured.
>>>>>>
>>>>>> -ernie
>>>>>>
>>>>>> On 23/02/13 9:45 AM, Amitabh Choudhury wrote:
>>>>>> > Hello
>>>>>> >
>>>>>> > This is in continuation of my previous mail related to Netbeans 14.
>>>>>> >
>>>>>> > Got aware that Netbeans 14 isn't supported, so downloaded Netbeans
>>>>>> 16
>>>>>> > and configured with Java 18.
>>>>>> >
>>>>>> > Created Ant project and checked java.base.
>>>>>> > java.sql is missing in this as well.
>>>>>> >
>>>>>> > Please guide to configure Netbeans 16 to include java.sql in
>>>>>> java.base
>>>>>> > module of Default Library.
>>>>>> > Images attached ...
>>>>>> >
>>>>>> > Warm wishes
>>>>>> >
>>>>>> > ~~~
>>>>>> > Amitabh Choudhury
>>>>>> >
>>>>>> >
>>>>>> ---------------------------------------------------------------------
>>>>>> > To unsubscribe, e-mail: users-unsubscribe@netbeans.apache.org
>>>>>> > For additional commands, e-mail: users-help@netbeans.apache.org
>>>>>> >
>>>>>> > For further information about the NetBeans mailing lists, visit:
>>>>>> > https://cwiki.apache.org/confluence/display/NETBEANS/Mailing+lists
>>>>>>
>>>>>>
>>>>>>
>>>>>> ---------------------------------------------------------------------
>>>>>> To unsubscribe, e-mail: users-unsubscribe@netbeans.apache.org
>>>>>> For additional commands, e-mail: users-help@netbeans.apache.org
>>>>>>
>>>>>> For further information about the NetBeans mailing lists, visit:
>>>>>> https://cwiki.apache.org/confluence/display/NETBEANS/Mailing+lists
>>>>>>
>>>>>>
>>>> ---------------------------------------------------------------------
>>>> To unsubscribe, e-mail: users-unsubscribe@netbeans.apache.org
>>>> For additional commands, e-mail: users-help@netbeans.apache.org
>>>>
>>>> For further information about the NetBeans mailing lists, visit:https://cwiki.apache.org/confluence/display/NETBEANS/Mailing+lists
>>>>
>>>>
>>> ---------------------------------------------------------------------
>>> To unsubscribe, e-mail: users-unsubscribe@netbeans.apache.org
>>> For additional commands, e-mail: users-help@netbeans.apache.org
>>>
>>> For further information about the NetBeans mailing lists, visit:https://cwiki.apache.org/confluence/display/NETBEANS/Mailing+lists
>>>
>>>

Re: java.sql missing from java.base in Netbeans 16 JDK 18 defaults

Posted by Sean Carrick <se...@pekinsoft.com>.
Hey Amitabh,

I'm glad that I finally got it explained fully for you. Using your own 
screenshot, I circled the project type:

The Modular Java Project type.

When you choose this Project Template, you will get a project like the 
one in the screenshots I sent earlier. Basically, you end up with a 
project structure like this:

The modular project structure.

Each module in this project structure (i.e., another.mod, api.mod, and 
base.mod) is a separate "subproject" for the main project "TestModApp". 
What this means in real terms is that each module may rely on different 
third-party libraries and they have to be managed within that specific 
module. This is why each of those modules have a Libraries node. Having 
said that, once one module adds a third-party library to its Libraries 
node, that third-party library may be /required/ by any other module 
within the top-level project ("TestModApp").

I hope this helps you out...

-SC

On 2/13/23 8:58 PM, Amitabh Choudhury wrote:
> This is what I mean by "category of project".
>
> I was working with "Java with Ant" and "Java Application" project. 
> Hence "module-info.java" didn't show up.
>
> How would you include "module-info.java" in "Java with Ant" and "Java 
> Application" project?
>
> I am trying to replicate the project structure you showed. If the 
> inclusion of "module-info.java" with "Module" as the data-structure, 
> permitted in "Java with Ant" and "Java Application" projects?
>
>
> On Tue, Feb 14, 2023 at 8:21 AM Amitabh Choudhury 
> <amitabhisgood@gmail.com <ma...@gmail.com>> wrote:
>
>     Hi Sean.
>
>     Got out of bed sometime back. Saw this post now. Awesome!!!
>
>     As I mentioned, I had to get the solution previous night at
>     earliest. So did what I did, then.
>
>     Now I have flexibility to study the modular structure.
>
>     Browsing through your code and screenshot now.
>
>     Which category of project did you use to create the project?
>     "Netbeans Module"? "Java with Maven"? "Java with Ant"?
>
>     I used "Java with Ant" and "Java Application".
>     I haven't come across "module-info.java" hence I suspect that the
>     project isn't a "Java with Ant" category project.
>
>     I suspect that for each category, default code generated by
>     Netbeans is different, hence I wasn't aware of "module-info.java".
>
>     I could comprehend, your information. Now, I need to know which
>     category of project was created? The directory structure isn't
>     "Java with Ant" category.
>
>     Is "module-info.java" generated by Netbeans or you created it?
>     Seems like the "category of project" matters.
>
>     Which category of project was created?
>
>
>
>     Warm wishes
>
>
>
>
>
>     On Tue, Feb 14, 2023 at 4:06 AM Sean Carrick <sean@pekinsoft.com
>     <ma...@pekinsoft.com>> wrote:
>
>         Amitabh,
>
>         NO! What you just said is /_*NOT*_/ how you do it! Look at
>         this screenshot:
>
>         Proper way to get Java SQL API into a modular project.
>
>         The code window on the right shows a class that is able to
>         import and access the Java SQL API. Notice the Libraries nodes
>         in the Project window toward the upper-left: the only thing
>         imported is the JDK and the current module.../*nothing else*/.
>
>         To accomplish this, all I did was to fill out the
>         module-info.java file for the "another.mod" module:
>
>         module-info.java contents for another.mod module.
>
>         As you can see, even though I have /no third-party/ SQL
>         library in the Libraries node, I am requiring the use of
>         java.sql in my module. This is because the Java SQL API is
>         located in the module /java.sql/ within the JDK. So, to use it
>         in my project, I have to /require/ it, as I have done in the
>         image above.
>
>         Now, once I have my DatabaseAccess class written, if I want to
>         use it my module named "base.mod", I would need to place the
>         following statement into the /base.mod:module-info.java/ file:
>
>         module base.module {
>              requires java.sql;	// To be able to import SQLException class.
>              requires another.mod;	// To import the exported class from my other module.
>         }
>
>         This is how modular development using Project Jigsaw works.
>         You /*must*/ create /explicit/ contracts between the modules.
>         Furthermore, if "base.mod" requires "another.mod" for the
>         DatabaseAccess class, then "another.mod" /*cannot*/ require
>         "base.mod" because that would be a cyclic dependency and the
>         compiler would not be able to determine which module to
>         compile first.
>
>         So, to properly develop a modular application in Java, you
>         need to think through all of your requirements very carefully.
>         You will want to create a module that is an API for your
>         application, which can be required by any or all other modules
>         in your application, but which itself has no requirements on
>         any of the other modules. When you create this API module, it
>         would be best if it only contained interfaces and abstract
>         classes that must be implemented elsewhere. Then, you create
>         implementations in the other modules and can use the Java
>         class java.util.ServiceLoader to load the implementations
>         where you need them, without needing to require the modules in
>         which the implementations are defined. For example, if my
>         example created an API module, it could look like this:
>
>         Modular application with an API module.
>
>         In this screenshot, you can see both the API module-info.java
>         file and the interface that module contains (the two windows
>         on top to the right). Also, you can see the module-info.java
>         file and the implementation of the interface for "another.mod"
>         module (lower two windows to the right). Let's talk about the
>         api.mod:module-info.java file:
>
>         Notice that /module api.mod/ requires "java.sql", but uses the
>         "transitive" keyword. This allows for any module that requires
>         the module "api.mod" to also get a reference to the "java.sql"
>         module without needing to declare so explicitly. We'll get to
>         that in a minute. Notice the interface named "Database" on the
>         upper-right...It is able to import both java.sql.ResultSet and
>         java.sql.SQLException. This is due to the statement in the
>         module-info.java file "requires java.sql". /*This*/ is how you
>         are able to use the Java SQL API in a modular Java
>         application. Now, let's look at the implementation...
>
>         In the two lower windows to the right, you see the
>         another.mod:module-info.java file (left one) and the
>         implementation of the Database interface (right one). In order
>         to implement the Database interface, another.mod had to place
>         the "requires api.mod" statement in its module-info.java file.
>         Furthermore, notice that DatabaseAccess class imports classes
>         from the java.sql package, but /does not/ have a "requires
>         java.sql" statement in its module-info.java file. This is
>         because of the api.mod:module-info.java requiring java.sql as
>         /transitive/. The /transitive/ keyword means that
>         another.module gets access to the java.sql module /implicitly/
>         due to it dependency on api.module.
>
>         Now, let's have our base module use the implementation of the
>         Database interface, /without having a dependency on the
>         another.mod module/...
>
>         To implement the project API, we will create a main class in
>         the base.mod module, place a "requires api.mod" statement in
>         its module-info.java file, and then use the ServiceLoader to
>         get the implementation defined in another.mod:
>
>         Implementing the API
>
>         The top window on the right is the module-info.java file for
>         another.mod. It declares that it /provides/ an implementation
>         of the Database interface /with/ the DatabaseAccess class.
>
>         In the middle window on the right, you can see that the
>         base.mod module /only/ requires the api.mod module, so that it
>         has access to the Database interface. Then, in the constructor
>         of the MainClass, you see the use of the
>         /java.util.ServiceLoader/ class to get to the implementation
>         of the Database interface that is defined by the module
>         another.mod.
>
>         With these screenshots and explanations, hopefully it makes
>         more sense to you why you are not seeing the java.sql in your
>         Libraries node in NetBeans. I've expanded the Libraries node
>         in each of these screenshots so that you can see no where have
>         I added a library for java.sql, but am able to use that
>         package because of how I /require/ it in my module-info.java
>         files...
>
>         -SC
>
>         On 2/13/23 2:53 PM, Amitabh Choudhury wrote:
>>         Hi Sean
>>
>>         Thanks for all the effort to explain the reasons. Very much
>>         appreciated. Especially this third message.
>>
>>         I had to close the project fast. So your statement of "third
>>         party" gave the hint to pack required classes (java.sql
>>         package) in a "third party" jar and add it to the "Project
>>         Window".
>>         Did basic search on "Project jigsaw" and noted that it would
>>         take very slow reading to grasp that flow.
>>
>>         Fortunately there was "sql.jar" available online that had
>>         packaged the "java.sql" class files in .jar.
>>
>>         Used that to get the project rolling.
>>
>>         This is standalone desktop Ant project.
>>         Couldn't find any "module-info.java" file generated by Netbeans.
>>         So I am yet to figure out what this "module-info.java" file
>>         is and where to place it in project structure.
>>         Then I will be able to add "requires java.sql;" statement in
>>         that file.
>>
>>         Thanks for the guidance. Have to figure out where to find
>>         this 'module-info.java'.
>>
>>         @Ernie - Thanks for the guidance.
>>
>>         @László - Thanks for the guidance.
>>
>>         Screenshots indicate that the "java.sql" is accepted.
>>
>>         Thanks.
>>
>>         Warm wishes
>>
>>
>>         On Tue, Feb 14, 2023 at 1:02 AM Sean Carrick
>>         <sean@pekinsoft.com <ma...@pekinsoft.com>> wrote:
>>
>>             Amitabh,
>>
>>             Just to clarify, since I missed stating this in my last
>>             two messages regarding your issue...
>>
>>             When developing a /modular/ Java project, the only items
>>             that should be listed in your Libraries node in the
>>             Projects window of NetBeans IDE should be the JDK that
>>             you are currently using and any third-party libraries
>>             that you have added as dependencies to your project.
>>
>>             Within the JDK18 library that is currently in your
>>             Libraries node, the java.sql package is located. In order
>>             for your project to use the SQL API libraries, you must
>>             type a "requires java.sql;" statement in the
>>             module-info.java /in each module that relies upon the SQL
>>             API/. Until such time that you place those requires
>>             statements in each module needing it, none of your
>>             modules will be able to access the SQL API.
>>
>>             One further note: This is /not/ a NetBeans, nor a
>>             NetBeans configuration, issue. This is completely due to
>>             the way the JDK has been organized since JDK9, when the
>>             JDK was modularized under Project Jigsaw. Google the
>>             phrase "Project Jigsaw" and do some reading so that you
>>             can better understand how the JDK is organized. By doing
>>             this, it will help you to better understand how to use
>>             the JDK more effectively.
>>
>>             -SC
>>
>>             On 2/13/23 1:21 PM, Sean Carrick wrote:
>>>
>>>             One more time...
>>>
>>>             You _/*must add the dependency in your module.info
>>>             <http://module.info> file*/_. The only module of the JDK
>>>             that is included by default in any modular Java project
>>>             is the java.base module. /All other needed modules *must
>>>             be* manually included in your module-info.java file.
>>>             /For example:
>>>
>>>             module my.module {
>>>                  requires java.sql;    // java.base is IMPLICITLY required
>>>                  requires java.desktop; // For developing Java/Swing GUI applications
>>>                  
>>>                  // Add your exports, uses, and provides statements below.
>>>             }
>>>
>>>             To see which modules are included with the java.base
>>>             module, see
>>>             https://docs.oracle.com/en/java/javase/11/docs/api/java.base/module-summary.html
>>>             <https://docs.oracle.com/en/java/javase/11/docs/api/java.base/module-summary.html>.
>>>             If the module (such as java.sql) is not listed on this
>>>             page, then it is /not /part of java.base. You could save
>>>             a lot of "requires" statements in your module-info.java
>>>             file by including a grouping such as java.se
>>>             <http://java.se>. This will give you access to
>>>             java.desktop packages, java.sql packages, as well as
>>>             many others that are typically needed for J2SE
>>>             application development.
>>>
>>>             You ought to bookmark this link:
>>>             https://docs.oracle.com/en/java/javase/14/docs/api/
>>>             <https://docs.oracle.com/en/java/javase/14/docs/api/>
>>>
>>>             That link is to the Java API JavaDoc pages for JDK 14.
>>>             If you need a different version of the JDK, change the
>>>             14 in the link above to the version you are interested in.
>>>
>>>             -SC
>>>
>>>             On 2/13/23 12:57 PM, Amitabh Choudhury wrote:
>>>>             This is the bunch of screenshots.
>>>>
>>>>             On Tue, Feb 14, 2023 at 12:15 AM Amitabh Choudhury
>>>>             <amitabhisgood@gmail.com
>>>>             <ma...@gmail.com>> wrote:
>>>>
>>>>                 Hi Ernie (and others)
>>>>
>>>>                 Have used all default configurations. There is
>>>>                 java.sql module. That is being displayed in "Java
>>>>                 Platform Manager" but not getting displayed in
>>>>                 "Libraries" of the Ant application. Screenshots are
>>>>                 attached.
>>>>                 All settings are defaults.
>>>>
>>>>                 So, the action required is to include the java.sql
>>>>                 module in the Libraries of the application. Even
>>>>                 though it is in Java Platform Manager, its missing
>>>>                 in the default libraries.
>>>>
>>>>                 Please guide.
>>>>
>>>>                 Warm wishes
>>>>
>>>>
>>>>
>>>>                 On Mon, Feb 13, 2023 at 11:42 PM Ernie Rael
>>>>                 <errael@raelity.com <ma...@raelity.com>> wrote:
>>>>
>>>>                     The sql stuff is not in the "java.base" module;
>>>>                     there are separate
>>>>                     modules for the sql stuff. I don't use modules,
>>>>                     but I'm guessing the
>>>>                     problem is how your app (not NetBeans) is
>>>>                     configured.
>>>>
>>>>                     -ernie
>>>>
>>>>                     On 23/02/13 9:45 AM, Amitabh Choudhury wrote:
>>>>                     > Hello
>>>>                     >
>>>>                     > This is in continuation of my previous mail
>>>>                     related to Netbeans 14.
>>>>                     >
>>>>                     > Got aware that Netbeans 14 isn't supported,
>>>>                     so downloaded Netbeans 16
>>>>                     > and configured with Java 18.
>>>>                     >
>>>>                     > Created Ant project and checked java.base.
>>>>                     > java.sql is missing in this as well.
>>>>                     >
>>>>                     > Please guide to configure Netbeans 16 to
>>>>                     include java.sql in java.base
>>>>                     > module of Default Library.
>>>>                     > Images attached ...
>>>>                     >
>>>>                     > Warm wishes
>>>>                     >
>>>>                     > ~~~
>>>>                     > Amitabh Choudhury
>>>>                     >
>>>>                     >
>>>>                     ---------------------------------------------------------------------
>>>>                     > To unsubscribe, e-mail:
>>>>                     users-unsubscribe@netbeans.apache.org
>>>>                     <ma...@netbeans.apache.org>
>>>>                     > For additional commands, e-mail:
>>>>                     users-help@netbeans.apache.org
>>>>                     <ma...@netbeans.apache.org>
>>>>                     >
>>>>                     > For further information about the NetBeans
>>>>                     mailing lists, visit:
>>>>                     >
>>>>                     https://cwiki.apache.org/confluence/display/NETBEANS/Mailing+lists
>>>>                     <https://cwiki.apache.org/confluence/display/NETBEANS/Mailing+lists>
>>>>
>>>>
>>>>
>>>>                     ---------------------------------------------------------------------
>>>>                     To unsubscribe, e-mail:
>>>>                     users-unsubscribe@netbeans.apache.org
>>>>                     <ma...@netbeans.apache.org>
>>>>                     For additional commands, e-mail:
>>>>                     users-help@netbeans.apache.org
>>>>                     <ma...@netbeans.apache.org>
>>>>
>>>>                     For further information about the NetBeans
>>>>                     mailing lists, visit:
>>>>                     https://cwiki.apache.org/confluence/display/NETBEANS/Mailing+lists
>>>>                     <https://cwiki.apache.org/confluence/display/NETBEANS/Mailing+lists>
>>>>
>>>>
>>>>             ---------------------------------------------------------------------
>>>>             To unsubscribe, e-mail:users-unsubscribe@netbeans.apache.org  <ma...@netbeans.apache.org>
>>>>             For additional commands, e-mail:users-help@netbeans.apache.org  <ma...@netbeans.apache.org>
>>>>
>>>>             For further information about the NetBeans mailing lists, visit:
>>>>             https://cwiki.apache.org/confluence/display/NETBEANS/Mailing+lists  <https://cwiki.apache.org/confluence/display/NETBEANS/Mailing+lists>
>>
>>
>>         ---------------------------------------------------------------------
>>         To unsubscribe, e-mail:users-unsubscribe@netbeans.apache.org  <ma...@netbeans.apache.org>
>>         For additional commands, e-mail:users-help@netbeans.apache.org  <ma...@netbeans.apache.org>
>>
>>         For further information about the NetBeans mailing lists, visit:
>>         https://cwiki.apache.org/confluence/display/NETBEANS/Mailing+lists  <https://cwiki.apache.org/confluence/display/NETBEANS/Mailing+lists>
>

Re: java.sql missing from java.base in Netbeans 16 JDK 18 defaults

Posted by Amitabh Choudhury <am...@gmail.com>.
Attached screenshot show what I get as  developer of  "Java with Ant" and
"Java Application" project.

In this case what alternative do I have to include "java.sql", other than
including a third party Jar file?


On Tue, Feb 14, 2023 at 8:30 AM Amitabh Choudhury <am...@gmail.com>
wrote:

> If not, what would be the alternative for a developer of  "Java with Ant"
> and "Java Application" project?
>
> On Tue, Feb 14, 2023 at 8:28 AM Amitabh Choudhury <am...@gmail.com>
> wrote:
>
>> This is what I mean by "category of project".
>>
>> I was working with "Java with Ant" and "Java Application" project. Hence
>> "module-info.java" didn't show up.
>>
>> How would you include "module-info.java" in "Java with Ant" and "Java
>> Application" project?
>>
>> I am trying to replicate the project structure you showed. If the
>> inclusion of "module-info.java" with "Module" as the data-structure,
>> permitted in "Java with Ant" and "Java Application" projects?
>>
>>
>> On Tue, Feb 14, 2023 at 8:21 AM Amitabh Choudhury <
>> amitabhisgood@gmail.com> wrote:
>>
>>> Hi Sean.
>>>
>>> Got out of bed sometime back. Saw this post now. Awesome!!!
>>>
>>> As I mentioned, I had to get the solution previous night at earliest. So
>>> did what I did, then.
>>>
>>> Now I have flexibility to study the modular structure.
>>>
>>> Browsing through your code and screenshot now.
>>>
>>> Which category of project did you use to create the project? "Netbeans
>>> Module"? "Java with Maven"? "Java with Ant"?
>>>
>>> I used "Java with Ant" and "Java Application".
>>> I haven't come across "module-info.java" hence I suspect that the
>>> project isn't a "Java with Ant" category project.
>>>
>>> I suspect that for each category, default code generated by Netbeans is
>>> different, hence I wasn't aware of "module-info.java".
>>>
>>> I could comprehend, your information. Now, I need to know which category
>>> of project was created? The directory structure isn't "Java with Ant"
>>> category.
>>>
>>> Is "module-info.java" generated by Netbeans or you created it?
>>> Seems like the "category of project" matters.
>>>
>>> Which category of project was created?
>>>
>>>
>>>
>>> Warm wishes
>>>
>>>
>>>
>>>
>>>
>>> On Tue, Feb 14, 2023 at 4:06 AM Sean Carrick <se...@pekinsoft.com> wrote:
>>>
>>>> Amitabh,
>>>>
>>>> NO! What you just said is *NOT* how you do it! Look at this screenshot:
>>>>
>>>> [image: Proper way to get Java SQL API into a modular project.]
>>>>
>>>> The code window on the right shows a class that is able to import and
>>>> access the Java SQL API. Notice the Libraries nodes in the Project window
>>>> toward the upper-left: the only thing imported is the JDK and the current
>>>> module...*nothing else*.
>>>>
>>>> To accomplish this, all I did was to fill out the module-info.java file
>>>> for the "another.mod" module:
>>>>
>>>> [image: module-info.java contents for another.mod module.]
>>>>
>>>> As you can see, even though I have *no third-party* SQL library in the
>>>> Libraries node, I am requiring the use of java.sql in my module. This is
>>>> because the Java SQL API is located in the module *java.sql* within
>>>> the JDK. So, to use it in my project, I have to *require* it, as I
>>>> have done in the image above.
>>>>
>>>> Now, once I have my DatabaseAccess class written, if I want to use it
>>>> my module named "base.mod", I would need to place the following statement
>>>> into the *base.mod:module-info.java* file:
>>>>
>>>> module base.module {
>>>>     requires java.sql;	// To be able to import SQLException class.
>>>>     requires another.mod;	// To import the exported class from my other module.
>>>> }
>>>>
>>>> This is how modular development using Project Jigsaw works. You *must*
>>>> create *explicit* contracts between the modules. Furthermore, if
>>>> "base.mod" requires "another.mod" for the DatabaseAccess class, then
>>>> "another.mod" *cannot* require "base.mod" because that would be a
>>>> cyclic dependency and the compiler would not be able to determine which
>>>> module to compile first.
>>>>
>>>> So, to properly develop a modular application in Java, you need to
>>>> think through all of your requirements very carefully. You will want to
>>>> create a module that is an API for your application, which can be required
>>>> by any or all other modules in your application, but which itself has no
>>>> requirements on any of the other modules. When you create this API module,
>>>> it would be best if it only contained interfaces and abstract classes that
>>>> must be implemented elsewhere. Then, you create implementations in the
>>>> other modules and can use the Java class java.util.ServiceLoader to load
>>>> the implementations where you need them, without needing to require the
>>>> modules in which the implementations are defined. For example, if my
>>>> example created an API module, it could look like this:
>>>>
>>>> [image: Modular application with an API module.]
>>>>
>>>> In this screenshot, you can see both the API module-info.java file and
>>>> the interface that module contains (the two windows on top to the right).
>>>> Also, you can see the module-info.java file and the implementation of the
>>>> interface for "another.mod" module (lower two windows to the right). Let's
>>>> talk about the api.mod:module-info.java file:
>>>>
>>>> Notice that *module api.mod* requires "java.sql", but uses the
>>>> "transitive" keyword. This allows for any module that requires the module
>>>> "api.mod" to also get a reference to the "java.sql" module without needing
>>>> to declare so explicitly. We'll get to that in a minute. Notice the
>>>> interface named "Database" on the upper-right...It is able to import both
>>>> java.sql.ResultSet and java.sql.SQLException. This is due to the statement
>>>> in the module-info.java file "requires java.sql". *This* is how you
>>>> are able to use the Java SQL API in a modular Java application. Now, let's
>>>> look at the implementation...
>>>>
>>>> In the two lower windows to the right, you see the
>>>> another.mod:module-info.java file (left one) and the implementation of the
>>>> Database interface (right one). In order to implement the Database
>>>> interface, another.mod had to place the "requires api.mod" statement in its
>>>> module-info.java file. Furthermore, notice that DatabaseAccess class
>>>> imports classes from the java.sql package, but *does not* have a
>>>> "requires java.sql" statement in its module-info.java file. This is because
>>>> of the api.mod:module-info.java requiring java.sql as *transitive*.
>>>> The *transitive* keyword means that another.module gets access to the
>>>> java.sql module *implicitly* due to it dependency on api.module.
>>>>
>>>> Now, let's have our base module use the implementation of the Database
>>>> interface, *without having a dependency on the another.mod module*...
>>>>
>>>> To implement the project API, we will create a main class in the
>>>> base.mod module, place a "requires api.mod" statement in its
>>>> module-info.java file, and then use the ServiceLoader to get the
>>>> implementation defined in another.mod:
>>>>
>>>> [image: Implementing the API]
>>>>
>>>> The top window on the right is the module-info.java file for
>>>> another.mod. It declares that it *provides* an implementation of the
>>>> Database interface *with* the DatabaseAccess class.
>>>>
>>>> In the middle window on the right, you can see that the base.mod module
>>>> *only* requires the api.mod module, so that it has access to the
>>>> Database interface. Then, in the constructor of the MainClass, you see the
>>>> use of the *java.util.ServiceLoader* class to get to the
>>>> implementation of the Database interface that is defined by the module
>>>> another.mod.
>>>>
>>>> With these screenshots and explanations, hopefully it makes more sense
>>>> to you why you are not seeing the java.sql in your Libraries node in
>>>> NetBeans. I've expanded the Libraries node in each of these screenshots so
>>>> that you can see no where have I added a library for java.sql, but am able
>>>> to use that package because of how I *require* it in my
>>>> module-info.java files...
>>>>
>>>> -SC
>>>> On 2/13/23 2:53 PM, Amitabh Choudhury wrote:
>>>>
>>>> Hi Sean
>>>>
>>>> Thanks for all the effort to explain the reasons. Very much
>>>> appreciated. Especially this third message.
>>>>
>>>> I had to close the project fast. So your statement of "third party"
>>>> gave the hint to pack required classes (java.sql package) in a "third
>>>> party" jar and add it to the "Project Window".
>>>> Did basic search on "Project jigsaw" and noted that it would take very
>>>> slow reading to grasp that flow.
>>>>
>>>> Fortunately there was "sql.jar" available online that had packaged the
>>>> "java.sql" class files in .jar.
>>>>
>>>> Used that to get the project rolling.
>>>>
>>>> This is standalone desktop Ant project.
>>>> Couldn't find any "module-info.java" file generated by Netbeans.
>>>> So I am yet to figure out what this "module-info.java" file is and
>>>> where to place it in project structure.
>>>> Then I will be able to add "requires java.sql;" statement in that file.
>>>>
>>>> Thanks for the guidance. Have to figure out where to find this
>>>> 'module-info.java'.
>>>>
>>>> @Ernie - Thanks for the guidance.
>>>>
>>>> @László - Thanks for the guidance.
>>>>
>>>> Screenshots indicate that the "java.sql" is accepted.
>>>>
>>>> Thanks.
>>>>
>>>> Warm wishes
>>>>
>>>>
>>>> On Tue, Feb 14, 2023 at 1:02 AM Sean Carrick <se...@pekinsoft.com>
>>>> wrote:
>>>>
>>>>> Amitabh,
>>>>>
>>>>> Just to clarify, since I missed stating this in my last two messages
>>>>> regarding your issue...
>>>>>
>>>>> When developing a *modular* Java project, the only items that should
>>>>> be listed in your Libraries node in the Projects window of NetBeans IDE
>>>>> should be the JDK that you are currently using and any third-party
>>>>> libraries that you have added as dependencies to your project.
>>>>>
>>>>> Within the JDK18 library that is currently in your Libraries node, the
>>>>> java.sql package is located. In order for your project to use the SQL API
>>>>> libraries, you must type a "requires java.sql;" statement in the
>>>>> module-info.java *in each module that relies upon the SQL API*. Until
>>>>> such time that you place those requires statements in each module needing
>>>>> it, none of your modules will be able to access the SQL API.
>>>>>
>>>>> One further note: This is *not* a NetBeans, nor a NetBeans
>>>>> configuration, issue. This is completely due to the way the JDK has been
>>>>> organized since JDK9, when the JDK was modularized under Project Jigsaw.
>>>>> Google the phrase "Project Jigsaw" and do some reading so that you can
>>>>> better understand how the JDK is organized. By doing this, it will help you
>>>>> to better understand how to use the JDK more effectively.
>>>>>
>>>>> -SC
>>>>> On 2/13/23 1:21 PM, Sean Carrick wrote:
>>>>>
>>>>> One more time...
>>>>>
>>>>> You *must add the dependency in your module.info <http://module.info>
>>>>> file*. The only module of the JDK that is included by default in any
>>>>> modular Java project is the java.base module. *All other needed
>>>>> modules must be manually included in your module-info.java file. *For
>>>>> example:
>>>>>
>>>>> module my.module {
>>>>>     requires java.sql;    // java.base is IMPLICITLY required
>>>>>     requires java.desktop; // For developing Java/Swing GUI applications
>>>>>
>>>>>     // Add your exports, uses, and provides statements below.
>>>>> }
>>>>>
>>>>> To see which modules are included with the java.base module, see
>>>>> https://docs.oracle.com/en/java/javase/11/docs/api/java.base/module-summary.html.
>>>>> If the module (such as java.sql) is not listed on this page, then it is *not
>>>>> *part of java.base. You could save a lot of "requires" statements in
>>>>> your module-info.java file by including a grouping such as java.se.
>>>>> This will give you access to java.desktop packages, java.sql packages, as
>>>>> well as many others that are typically needed for J2SE application
>>>>> development.
>>>>>
>>>>> You ought to bookmark this link:
>>>>> https://docs.oracle.com/en/java/javase/14/docs/api/
>>>>>
>>>>> That link is to the Java API JavaDoc pages for JDK 14. If you need a
>>>>> different version of the JDK, change the 14 in the link above to the
>>>>> version you are interested in.
>>>>>
>>>>> -SC
>>>>> On 2/13/23 12:57 PM, Amitabh Choudhury wrote:
>>>>>
>>>>> This is the bunch of  screenshots.
>>>>>
>>>>> On Tue, Feb 14, 2023 at 12:15 AM Amitabh Choudhury <
>>>>> amitabhisgood@gmail.com> wrote:
>>>>>
>>>>>> Hi Ernie (and others)
>>>>>>
>>>>>> Have used all default configurations. There is java.sql module. That
>>>>>> is being displayed in "Java Platform Manager" but not getting displayed in
>>>>>> "Libraries" of the Ant application. Screenshots are attached.
>>>>>> All settings are defaults.
>>>>>>
>>>>>> So, the action required is to include the java.sql module in the
>>>>>> Libraries of the application. Even though it is in Java Platform Manager,
>>>>>> its missing in the default libraries.
>>>>>>
>>>>>> Please guide.
>>>>>>
>>>>>> Warm wishes
>>>>>>
>>>>>>
>>>>>>
>>>>>> On Mon, Feb 13, 2023 at 11:42 PM Ernie Rael <er...@raelity.com>
>>>>>> wrote:
>>>>>>
>>>>>>> The sql stuff is not in the "java.base" module; there are separate
>>>>>>> modules for the sql stuff. I don't use modules, but I'm guessing the
>>>>>>> problem is how your app (not NetBeans) is configured.
>>>>>>>
>>>>>>> -ernie
>>>>>>>
>>>>>>> On 23/02/13 9:45 AM, Amitabh Choudhury wrote:
>>>>>>> > Hello
>>>>>>> >
>>>>>>> > This is in continuation of my previous mail related to Netbeans 14.
>>>>>>> >
>>>>>>> > Got aware that Netbeans 14 isn't supported, so downloaded Netbeans
>>>>>>> 16
>>>>>>> > and configured with Java 18.
>>>>>>> >
>>>>>>> > Created Ant project and checked java.base.
>>>>>>> > java.sql is missing in this as well.
>>>>>>> >
>>>>>>> > Please guide to configure Netbeans 16 to include java.sql in
>>>>>>> java.base
>>>>>>> > module of Default Library.
>>>>>>> > Images attached ...
>>>>>>> >
>>>>>>> > Warm wishes
>>>>>>> >
>>>>>>> > ~~~
>>>>>>> > Amitabh Choudhury
>>>>>>> >
>>>>>>> >
>>>>>>> ---------------------------------------------------------------------
>>>>>>> > To unsubscribe, e-mail: users-unsubscribe@netbeans.apache.org
>>>>>>> > For additional commands, e-mail: users-help@netbeans.apache.org
>>>>>>> >
>>>>>>> > For further information about the NetBeans mailing lists, visit:
>>>>>>> > https://cwiki.apache.org/confluence/display/NETBEANS/Mailing+lists
>>>>>>>
>>>>>>>
>>>>>>>
>>>>>>> ---------------------------------------------------------------------
>>>>>>> To unsubscribe, e-mail: users-unsubscribe@netbeans.apache.org
>>>>>>> For additional commands, e-mail: users-help@netbeans.apache.org
>>>>>>>
>>>>>>> For further information about the NetBeans mailing lists, visit:
>>>>>>> https://cwiki.apache.org/confluence/display/NETBEANS/Mailing+lists
>>>>>>>
>>>>>>>
>>>>> ---------------------------------------------------------------------
>>>>> To unsubscribe, e-mail: users-unsubscribe@netbeans.apache.org
>>>>> For additional commands, e-mail: users-help@netbeans.apache.org
>>>>>
>>>>> For further information about the NetBeans mailing lists, visit:https://cwiki.apache.org/confluence/display/NETBEANS/Mailing+lists
>>>>>
>>>>>
>>>> ---------------------------------------------------------------------
>>>> To unsubscribe, e-mail: users-unsubscribe@netbeans.apache.org
>>>> For additional commands, e-mail: users-help@netbeans.apache.org
>>>>
>>>> For further information about the NetBeans mailing lists, visit:https://cwiki.apache.org/confluence/display/NETBEANS/Mailing+lists
>>>>
>>>>

Re: java.sql missing from java.base in Netbeans 16 JDK 18 defaults

Posted by Amitabh Choudhury <am...@gmail.com>.
If not, what would be the alternative for a developer of  "Java with Ant"
and "Java Application" project?

On Tue, Feb 14, 2023 at 8:28 AM Amitabh Choudhury <am...@gmail.com>
wrote:

> This is what I mean by "category of project".
>
> I was working with "Java with Ant" and "Java Application" project. Hence
> "module-info.java" didn't show up.
>
> How would you include "module-info.java" in "Java with Ant" and "Java
> Application" project?
>
> I am trying to replicate the project structure you showed. If the
> inclusion of "module-info.java" with "Module" as the data-structure,
> permitted in "Java with Ant" and "Java Application" projects?
>
>
> On Tue, Feb 14, 2023 at 8:21 AM Amitabh Choudhury <am...@gmail.com>
> wrote:
>
>> Hi Sean.
>>
>> Got out of bed sometime back. Saw this post now. Awesome!!!
>>
>> As I mentioned, I had to get the solution previous night at earliest. So
>> did what I did, then.
>>
>> Now I have flexibility to study the modular structure.
>>
>> Browsing through your code and screenshot now.
>>
>> Which category of project did you use to create the project? "Netbeans
>> Module"? "Java with Maven"? "Java with Ant"?
>>
>> I used "Java with Ant" and "Java Application".
>> I haven't come across "module-info.java" hence I suspect that the project
>> isn't a "Java with Ant" category project.
>>
>> I suspect that for each category, default code generated by Netbeans is
>> different, hence I wasn't aware of "module-info.java".
>>
>> I could comprehend, your information. Now, I need to know which category
>> of project was created? The directory structure isn't "Java with Ant"
>> category.
>>
>> Is "module-info.java" generated by Netbeans or you created it?
>> Seems like the "category of project" matters.
>>
>> Which category of project was created?
>>
>>
>>
>> Warm wishes
>>
>>
>>
>>
>>
>> On Tue, Feb 14, 2023 at 4:06 AM Sean Carrick <se...@pekinsoft.com> wrote:
>>
>>> Amitabh,
>>>
>>> NO! What you just said is *NOT* how you do it! Look at this screenshot:
>>>
>>> [image: Proper way to get Java SQL API into a modular project.]
>>>
>>> The code window on the right shows a class that is able to import and
>>> access the Java SQL API. Notice the Libraries nodes in the Project window
>>> toward the upper-left: the only thing imported is the JDK and the current
>>> module...*nothing else*.
>>>
>>> To accomplish this, all I did was to fill out the module-info.java file
>>> for the "another.mod" module:
>>>
>>> [image: module-info.java contents for another.mod module.]
>>>
>>> As you can see, even though I have *no third-party* SQL library in the
>>> Libraries node, I am requiring the use of java.sql in my module. This is
>>> because the Java SQL API is located in the module *java.sql* within the
>>> JDK. So, to use it in my project, I have to *require* it, as I have
>>> done in the image above.
>>>
>>> Now, once I have my DatabaseAccess class written, if I want to use it my
>>> module named "base.mod", I would need to place the following statement into
>>> the *base.mod:module-info.java* file:
>>>
>>> module base.module {
>>>     requires java.sql;	// To be able to import SQLException class.
>>>     requires another.mod;	// To import the exported class from my other module.
>>> }
>>>
>>> This is how modular development using Project Jigsaw works. You *must*
>>> create *explicit* contracts between the modules. Furthermore, if
>>> "base.mod" requires "another.mod" for the DatabaseAccess class, then
>>> "another.mod" *cannot* require "base.mod" because that would be a
>>> cyclic dependency and the compiler would not be able to determine which
>>> module to compile first.
>>>
>>> So, to properly develop a modular application in Java, you need to think
>>> through all of your requirements very carefully. You will want to create a
>>> module that is an API for your application, which can be required by any or
>>> all other modules in your application, but which itself has no requirements
>>> on any of the other modules. When you create this API module, it would be
>>> best if it only contained interfaces and abstract classes that must be
>>> implemented elsewhere. Then, you create implementations in the other
>>> modules and can use the Java class java.util.ServiceLoader to load the
>>> implementations where you need them, without needing to require the modules
>>> in which the implementations are defined. For example, if my example
>>> created an API module, it could look like this:
>>>
>>> [image: Modular application with an API module.]
>>>
>>> In this screenshot, you can see both the API module-info.java file and
>>> the interface that module contains (the two windows on top to the right).
>>> Also, you can see the module-info.java file and the implementation of the
>>> interface for "another.mod" module (lower two windows to the right). Let's
>>> talk about the api.mod:module-info.java file:
>>>
>>> Notice that *module api.mod* requires "java.sql", but uses the
>>> "transitive" keyword. This allows for any module that requires the module
>>> "api.mod" to also get a reference to the "java.sql" module without needing
>>> to declare so explicitly. We'll get to that in a minute. Notice the
>>> interface named "Database" on the upper-right...It is able to import both
>>> java.sql.ResultSet and java.sql.SQLException. This is due to the statement
>>> in the module-info.java file "requires java.sql". *This* is how you are
>>> able to use the Java SQL API in a modular Java application. Now, let's look
>>> at the implementation...
>>>
>>> In the two lower windows to the right, you see the
>>> another.mod:module-info.java file (left one) and the implementation of the
>>> Database interface (right one). In order to implement the Database
>>> interface, another.mod had to place the "requires api.mod" statement in its
>>> module-info.java file. Furthermore, notice that DatabaseAccess class
>>> imports classes from the java.sql package, but *does not* have a
>>> "requires java.sql" statement in its module-info.java file. This is because
>>> of the api.mod:module-info.java requiring java.sql as *transitive*. The
>>> *transitive* keyword means that another.module gets access to the
>>> java.sql module *implicitly* due to it dependency on api.module.
>>>
>>> Now, let's have our base module use the implementation of the Database
>>> interface, *without having a dependency on the another.mod module*...
>>>
>>> To implement the project API, we will create a main class in the
>>> base.mod module, place a "requires api.mod" statement in its
>>> module-info.java file, and then use the ServiceLoader to get the
>>> implementation defined in another.mod:
>>>
>>> [image: Implementing the API]
>>>
>>> The top window on the right is the module-info.java file for
>>> another.mod. It declares that it *provides* an implementation of the
>>> Database interface *with* the DatabaseAccess class.
>>>
>>> In the middle window on the right, you can see that the base.mod module
>>> *only* requires the api.mod module, so that it has access to the
>>> Database interface. Then, in the constructor of the MainClass, you see the
>>> use of the *java.util.ServiceLoader* class to get to the implementation
>>> of the Database interface that is defined by the module another.mod.
>>>
>>> With these screenshots and explanations, hopefully it makes more sense
>>> to you why you are not seeing the java.sql in your Libraries node in
>>> NetBeans. I've expanded the Libraries node in each of these screenshots so
>>> that you can see no where have I added a library for java.sql, but am able
>>> to use that package because of how I *require* it in my
>>> module-info.java files...
>>>
>>> -SC
>>> On 2/13/23 2:53 PM, Amitabh Choudhury wrote:
>>>
>>> Hi Sean
>>>
>>> Thanks for all the effort to explain the reasons. Very much appreciated.
>>> Especially this third message.
>>>
>>> I had to close the project fast. So your statement of "third party" gave
>>> the hint to pack required classes (java.sql package) in a "third party" jar
>>> and add it to the "Project Window".
>>> Did basic search on "Project jigsaw" and noted that it would take very
>>> slow reading to grasp that flow.
>>>
>>> Fortunately there was "sql.jar" available online that had packaged the
>>> "java.sql" class files in .jar.
>>>
>>> Used that to get the project rolling.
>>>
>>> This is standalone desktop Ant project.
>>> Couldn't find any "module-info.java" file generated by Netbeans.
>>> So I am yet to figure out what this "module-info.java" file is and where
>>> to place it in project structure.
>>> Then I will be able to add "requires java.sql;" statement in that file.
>>>
>>> Thanks for the guidance. Have to figure out where to find this
>>> 'module-info.java'.
>>>
>>> @Ernie - Thanks for the guidance.
>>>
>>> @László - Thanks for the guidance.
>>>
>>> Screenshots indicate that the "java.sql" is accepted.
>>>
>>> Thanks.
>>>
>>> Warm wishes
>>>
>>>
>>> On Tue, Feb 14, 2023 at 1:02 AM Sean Carrick <se...@pekinsoft.com> wrote:
>>>
>>>> Amitabh,
>>>>
>>>> Just to clarify, since I missed stating this in my last two messages
>>>> regarding your issue...
>>>>
>>>> When developing a *modular* Java project, the only items that should
>>>> be listed in your Libraries node in the Projects window of NetBeans IDE
>>>> should be the JDK that you are currently using and any third-party
>>>> libraries that you have added as dependencies to your project.
>>>>
>>>> Within the JDK18 library that is currently in your Libraries node, the
>>>> java.sql package is located. In order for your project to use the SQL API
>>>> libraries, you must type a "requires java.sql;" statement in the
>>>> module-info.java *in each module that relies upon the SQL API*. Until
>>>> such time that you place those requires statements in each module needing
>>>> it, none of your modules will be able to access the SQL API.
>>>>
>>>> One further note: This is *not* a NetBeans, nor a NetBeans
>>>> configuration, issue. This is completely due to the way the JDK has been
>>>> organized since JDK9, when the JDK was modularized under Project Jigsaw.
>>>> Google the phrase "Project Jigsaw" and do some reading so that you can
>>>> better understand how the JDK is organized. By doing this, it will help you
>>>> to better understand how to use the JDK more effectively.
>>>>
>>>> -SC
>>>> On 2/13/23 1:21 PM, Sean Carrick wrote:
>>>>
>>>> One more time...
>>>>
>>>> You *must add the dependency in your module.info <http://module.info>
>>>> file*. The only module of the JDK that is included by default in any
>>>> modular Java project is the java.base module. *All other needed
>>>> modules must be manually included in your module-info.java file. *For
>>>> example:
>>>>
>>>> module my.module {
>>>>     requires java.sql;    // java.base is IMPLICITLY required
>>>>     requires java.desktop; // For developing Java/Swing GUI applications
>>>>
>>>>     // Add your exports, uses, and provides statements below.
>>>> }
>>>>
>>>> To see which modules are included with the java.base module, see
>>>> https://docs.oracle.com/en/java/javase/11/docs/api/java.base/module-summary.html.
>>>> If the module (such as java.sql) is not listed on this page, then it is *not
>>>> *part of java.base. You could save a lot of "requires" statements in
>>>> your module-info.java file by including a grouping such as java.se.
>>>> This will give you access to java.desktop packages, java.sql packages, as
>>>> well as many others that are typically needed for J2SE application
>>>> development.
>>>>
>>>> You ought to bookmark this link:
>>>> https://docs.oracle.com/en/java/javase/14/docs/api/
>>>>
>>>> That link is to the Java API JavaDoc pages for JDK 14. If you need a
>>>> different version of the JDK, change the 14 in the link above to the
>>>> version you are interested in.
>>>>
>>>> -SC
>>>> On 2/13/23 12:57 PM, Amitabh Choudhury wrote:
>>>>
>>>> This is the bunch of  screenshots.
>>>>
>>>> On Tue, Feb 14, 2023 at 12:15 AM Amitabh Choudhury <
>>>> amitabhisgood@gmail.com> wrote:
>>>>
>>>>> Hi Ernie (and others)
>>>>>
>>>>> Have used all default configurations. There is java.sql module. That
>>>>> is being displayed in "Java Platform Manager" but not getting displayed in
>>>>> "Libraries" of the Ant application. Screenshots are attached.
>>>>> All settings are defaults.
>>>>>
>>>>> So, the action required is to include the java.sql module in the
>>>>> Libraries of the application. Even though it is in Java Platform Manager,
>>>>> its missing in the default libraries.
>>>>>
>>>>> Please guide.
>>>>>
>>>>> Warm wishes
>>>>>
>>>>>
>>>>>
>>>>> On Mon, Feb 13, 2023 at 11:42 PM Ernie Rael <er...@raelity.com>
>>>>> wrote:
>>>>>
>>>>>> The sql stuff is not in the "java.base" module; there are separate
>>>>>> modules for the sql stuff. I don't use modules, but I'm guessing the
>>>>>> problem is how your app (not NetBeans) is configured.
>>>>>>
>>>>>> -ernie
>>>>>>
>>>>>> On 23/02/13 9:45 AM, Amitabh Choudhury wrote:
>>>>>> > Hello
>>>>>> >
>>>>>> > This is in continuation of my previous mail related to Netbeans 14.
>>>>>> >
>>>>>> > Got aware that Netbeans 14 isn't supported, so downloaded Netbeans
>>>>>> 16
>>>>>> > and configured with Java 18.
>>>>>> >
>>>>>> > Created Ant project and checked java.base.
>>>>>> > java.sql is missing in this as well.
>>>>>> >
>>>>>> > Please guide to configure Netbeans 16 to include java.sql in
>>>>>> java.base
>>>>>> > module of Default Library.
>>>>>> > Images attached ...
>>>>>> >
>>>>>> > Warm wishes
>>>>>> >
>>>>>> > ~~~
>>>>>> > Amitabh Choudhury
>>>>>> >
>>>>>> >
>>>>>> ---------------------------------------------------------------------
>>>>>> > To unsubscribe, e-mail: users-unsubscribe@netbeans.apache.org
>>>>>> > For additional commands, e-mail: users-help@netbeans.apache.org
>>>>>> >
>>>>>> > For further information about the NetBeans mailing lists, visit:
>>>>>> > https://cwiki.apache.org/confluence/display/NETBEANS/Mailing+lists
>>>>>>
>>>>>>
>>>>>>
>>>>>> ---------------------------------------------------------------------
>>>>>> To unsubscribe, e-mail: users-unsubscribe@netbeans.apache.org
>>>>>> For additional commands, e-mail: users-help@netbeans.apache.org
>>>>>>
>>>>>> For further information about the NetBeans mailing lists, visit:
>>>>>> https://cwiki.apache.org/confluence/display/NETBEANS/Mailing+lists
>>>>>>
>>>>>>
>>>> ---------------------------------------------------------------------
>>>> To unsubscribe, e-mail: users-unsubscribe@netbeans.apache.org
>>>> For additional commands, e-mail: users-help@netbeans.apache.org
>>>>
>>>> For further information about the NetBeans mailing lists, visit:https://cwiki.apache.org/confluence/display/NETBEANS/Mailing+lists
>>>>
>>>>
>>> ---------------------------------------------------------------------
>>> To unsubscribe, e-mail: users-unsubscribe@netbeans.apache.org
>>> For additional commands, e-mail: users-help@netbeans.apache.org
>>>
>>> For further information about the NetBeans mailing lists, visit:https://cwiki.apache.org/confluence/display/NETBEANS/Mailing+lists
>>>
>>>

Re: java.sql missing from java.base in Netbeans 16 JDK 18 defaults

Posted by Amitabh Choudhury <am...@gmail.com>.
This is what I mean by "category of project".

I was working with "Java with Ant" and "Java Application" project. Hence
"module-info.java" didn't show up.

How would you include "module-info.java" in "Java with Ant" and "Java
Application" project?

I am trying to replicate the project structure you showed. If the inclusion
of "module-info.java" with "Module" as the data-structure, permitted in
"Java with Ant" and "Java Application" projects?


On Tue, Feb 14, 2023 at 8:21 AM Amitabh Choudhury <am...@gmail.com>
wrote:

> Hi Sean.
>
> Got out of bed sometime back. Saw this post now. Awesome!!!
>
> As I mentioned, I had to get the solution previous night at earliest. So
> did what I did, then.
>
> Now I have flexibility to study the modular structure.
>
> Browsing through your code and screenshot now.
>
> Which category of project did you use to create the project? "Netbeans
> Module"? "Java with Maven"? "Java with Ant"?
>
> I used "Java with Ant" and "Java Application".
> I haven't come across "module-info.java" hence I suspect that the project
> isn't a "Java with Ant" category project.
>
> I suspect that for each category, default code generated by Netbeans is
> different, hence I wasn't aware of "module-info.java".
>
> I could comprehend, your information. Now, I need to know which category
> of project was created? The directory structure isn't "Java with Ant"
> category.
>
> Is "module-info.java" generated by Netbeans or you created it?
> Seems like the "category of project" matters.
>
> Which category of project was created?
>
>
>
> Warm wishes
>
>
>
>
>
> On Tue, Feb 14, 2023 at 4:06 AM Sean Carrick <se...@pekinsoft.com> wrote:
>
>> Amitabh,
>>
>> NO! What you just said is *NOT* how you do it! Look at this screenshot:
>>
>> [image: Proper way to get Java SQL API into a modular project.]
>>
>> The code window on the right shows a class that is able to import and
>> access the Java SQL API. Notice the Libraries nodes in the Project window
>> toward the upper-left: the only thing imported is the JDK and the current
>> module...*nothing else*.
>>
>> To accomplish this, all I did was to fill out the module-info.java file
>> for the "another.mod" module:
>>
>> [image: module-info.java contents for another.mod module.]
>>
>> As you can see, even though I have *no third-party* SQL library in the
>> Libraries node, I am requiring the use of java.sql in my module. This is
>> because the Java SQL API is located in the module *java.sql* within the
>> JDK. So, to use it in my project, I have to *require* it, as I have done
>> in the image above.
>>
>> Now, once I have my DatabaseAccess class written, if I want to use it my
>> module named "base.mod", I would need to place the following statement into
>> the *base.mod:module-info.java* file:
>>
>> module base.module {
>>     requires java.sql;	// To be able to import SQLException class.
>>     requires another.mod;	// To import the exported class from my other module.
>> }
>>
>> This is how modular development using Project Jigsaw works. You *must*
>> create *explicit* contracts between the modules. Furthermore, if
>> "base.mod" requires "another.mod" for the DatabaseAccess class, then
>> "another.mod" *cannot* require "base.mod" because that would be a cyclic
>> dependency and the compiler would not be able to determine which module to
>> compile first.
>>
>> So, to properly develop a modular application in Java, you need to think
>> through all of your requirements very carefully. You will want to create a
>> module that is an API for your application, which can be required by any or
>> all other modules in your application, but which itself has no requirements
>> on any of the other modules. When you create this API module, it would be
>> best if it only contained interfaces and abstract classes that must be
>> implemented elsewhere. Then, you create implementations in the other
>> modules and can use the Java class java.util.ServiceLoader to load the
>> implementations where you need them, without needing to require the modules
>> in which the implementations are defined. For example, if my example
>> created an API module, it could look like this:
>>
>> [image: Modular application with an API module.]
>>
>> In this screenshot, you can see both the API module-info.java file and
>> the interface that module contains (the two windows on top to the right).
>> Also, you can see the module-info.java file and the implementation of the
>> interface for "another.mod" module (lower two windows to the right). Let's
>> talk about the api.mod:module-info.java file:
>>
>> Notice that *module api.mod* requires "java.sql", but uses the
>> "transitive" keyword. This allows for any module that requires the module
>> "api.mod" to also get a reference to the "java.sql" module without needing
>> to declare so explicitly. We'll get to that in a minute. Notice the
>> interface named "Database" on the upper-right...It is able to import both
>> java.sql.ResultSet and java.sql.SQLException. This is due to the statement
>> in the module-info.java file "requires java.sql". *This* is how you are
>> able to use the Java SQL API in a modular Java application. Now, let's look
>> at the implementation...
>>
>> In the two lower windows to the right, you see the
>> another.mod:module-info.java file (left one) and the implementation of the
>> Database interface (right one). In order to implement the Database
>> interface, another.mod had to place the "requires api.mod" statement in its
>> module-info.java file. Furthermore, notice that DatabaseAccess class
>> imports classes from the java.sql package, but *does not* have a
>> "requires java.sql" statement in its module-info.java file. This is because
>> of the api.mod:module-info.java requiring java.sql as *transitive*. The
>> *transitive* keyword means that another.module gets access to the
>> java.sql module *implicitly* due to it dependency on api.module.
>>
>> Now, let's have our base module use the implementation of the Database
>> interface, *without having a dependency on the another.mod module*...
>>
>> To implement the project API, we will create a main class in the base.mod
>> module, place a "requires api.mod" statement in its module-info.java file,
>> and then use the ServiceLoader to get the implementation defined in
>> another.mod:
>>
>> [image: Implementing the API]
>>
>> The top window on the right is the module-info.java file for another.mod.
>> It declares that it *provides* an implementation of the Database
>> interface *with* the DatabaseAccess class.
>>
>> In the middle window on the right, you can see that the base.mod module
>> *only* requires the api.mod module, so that it has access to the
>> Database interface. Then, in the constructor of the MainClass, you see the
>> use of the *java.util.ServiceLoader* class to get to the implementation
>> of the Database interface that is defined by the module another.mod.
>>
>> With these screenshots and explanations, hopefully it makes more sense to
>> you why you are not seeing the java.sql in your Libraries node in NetBeans.
>> I've expanded the Libraries node in each of these screenshots so that you
>> can see no where have I added a library for java.sql, but am able to use
>> that package because of how I *require* it in my module-info.java
>> files...
>>
>> -SC
>> On 2/13/23 2:53 PM, Amitabh Choudhury wrote:
>>
>> Hi Sean
>>
>> Thanks for all the effort to explain the reasons. Very much appreciated.
>> Especially this third message.
>>
>> I had to close the project fast. So your statement of "third party" gave
>> the hint to pack required classes (java.sql package) in a "third party" jar
>> and add it to the "Project Window".
>> Did basic search on "Project jigsaw" and noted that it would take very
>> slow reading to grasp that flow.
>>
>> Fortunately there was "sql.jar" available online that had packaged the
>> "java.sql" class files in .jar.
>>
>> Used that to get the project rolling.
>>
>> This is standalone desktop Ant project.
>> Couldn't find any "module-info.java" file generated by Netbeans.
>> So I am yet to figure out what this "module-info.java" file is and where
>> to place it in project structure.
>> Then I will be able to add "requires java.sql;" statement in that file.
>>
>> Thanks for the guidance. Have to figure out where to find this
>> 'module-info.java'.
>>
>> @Ernie - Thanks for the guidance.
>>
>> @László - Thanks for the guidance.
>>
>> Screenshots indicate that the "java.sql" is accepted.
>>
>> Thanks.
>>
>> Warm wishes
>>
>>
>> On Tue, Feb 14, 2023 at 1:02 AM Sean Carrick <se...@pekinsoft.com> wrote:
>>
>>> Amitabh,
>>>
>>> Just to clarify, since I missed stating this in my last two messages
>>> regarding your issue...
>>>
>>> When developing a *modular* Java project, the only items that should be
>>> listed in your Libraries node in the Projects window of NetBeans IDE should
>>> be the JDK that you are currently using and any third-party libraries that
>>> you have added as dependencies to your project.
>>>
>>> Within the JDK18 library that is currently in your Libraries node, the
>>> java.sql package is located. In order for your project to use the SQL API
>>> libraries, you must type a "requires java.sql;" statement in the
>>> module-info.java *in each module that relies upon the SQL API*. Until
>>> such time that you place those requires statements in each module needing
>>> it, none of your modules will be able to access the SQL API.
>>>
>>> One further note: This is *not* a NetBeans, nor a NetBeans
>>> configuration, issue. This is completely due to the way the JDK has been
>>> organized since JDK9, when the JDK was modularized under Project Jigsaw.
>>> Google the phrase "Project Jigsaw" and do some reading so that you can
>>> better understand how the JDK is organized. By doing this, it will help you
>>> to better understand how to use the JDK more effectively.
>>>
>>> -SC
>>> On 2/13/23 1:21 PM, Sean Carrick wrote:
>>>
>>> One more time...
>>>
>>> You *must add the dependency in your module.info <http://module.info>
>>> file*. The only module of the JDK that is included by default in any
>>> modular Java project is the java.base module. *All other needed modules
>>> must be manually included in your module-info.java file. *For example:
>>>
>>> module my.module {
>>>     requires java.sql;    // java.base is IMPLICITLY required
>>>     requires java.desktop; // For developing Java/Swing GUI applications
>>>
>>>     // Add your exports, uses, and provides statements below.
>>> }
>>>
>>> To see which modules are included with the java.base module, see
>>> https://docs.oracle.com/en/java/javase/11/docs/api/java.base/module-summary.html.
>>> If the module (such as java.sql) is not listed on this page, then it is *not
>>> *part of java.base. You could save a lot of "requires" statements in
>>> your module-info.java file by including a grouping such as java.se.
>>> This will give you access to java.desktop packages, java.sql packages, as
>>> well as many others that are typically needed for J2SE application
>>> development.
>>>
>>> You ought to bookmark this link:
>>> https://docs.oracle.com/en/java/javase/14/docs/api/
>>>
>>> That link is to the Java API JavaDoc pages for JDK 14. If you need a
>>> different version of the JDK, change the 14 in the link above to the
>>> version you are interested in.
>>>
>>> -SC
>>> On 2/13/23 12:57 PM, Amitabh Choudhury wrote:
>>>
>>> This is the bunch of  screenshots.
>>>
>>> On Tue, Feb 14, 2023 at 12:15 AM Amitabh Choudhury <
>>> amitabhisgood@gmail.com> wrote:
>>>
>>>> Hi Ernie (and others)
>>>>
>>>> Have used all default configurations. There is java.sql module. That is
>>>> being displayed in "Java Platform Manager" but not getting displayed in
>>>> "Libraries" of the Ant application. Screenshots are attached.
>>>> All settings are defaults.
>>>>
>>>> So, the action required is to include the java.sql module in the
>>>> Libraries of the application. Even though it is in Java Platform Manager,
>>>> its missing in the default libraries.
>>>>
>>>> Please guide.
>>>>
>>>> Warm wishes
>>>>
>>>>
>>>>
>>>> On Mon, Feb 13, 2023 at 11:42 PM Ernie Rael <er...@raelity.com> wrote:
>>>>
>>>>> The sql stuff is not in the "java.base" module; there are separate
>>>>> modules for the sql stuff. I don't use modules, but I'm guessing the
>>>>> problem is how your app (not NetBeans) is configured.
>>>>>
>>>>> -ernie
>>>>>
>>>>> On 23/02/13 9:45 AM, Amitabh Choudhury wrote:
>>>>> > Hello
>>>>> >
>>>>> > This is in continuation of my previous mail related to Netbeans 14.
>>>>> >
>>>>> > Got aware that Netbeans 14 isn't supported, so downloaded Netbeans
>>>>> 16
>>>>> > and configured with Java 18.
>>>>> >
>>>>> > Created Ant project and checked java.base.
>>>>> > java.sql is missing in this as well.
>>>>> >
>>>>> > Please guide to configure Netbeans 16 to include java.sql in
>>>>> java.base
>>>>> > module of Default Library.
>>>>> > Images attached ...
>>>>> >
>>>>> > Warm wishes
>>>>> >
>>>>> > ~~~
>>>>> > Amitabh Choudhury
>>>>> >
>>>>> > ---------------------------------------------------------------------
>>>>> > To unsubscribe, e-mail: users-unsubscribe@netbeans.apache.org
>>>>> > For additional commands, e-mail: users-help@netbeans.apache.org
>>>>> >
>>>>> > For further information about the NetBeans mailing lists, visit:
>>>>> > https://cwiki.apache.org/confluence/display/NETBEANS/Mailing+lists
>>>>>
>>>>>
>>>>>
>>>>> ---------------------------------------------------------------------
>>>>> To unsubscribe, e-mail: users-unsubscribe@netbeans.apache.org
>>>>> For additional commands, e-mail: users-help@netbeans.apache.org
>>>>>
>>>>> For further information about the NetBeans mailing lists, visit:
>>>>> https://cwiki.apache.org/confluence/display/NETBEANS/Mailing+lists
>>>>>
>>>>>
>>> ---------------------------------------------------------------------
>>> To unsubscribe, e-mail: users-unsubscribe@netbeans.apache.org
>>> For additional commands, e-mail: users-help@netbeans.apache.org
>>>
>>> For further information about the NetBeans mailing lists, visit:https://cwiki.apache.org/confluence/display/NETBEANS/Mailing+lists
>>>
>>>
>> ---------------------------------------------------------------------
>> To unsubscribe, e-mail: users-unsubscribe@netbeans.apache.org
>> For additional commands, e-mail: users-help@netbeans.apache.org
>>
>> For further information about the NetBeans mailing lists, visit:https://cwiki.apache.org/confluence/display/NETBEANS/Mailing+lists
>>
>>

Re: java.sql missing from java.base in Netbeans 16 JDK 18 defaults

Posted by Amitabh Choudhury <am...@gmail.com>.
Hi Sean.

Got out of bed sometime back. Saw this post now. Awesome!!!

As I mentioned, I had to get the solution previous night at earliest. So
did what I did, then.

Now I have flexibility to study the modular structure.

Browsing through your code and screenshot now.

Which category of project did you use to create the project? "Netbeans
Module"? "Java with Maven"? "Java with Ant"?

I used "Java with Ant" and "Java Application".
I haven't come across "module-info.java" hence I suspect that the project
isn't a "Java with Ant" category project.

I suspect that for each category, default code generated by Netbeans is
different, hence I wasn't aware of "module-info.java".

I could comprehend, your information. Now, I need to know which category of
project was created? The directory structure isn't "Java with Ant" category.

Is "module-info.java" generated by Netbeans or you created it?
Seems like the "category of project" matters.

Which category of project was created?



Warm wishes





On Tue, Feb 14, 2023 at 4:06 AM Sean Carrick <se...@pekinsoft.com> wrote:

> Amitabh,
>
> NO! What you just said is *NOT* how you do it! Look at this screenshot:
>
> [image: Proper way to get Java SQL API into a modular project.]
>
> The code window on the right shows a class that is able to import and
> access the Java SQL API. Notice the Libraries nodes in the Project window
> toward the upper-left: the only thing imported is the JDK and the current
> module...*nothing else*.
>
> To accomplish this, all I did was to fill out the module-info.java file
> for the "another.mod" module:
>
> [image: module-info.java contents for another.mod module.]
>
> As you can see, even though I have *no third-party* SQL library in the
> Libraries node, I am requiring the use of java.sql in my module. This is
> because the Java SQL API is located in the module *java.sql* within the
> JDK. So, to use it in my project, I have to *require* it, as I have done
> in the image above.
>
> Now, once I have my DatabaseAccess class written, if I want to use it my
> module named "base.mod", I would need to place the following statement into
> the *base.mod:module-info.java* file:
>
> module base.module {
>     requires java.sql;	// To be able to import SQLException class.
>     requires another.mod;	// To import the exported class from my other module.
> }
>
> This is how modular development using Project Jigsaw works. You *must*
> create *explicit* contracts between the modules. Furthermore, if
> "base.mod" requires "another.mod" for the DatabaseAccess class, then
> "another.mod" *cannot* require "base.mod" because that would be a cyclic
> dependency and the compiler would not be able to determine which module to
> compile first.
>
> So, to properly develop a modular application in Java, you need to think
> through all of your requirements very carefully. You will want to create a
> module that is an API for your application, which can be required by any or
> all other modules in your application, but which itself has no requirements
> on any of the other modules. When you create this API module, it would be
> best if it only contained interfaces and abstract classes that must be
> implemented elsewhere. Then, you create implementations in the other
> modules and can use the Java class java.util.ServiceLoader to load the
> implementations where you need them, without needing to require the modules
> in which the implementations are defined. For example, if my example
> created an API module, it could look like this:
>
> [image: Modular application with an API module.]
>
> In this screenshot, you can see both the API module-info.java file and the
> interface that module contains (the two windows on top to the right). Also,
> you can see the module-info.java file and the implementation of the
> interface for "another.mod" module (lower two windows to the right). Let's
> talk about the api.mod:module-info.java file:
>
> Notice that *module api.mod* requires "java.sql", but uses the
> "transitive" keyword. This allows for any module that requires the module
> "api.mod" to also get a reference to the "java.sql" module without needing
> to declare so explicitly. We'll get to that in a minute. Notice the
> interface named "Database" on the upper-right...It is able to import both
> java.sql.ResultSet and java.sql.SQLException. This is due to the statement
> in the module-info.java file "requires java.sql". *This* is how you are
> able to use the Java SQL API in a modular Java application. Now, let's look
> at the implementation...
>
> In the two lower windows to the right, you see the
> another.mod:module-info.java file (left one) and the implementation of the
> Database interface (right one). In order to implement the Database
> interface, another.mod had to place the "requires api.mod" statement in its
> module-info.java file. Furthermore, notice that DatabaseAccess class
> imports classes from the java.sql package, but *does not* have a
> "requires java.sql" statement in its module-info.java file. This is because
> of the api.mod:module-info.java requiring java.sql as *transitive*. The
> *transitive* keyword means that another.module gets access to the
> java.sql module *implicitly* due to it dependency on api.module.
>
> Now, let's have our base module use the implementation of the Database
> interface, *without having a dependency on the another.mod module*...
>
> To implement the project API, we will create a main class in the base.mod
> module, place a "requires api.mod" statement in its module-info.java file,
> and then use the ServiceLoader to get the implementation defined in
> another.mod:
>
> [image: Implementing the API]
>
> The top window on the right is the module-info.java file for another.mod.
> It declares that it *provides* an implementation of the Database
> interface *with* the DatabaseAccess class.
>
> In the middle window on the right, you can see that the base.mod module
> *only* requires the api.mod module, so that it has access to the Database
> interface. Then, in the constructor of the MainClass, you see the use of
> the *java.util.ServiceLoader* class to get to the implementation of the
> Database interface that is defined by the module another.mod.
>
> With these screenshots and explanations, hopefully it makes more sense to
> you why you are not seeing the java.sql in your Libraries node in NetBeans.
> I've expanded the Libraries node in each of these screenshots so that you
> can see no where have I added a library for java.sql, but am able to use
> that package because of how I *require* it in my module-info.java files...
>
> -SC
> On 2/13/23 2:53 PM, Amitabh Choudhury wrote:
>
> Hi Sean
>
> Thanks for all the effort to explain the reasons. Very much appreciated.
> Especially this third message.
>
> I had to close the project fast. So your statement of "third party" gave
> the hint to pack required classes (java.sql package) in a "third party" jar
> and add it to the "Project Window".
> Did basic search on "Project jigsaw" and noted that it would take very
> slow reading to grasp that flow.
>
> Fortunately there was "sql.jar" available online that had packaged the
> "java.sql" class files in .jar.
>
> Used that to get the project rolling.
>
> This is standalone desktop Ant project.
> Couldn't find any "module-info.java" file generated by Netbeans.
> So I am yet to figure out what this "module-info.java" file is and where
> to place it in project structure.
> Then I will be able to add "requires java.sql;" statement in that file.
>
> Thanks for the guidance. Have to figure out where to find this
> 'module-info.java'.
>
> @Ernie - Thanks for the guidance.
>
> @László - Thanks for the guidance.
>
> Screenshots indicate that the "java.sql" is accepted.
>
> Thanks.
>
> Warm wishes
>
>
> On Tue, Feb 14, 2023 at 1:02 AM Sean Carrick <se...@pekinsoft.com> wrote:
>
>> Amitabh,
>>
>> Just to clarify, since I missed stating this in my last two messages
>> regarding your issue...
>>
>> When developing a *modular* Java project, the only items that should be
>> listed in your Libraries node in the Projects window of NetBeans IDE should
>> be the JDK that you are currently using and any third-party libraries that
>> you have added as dependencies to your project.
>>
>> Within the JDK18 library that is currently in your Libraries node, the
>> java.sql package is located. In order for your project to use the SQL API
>> libraries, you must type a "requires java.sql;" statement in the
>> module-info.java *in each module that relies upon the SQL API*. Until
>> such time that you place those requires statements in each module needing
>> it, none of your modules will be able to access the SQL API.
>>
>> One further note: This is *not* a NetBeans, nor a NetBeans
>> configuration, issue. This is completely due to the way the JDK has been
>> organized since JDK9, when the JDK was modularized under Project Jigsaw.
>> Google the phrase "Project Jigsaw" and do some reading so that you can
>> better understand how the JDK is organized. By doing this, it will help you
>> to better understand how to use the JDK more effectively.
>>
>> -SC
>> On 2/13/23 1:21 PM, Sean Carrick wrote:
>>
>> One more time...
>>
>> You *must add the dependency in your module.info <http://module.info>
>> file*. The only module of the JDK that is included by default in any
>> modular Java project is the java.base module. *All other needed modules
>> must be manually included in your module-info.java file. *For example:
>>
>> module my.module {
>>     requires java.sql;    // java.base is IMPLICITLY required
>>     requires java.desktop; // For developing Java/Swing GUI applications
>>
>>     // Add your exports, uses, and provides statements below.
>> }
>>
>> To see which modules are included with the java.base module, see
>> https://docs.oracle.com/en/java/javase/11/docs/api/java.base/module-summary.html.
>> If the module (such as java.sql) is not listed on this page, then it is *not
>> *part of java.base. You could save a lot of "requires" statements in
>> your module-info.java file by including a grouping such as java.se. This
>> will give you access to java.desktop packages, java.sql packages, as well
>> as many others that are typically needed for J2SE application development.
>>
>> You ought to bookmark this link:
>> https://docs.oracle.com/en/java/javase/14/docs/api/
>>
>> That link is to the Java API JavaDoc pages for JDK 14. If you need a
>> different version of the JDK, change the 14 in the link above to the
>> version you are interested in.
>>
>> -SC
>> On 2/13/23 12:57 PM, Amitabh Choudhury wrote:
>>
>> This is the bunch of  screenshots.
>>
>> On Tue, Feb 14, 2023 at 12:15 AM Amitabh Choudhury <
>> amitabhisgood@gmail.com> wrote:
>>
>>> Hi Ernie (and others)
>>>
>>> Have used all default configurations. There is java.sql module. That is
>>> being displayed in "Java Platform Manager" but not getting displayed in
>>> "Libraries" of the Ant application. Screenshots are attached.
>>> All settings are defaults.
>>>
>>> So, the action required is to include the java.sql module in the
>>> Libraries of the application. Even though it is in Java Platform Manager,
>>> its missing in the default libraries.
>>>
>>> Please guide.
>>>
>>> Warm wishes
>>>
>>>
>>>
>>> On Mon, Feb 13, 2023 at 11:42 PM Ernie Rael <er...@raelity.com> wrote:
>>>
>>>> The sql stuff is not in the "java.base" module; there are separate
>>>> modules for the sql stuff. I don't use modules, but I'm guessing the
>>>> problem is how your app (not NetBeans) is configured.
>>>>
>>>> -ernie
>>>>
>>>> On 23/02/13 9:45 AM, Amitabh Choudhury wrote:
>>>> > Hello
>>>> >
>>>> > This is in continuation of my previous mail related to Netbeans 14.
>>>> >
>>>> > Got aware that Netbeans 14 isn't supported, so downloaded Netbeans 16
>>>> > and configured with Java 18.
>>>> >
>>>> > Created Ant project and checked java.base.
>>>> > java.sql is missing in this as well.
>>>> >
>>>> > Please guide to configure Netbeans 16 to include java.sql in
>>>> java.base
>>>> > module of Default Library.
>>>> > Images attached ...
>>>> >
>>>> > Warm wishes
>>>> >
>>>> > ~~~
>>>> > Amitabh Choudhury
>>>> >
>>>> > ---------------------------------------------------------------------
>>>> > To unsubscribe, e-mail: users-unsubscribe@netbeans.apache.org
>>>> > For additional commands, e-mail: users-help@netbeans.apache.org
>>>> >
>>>> > For further information about the NetBeans mailing lists, visit:
>>>> > https://cwiki.apache.org/confluence/display/NETBEANS/Mailing+lists
>>>>
>>>>
>>>>
>>>> ---------------------------------------------------------------------
>>>> To unsubscribe, e-mail: users-unsubscribe@netbeans.apache.org
>>>> For additional commands, e-mail: users-help@netbeans.apache.org
>>>>
>>>> For further information about the NetBeans mailing lists, visit:
>>>> https://cwiki.apache.org/confluence/display/NETBEANS/Mailing+lists
>>>>
>>>>
>> ---------------------------------------------------------------------
>> To unsubscribe, e-mail: users-unsubscribe@netbeans.apache.org
>> For additional commands, e-mail: users-help@netbeans.apache.org
>>
>> For further information about the NetBeans mailing lists, visit:https://cwiki.apache.org/confluence/display/NETBEANS/Mailing+lists
>>
>>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@netbeans.apache.org
> For additional commands, e-mail: users-help@netbeans.apache.org
>
> For further information about the NetBeans mailing lists, visit:https://cwiki.apache.org/confluence/display/NETBEANS/Mailing+lists
>
>

Re: java.sql missing from java.base in Netbeans 16 JDK 18 defaults

Posted by Sean Carrick <se...@pekinsoft.com>.
Amitabh,

NO! What you just said is /_*NOT*_/ how you do it! Look at this screenshot:

Proper way to get Java SQL API into a modular project.

The code window on the right shows a class that is able to import and 
access the Java SQL API. Notice the Libraries nodes in the Project 
window toward the upper-left: the only thing imported is the JDK and the 
current module.../*nothing else*/.

To accomplish this, all I did was to fill out the module-info.java file 
for the "another.mod" module:

module-info.java contents for another.mod module.

As you can see, even though I have /no third-party/ SQL library in the 
Libraries node, I am requiring the use of java.sql in my module. This is 
because the Java SQL API is located in the module /java.sql/ within the 
JDK. So, to use it in my project, I have to /require/ it, as I have done 
in the image above.

Now, once I have my DatabaseAccess class written, if I want to use it my 
module named "base.mod", I would need to place the following statement 
into the /base.mod:module-info.java/ file:

module base.module {
     requires java.sql;	// To be able to import SQLException class.
     requires another.mod;	// To import the exported class from my other module.
}

This is how modular development using Project Jigsaw works. You /*must*/ 
create /explicit/ contracts between the modules. Furthermore, if 
"base.mod" requires "another.mod" for the DatabaseAccess class, then 
"another.mod" /*cannot*/ require "base.mod" because that would be a 
cyclic dependency and the compiler would not be able to determine which 
module to compile first.

So, to properly develop a modular application in Java, you need to think 
through all of your requirements very carefully. You will want to create 
a module that is an API for your application, which can be required by 
any or all other modules in your application, but which itself has no 
requirements on any of the other modules. When you create this API 
module, it would be best if it only contained interfaces and abstract 
classes that must be implemented elsewhere. Then, you create 
implementations in the other modules and can use the Java class 
java.util.ServiceLoader to load the implementations where you need them, 
without needing to require the modules in which the implementations are 
defined. For example, if my example created an API module, it could look 
like this:

Modular application with an API module.

In this screenshot, you can see both the API module-info.java file and 
the interface that module contains (the two windows on top to the 
right). Also, you can see the module-info.java file and the 
implementation of the interface for "another.mod" module (lower two 
windows to the right). Let's talk about the api.mod:module-info.java file:

Notice that /module api.mod/ requires "java.sql", but uses the 
"transitive" keyword. This allows for any module that requires the 
module "api.mod" to also get a reference to the "java.sql" module 
without needing to declare so explicitly. We'll get to that in a minute. 
Notice the interface named "Database" on the upper-right...It is able to 
import both java.sql.ResultSet and java.sql.SQLException. This is due to 
the statement in the module-info.java file "requires java.sql". /*This*/ 
is how you are able to use the Java SQL API in a modular Java 
application. Now, let's look at the implementation...

In the two lower windows to the right, you see the 
another.mod:module-info.java file (left one) and the implementation of 
the Database interface (right one). In order to implement the Database 
interface, another.mod had to place the "requires api.mod" statement in 
its module-info.java file. Furthermore, notice that DatabaseAccess class 
imports classes from the java.sql package, but /does not/ have a 
"requires java.sql" statement in its module-info.java file. This is 
because of the api.mod:module-info.java requiring java.sql as 
/transitive/. The /transitive/ keyword means that another.module gets 
access to the java.sql module /implicitly/ due to it dependency on 
api.module.

Now, let's have our base module use the implementation of the Database 
interface, /without having a dependency on the another.mod module/...

To implement the project API, we will create a main class in the 
base.mod module, place a "requires api.mod" statement in its 
module-info.java file, and then use the ServiceLoader to get the 
implementation defined in another.mod:

Implementing the API

The top window on the right is the module-info.java file for 
another.mod. It declares that it /provides/ an implementation of the 
Database interface /with/ the DatabaseAccess class.

In the middle window on the right, you can see that the base.mod module 
/only/ requires the api.mod module, so that it has access to the 
Database interface. Then, in the constructor of the MainClass, you see 
the use of the /java.util.ServiceLoader/ class to get to the 
implementation of the Database interface that is defined by the module 
another.mod.

With these screenshots and explanations, hopefully it makes more sense 
to you why you are not seeing the java.sql in your Libraries node in 
NetBeans. I've expanded the Libraries node in each of these screenshots 
so that you can see no where have I added a library for java.sql, but am 
able to use that package because of how I /require/ it in my 
module-info.java files...

-SC

On 2/13/23 2:53 PM, Amitabh Choudhury wrote:
> Hi Sean
>
> Thanks for all the effort to explain the reasons. Very much 
> appreciated. Especially this third message.
>
> I had to close the project fast. So your statement of "third party" 
> gave the hint to pack required classes (java.sql package) in a "third 
> party" jar and add it to the "Project Window".
> Did basic search on "Project jigsaw" and noted that it would take very 
> slow reading to grasp that flow.
>
> Fortunately there was "sql.jar" available online that had packaged the 
> "java.sql" class files in .jar.
>
> Used that to get the project rolling.
>
> This is standalone desktop Ant project.
> Couldn't find any "module-info.java" file generated by Netbeans.
> So I am yet to figure out what this "module-info.java" file is and 
> where to place it in project structure.
> Then I will be able to add "requires java.sql;" statement in that file.
>
> Thanks for the guidance. Have to figure out where to find this 
> 'module-info.java'.
>
> @Ernie - Thanks for the guidance.
>
> @László - Thanks for the guidance.
>
> Screenshots indicate that the "java.sql" is accepted.
>
> Thanks.
>
> Warm wishes
>
>
> On Tue, Feb 14, 2023 at 1:02 AM Sean Carrick <sean@pekinsoft.com 
> <ma...@pekinsoft.com>> wrote:
>
>     Amitabh,
>
>     Just to clarify, since I missed stating this in my last two
>     messages regarding your issue...
>
>     When developing a /modular/ Java project, the only items that
>     should be listed in your Libraries node in the Projects window of
>     NetBeans IDE should be the JDK that you are currently using and
>     any third-party libraries that you have added as dependencies to
>     your project.
>
>     Within the JDK18 library that is currently in your Libraries node,
>     the java.sql package is located. In order for your project to use
>     the SQL API libraries, you must type a "requires java.sql;"
>     statement in the module-info.java /in each module that relies upon
>     the SQL API/. Until such time that you place those requires
>     statements in each module needing it, none of your modules will be
>     able to access the SQL API.
>
>     One further note: This is /not/ a NetBeans, nor a NetBeans
>     configuration, issue. This is completely due to the way the JDK
>     has been organized since JDK9, when the JDK was modularized under
>     Project Jigsaw. Google the phrase "Project Jigsaw" and do some
>     reading so that you can better understand how the JDK is
>     organized. By doing this, it will help you to better understand
>     how to use the JDK more effectively.
>
>     -SC
>
>     On 2/13/23 1:21 PM, Sean Carrick wrote:
>>
>>     One more time...
>>
>>     You _/*must add the dependency in your module.info
>>     <http://module.info> file*/_. The only module of the JDK that is
>>     included by default in any modular Java project is the java.base
>>     module. /All other needed modules *must be* manually included in
>>     your module-info.java file. /For example:
>>
>>     module my.module {
>>          requires java.sql;    // java.base is IMPLICITLY required
>>          requires java.desktop; // For developing Java/Swing GUI applications
>>          
>>          // Add your exports, uses, and provides statements below.
>>     }
>>
>>     To see which modules are included with the java.base module, see
>>     https://docs.oracle.com/en/java/javase/11/docs/api/java.base/module-summary.html
>>     <https://docs.oracle.com/en/java/javase/11/docs/api/java.base/module-summary.html>.
>>     If the module (such as java.sql) is not listed on this page, then
>>     it is /not /part of java.base. You could save a lot of "requires"
>>     statements in your module-info.java file by including a grouping
>>     such as java.se <http://java.se>. This will give you access to
>>     java.desktop packages, java.sql packages, as well as many others
>>     that are typically needed for J2SE application development.
>>
>>     You ought to bookmark this link:
>>     https://docs.oracle.com/en/java/javase/14/docs/api/
>>     <https://docs.oracle.com/en/java/javase/14/docs/api/>
>>
>>     That link is to the Java API JavaDoc pages for JDK 14. If you
>>     need a different version of the JDK, change the 14 in the link
>>     above to the version you are interested in.
>>
>>     -SC
>>
>>     On 2/13/23 12:57 PM, Amitabh Choudhury wrote:
>>>     This is the bunch of  screenshots.
>>>
>>>     On Tue, Feb 14, 2023 at 12:15 AM Amitabh Choudhury
>>>     <amitabhisgood@gmail.com <ma...@gmail.com>> wrote:
>>>
>>>         Hi Ernie (and others)
>>>
>>>         Have used all default configurations. There is java.sql
>>>         module. That is being displayed in "Java Platform Manager"
>>>         but not getting displayed in "Libraries" of the Ant
>>>         application. Screenshots are attached.
>>>         All settings are defaults.
>>>
>>>         So, the action required is to include the java.sql module in
>>>         the Libraries of the application. Even though it is in Java
>>>         Platform Manager, its missing in the default libraries.
>>>
>>>         Please guide.
>>>
>>>         Warm wishes
>>>
>>>
>>>
>>>         On Mon, Feb 13, 2023 at 11:42 PM Ernie Rael
>>>         <errael@raelity.com <ma...@raelity.com>> wrote:
>>>
>>>             The sql stuff is not in the "java.base" module; there
>>>             are separate
>>>             modules for the sql stuff. I don't use modules, but I'm
>>>             guessing the
>>>             problem is how your app (not NetBeans) is configured.
>>>
>>>             -ernie
>>>
>>>             On 23/02/13 9:45 AM, Amitabh Choudhury wrote:
>>>             > Hello
>>>             >
>>>             > This is in continuation of my previous mail related to
>>>             Netbeans 14.
>>>             >
>>>             > Got aware that Netbeans 14 isn't supported, so
>>>             downloaded Netbeans 16
>>>             > and configured with Java 18.
>>>             >
>>>             > Created Ant project and checked java.base.
>>>             > java.sql is missing in this as well.
>>>             >
>>>             > Please guide to configure Netbeans 16 to include
>>>             java.sql in java.base
>>>             > module of Default Library.
>>>             > Images attached ...
>>>             >
>>>             > Warm wishes
>>>             >
>>>             > ~~~
>>>             > Amitabh Choudhury
>>>             >
>>>             >
>>>             ---------------------------------------------------------------------
>>>             > To unsubscribe, e-mail:
>>>             users-unsubscribe@netbeans.apache.org
>>>             <ma...@netbeans.apache.org>
>>>             > For additional commands, e-mail:
>>>             users-help@netbeans.apache.org
>>>             <ma...@netbeans.apache.org>
>>>             >
>>>             > For further information about the NetBeans mailing
>>>             lists, visit:
>>>             >
>>>             https://cwiki.apache.org/confluence/display/NETBEANS/Mailing+lists
>>>             <https://cwiki.apache.org/confluence/display/NETBEANS/Mailing+lists>
>>>
>>>
>>>
>>>             ---------------------------------------------------------------------
>>>             To unsubscribe, e-mail:
>>>             users-unsubscribe@netbeans.apache.org
>>>             <ma...@netbeans.apache.org>
>>>             For additional commands, e-mail:
>>>             users-help@netbeans.apache.org
>>>             <ma...@netbeans.apache.org>
>>>
>>>             For further information about the NetBeans mailing
>>>             lists, visit:
>>>             https://cwiki.apache.org/confluence/display/NETBEANS/Mailing+lists
>>>             <https://cwiki.apache.org/confluence/display/NETBEANS/Mailing+lists>
>>>
>>>
>>>     ---------------------------------------------------------------------
>>>     To unsubscribe, e-mail:users-unsubscribe@netbeans.apache.org  <ma...@netbeans.apache.org>
>>>     For additional commands, e-mail:users-help@netbeans.apache.org  <ma...@netbeans.apache.org>
>>>
>>>     For further information about the NetBeans mailing lists, visit:
>>>     https://cwiki.apache.org/confluence/display/NETBEANS/Mailing+lists  <https://cwiki.apache.org/confluence/display/NETBEANS/Mailing+lists>
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@netbeans.apache.org
> For additional commands, e-mail: users-help@netbeans.apache.org
>
> For further information about the NetBeans mailing lists, visit:
> https://cwiki.apache.org/confluence/display/NETBEANS/Mailing+lists

Re: java.sql missing from java.base in Netbeans 16 JDK 18 defaults

Posted by Amitabh Choudhury <am...@gmail.com>.
Hi Sean

Thanks for all the effort to explain the reasons. Very much appreciated.
Especially this third message.

I had to close the project fast. So your statement of "third party" gave
the hint to pack required classes (java.sql package) in a "third party" jar
and add it to the "Project Window".
Did basic search on "Project jigsaw" and noted that it would take very slow
reading to grasp that flow.

Fortunately there was "sql.jar" available online that had packaged the
"java.sql" class files in .jar.

Used that to get the project rolling.

This is standalone desktop Ant project.
Couldn't find any "module-info.java" file generated by Netbeans.
So I am yet to figure out what this "module-info.java" file is and where to
place it in project structure.
Then I will be able to add "requires java.sql;" statement in that file.

Thanks for the guidance. Have to figure out where to find this
'module-info.java'.

@Ernie - Thanks for the guidance.

@László - Thanks for the guidance.

Screenshots indicate that the "java.sql" is accepted.

Thanks.

Warm wishes


On Tue, Feb 14, 2023 at 1:02 AM Sean Carrick <se...@pekinsoft.com> wrote:

> Amitabh,
>
> Just to clarify, since I missed stating this in my last two messages
> regarding your issue...
>
> When developing a *modular* Java project, the only items that should be
> listed in your Libraries node in the Projects window of NetBeans IDE should
> be the JDK that you are currently using and any third-party libraries that
> you have added as dependencies to your project.
>
> Within the JDK18 library that is currently in your Libraries node, the
> java.sql package is located. In order for your project to use the SQL API
> libraries, you must type a "requires java.sql;" statement in the
> module-info.java *in each module that relies upon the SQL API*. Until
> such time that you place those requires statements in each module needing
> it, none of your modules will be able to access the SQL API.
>
> One further note: This is *not* a NetBeans, nor a NetBeans configuration,
> issue. This is completely due to the way the JDK has been organized since
> JDK9, when the JDK was modularized under Project Jigsaw. Google the phrase
> "Project Jigsaw" and do some reading so that you can better understand how
> the JDK is organized. By doing this, it will help you to better understand
> how to use the JDK more effectively.
>
> -SC
> On 2/13/23 1:21 PM, Sean Carrick wrote:
>
> One more time...
>
> You *must add the dependency in your module.info <http://module.info>
> file*. The only module of the JDK that is included by default in any
> modular Java project is the java.base module. *All other needed modules
> must be manually included in your module-info.java file. *For example:
>
> module my.module {
>     requires java.sql;    // java.base is IMPLICITLY required
>     requires java.desktop; // For developing Java/Swing GUI applications
>
>     // Add your exports, uses, and provides statements below.
> }
>
> To see which modules are included with the java.base module, see
> https://docs.oracle.com/en/java/javase/11/docs/api/java.base/module-summary.html.
> If the module (such as java.sql) is not listed on this page, then it is *not
> *part of java.base. You could save a lot of "requires" statements in your
> module-info.java file by including a grouping such as java.se. This will
> give you access to java.desktop packages, java.sql packages, as well as
> many others that are typically needed for J2SE application development.
>
> You ought to bookmark this link:
> https://docs.oracle.com/en/java/javase/14/docs/api/
>
> That link is to the Java API JavaDoc pages for JDK 14. If you need a
> different version of the JDK, change the 14 in the link above to the
> version you are interested in.
>
> -SC
> On 2/13/23 12:57 PM, Amitabh Choudhury wrote:
>
> This is the bunch of  screenshots.
>
> On Tue, Feb 14, 2023 at 12:15 AM Amitabh Choudhury <
> amitabhisgood@gmail.com> wrote:
>
>> Hi Ernie (and others)
>>
>> Have used all default configurations. There is java.sql module. That is
>> being displayed in "Java Platform Manager" but not getting displayed in
>> "Libraries" of the Ant application. Screenshots are attached.
>> All settings are defaults.
>>
>> So, the action required is to include the java.sql module in the
>> Libraries of the application. Even though it is in Java Platform Manager,
>> its missing in the default libraries.
>>
>> Please guide.
>>
>> Warm wishes
>>
>>
>>
>> On Mon, Feb 13, 2023 at 11:42 PM Ernie Rael <er...@raelity.com> wrote:
>>
>>> The sql stuff is not in the "java.base" module; there are separate
>>> modules for the sql stuff. I don't use modules, but I'm guessing the
>>> problem is how your app (not NetBeans) is configured.
>>>
>>> -ernie
>>>
>>> On 23/02/13 9:45 AM, Amitabh Choudhury wrote:
>>> > Hello
>>> >
>>> > This is in continuation of my previous mail related to Netbeans 14.
>>> >
>>> > Got aware that Netbeans 14 isn't supported, so downloaded Netbeans 16
>>> > and configured with Java 18.
>>> >
>>> > Created Ant project and checked java.base.
>>> > java.sql is missing in this as well.
>>> >
>>> > Please guide to configure Netbeans 16 to include java.sql in java.base
>>> > module of Default Library.
>>> > Images attached ...
>>> >
>>> > Warm wishes
>>> >
>>> > ~~~
>>> > Amitabh Choudhury
>>> >
>>> > ---------------------------------------------------------------------
>>> > To unsubscribe, e-mail: users-unsubscribe@netbeans.apache.org
>>> > For additional commands, e-mail: users-help@netbeans.apache.org
>>> >
>>> > For further information about the NetBeans mailing lists, visit:
>>> > https://cwiki.apache.org/confluence/display/NETBEANS/Mailing+lists
>>>
>>>
>>>
>>> ---------------------------------------------------------------------
>>> To unsubscribe, e-mail: users-unsubscribe@netbeans.apache.org
>>> For additional commands, e-mail: users-help@netbeans.apache.org
>>>
>>> For further information about the NetBeans mailing lists, visit:
>>> https://cwiki.apache.org/confluence/display/NETBEANS/Mailing+lists
>>>
>>>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@netbeans.apache.org
> For additional commands, e-mail: users-help@netbeans.apache.org
>
> For further information about the NetBeans mailing lists, visit:https://cwiki.apache.org/confluence/display/NETBEANS/Mailing+lists
>
>

Re: java.sql missing from java.base in Netbeans 16 JDK 18 defaults

Posted by Sean Carrick <se...@pekinsoft.com>.
Amitabh,

Just to clarify, since I missed stating this in my last two messages 
regarding your issue...

When developing a /modular/ Java project, the only items that should be 
listed in your Libraries node in the Projects window of NetBeans IDE 
should be the JDK that you are currently using and any third-party 
libraries that you have added as dependencies to your project.

Within the JDK18 library that is currently in your Libraries node, the 
java.sql package is located. In order for your project to use the SQL 
API libraries, you must type a "requires java.sql;" statement in the 
module-info.java /in each module that relies upon the SQL API/. Until 
such time that you place those requires statements in each module 
needing it, none of your modules will be able to access the SQL API.

One further note: This is /not/ a NetBeans, nor a NetBeans 
configuration, issue. This is completely due to the way the JDK has been 
organized since JDK9, when the JDK was modularized under Project Jigsaw. 
Google the phrase "Project Jigsaw" and do some reading so that you can 
better understand how the JDK is organized. By doing this, it will help 
you to better understand how to use the JDK more effectively.

-SC

On 2/13/23 1:21 PM, Sean Carrick wrote:
>
> One more time...
>
> You _/*must add the dependency in your module.info file*/_. The only 
> module of the JDK that is included by default in any modular Java 
> project is the java.base module. /All other needed modules *must be* 
> manually included in your module-info.java file. /For example:
>
> module my.module {
>      requires java.sql;    // java.base is IMPLICITLY required
>      requires java.desktop; // For developing Java/Swing GUI applications
>      
>      // Add your exports, uses, and provides statements below.
> }
>
> To see which modules are included with the java.base module, see 
> https://docs.oracle.com/en/java/javase/11/docs/api/java.base/module-summary.html 
> <https://docs.oracle.com/en/java/javase/11/docs/api/java.base/module-summary.html>. 
> If the module (such as java.sql) is not listed on this page, then it 
> is /not /part of java.base. You could save a lot of "requires" 
> statements in your module-info.java file by including a grouping such 
> as java.se. This will give you access to java.desktop packages, 
> java.sql packages, as well as many others that are typically needed 
> for J2SE application development.
>
> You ought to bookmark this link: 
> https://docs.oracle.com/en/java/javase/14/docs/api/
>
> That link is to the Java API JavaDoc pages for JDK 14. If you need a 
> different version of the JDK, change the 14 in the link above to the 
> version you are interested in.
>
> -SC
>
> On 2/13/23 12:57 PM, Amitabh Choudhury wrote:
>> This is the bunch of  screenshots.
>>
>> On Tue, Feb 14, 2023 at 12:15 AM Amitabh Choudhury 
>> <amitabhisgood@gmail.com <ma...@gmail.com>> wrote:
>>
>>     Hi Ernie (and others)
>>
>>     Have used all default configurations. There is java.sql module.
>>     That is being displayed in "Java Platform Manager" but not
>>     getting displayed in "Libraries" of the Ant application.
>>     Screenshots are attached.
>>     All settings are defaults.
>>
>>     So, the action required is to include the java.sql module in the
>>     Libraries of the application. Even though it is in Java Platform
>>     Manager, its missing in the default libraries.
>>
>>     Please guide.
>>
>>     Warm wishes
>>
>>
>>
>>     On Mon, Feb 13, 2023 at 11:42 PM Ernie Rael <errael@raelity.com
>>     <ma...@raelity.com>> wrote:
>>
>>         The sql stuff is not in the "java.base" module; there are
>>         separate
>>         modules for the sql stuff. I don't use modules, but I'm
>>         guessing the
>>         problem is how your app (not NetBeans) is configured.
>>
>>         -ernie
>>
>>         On 23/02/13 9:45 AM, Amitabh Choudhury wrote:
>>         > Hello
>>         >
>>         > This is in continuation of my previous mail related to
>>         Netbeans 14.
>>         >
>>         > Got aware that Netbeans 14 isn't supported, so downloaded
>>         Netbeans 16
>>         > and configured with Java 18.
>>         >
>>         > Created Ant project and checked java.base.
>>         > java.sql is missing in this as well.
>>         >
>>         > Please guide to configure Netbeans 16 to include java.sql
>>         in java.base
>>         > module of Default Library.
>>         > Images attached ...
>>         >
>>         > Warm wishes
>>         >
>>         > ~~~
>>         > Amitabh Choudhury
>>         >
>>         >
>>         ---------------------------------------------------------------------
>>         > To unsubscribe, e-mail:
>>         users-unsubscribe@netbeans.apache.org
>>         <ma...@netbeans.apache.org>
>>         > For additional commands, e-mail:
>>         users-help@netbeans.apache.org
>>         <ma...@netbeans.apache.org>
>>         >
>>         > For further information about the NetBeans mailing lists,
>>         visit:
>>         >
>>         https://cwiki.apache.org/confluence/display/NETBEANS/Mailing+lists
>>         <https://cwiki.apache.org/confluence/display/NETBEANS/Mailing+lists>
>>
>>
>>
>>         ---------------------------------------------------------------------
>>         To unsubscribe, e-mail: users-unsubscribe@netbeans.apache.org
>>         <ma...@netbeans.apache.org>
>>         For additional commands, e-mail:
>>         users-help@netbeans.apache.org
>>         <ma...@netbeans.apache.org>
>>
>>         For further information about the NetBeans mailing lists, visit:
>>         https://cwiki.apache.org/confluence/display/NETBEANS/Mailing+lists
>>         <https://cwiki.apache.org/confluence/display/NETBEANS/Mailing+lists>
>>
>>
>> ---------------------------------------------------------------------
>> To unsubscribe, e-mail:users-unsubscribe@netbeans.apache.org
>> For additional commands, e-mail:users-help@netbeans.apache.org
>>
>> For further information about the NetBeans mailing lists, visit:
>> https://cwiki.apache.org/confluence/display/NETBEANS/Mailing+lists

Re: java.sql missing from java.base in Netbeans 16 JDK 18 defaults

Posted by Sean Carrick <se...@pekinsoft.com>.
One more time...

You _/*must add the dependency in your module.info file*/_. The only 
module of the JDK that is included by default in any modular Java 
project is the java.base module. /All other needed modules *must be* 
manually included in your module-info.java file. /For example:

module my.module {
     requires java.sql;    // java.base is IMPLICITLY required
     requires java.desktop; // For developing Java/Swing GUI applications
     
     // Add your exports, uses, and provides statements below.
}

To see which modules are included with the java.base module, see 
https://docs.oracle.com/en/java/javase/11/docs/api/java.base/module-summary.html 
<https://docs.oracle.com/en/java/javase/11/docs/api/java.base/module-summary.html>. 
If the module (such as java.sql) is not listed on this page, then it is 
/not /part of java.base. You could save a lot of "requires" statements 
in your module-info.java file by including a grouping such as java.se. 
This will give you access to java.desktop packages, java.sql packages, 
as well as many others that are typically needed for J2SE application 
development.

You ought to bookmark this link: 
https://docs.oracle.com/en/java/javase/14/docs/api/

That link is to the Java API JavaDoc pages for JDK 14. If you need a 
different version of the JDK, change the 14 in the link above to the 
version you are interested in.

-SC

On 2/13/23 12:57 PM, Amitabh Choudhury wrote:
> This is the bunch of  screenshots.
>
> On Tue, Feb 14, 2023 at 12:15 AM Amitabh Choudhury 
> <amitabhisgood@gmail.com <ma...@gmail.com>> wrote:
>
>     Hi Ernie (and others)
>
>     Have used all default configurations. There is java.sql module.
>     That is being displayed in "Java Platform Manager" but not getting
>     displayed in "Libraries" of the Ant application. Screenshots are
>     attached.
>     All settings are defaults.
>
>     So, the action required is to include the java.sql module in the
>     Libraries of the application. Even though it is in Java Platform
>     Manager, its missing in the default libraries.
>
>     Please guide.
>
>     Warm wishes
>
>
>
>     On Mon, Feb 13, 2023 at 11:42 PM Ernie Rael <errael@raelity.com
>     <ma...@raelity.com>> wrote:
>
>         The sql stuff is not in the "java.base" module; there are
>         separate
>         modules for the sql stuff. I don't use modules, but I'm
>         guessing the
>         problem is how your app (not NetBeans) is configured.
>
>         -ernie
>
>         On 23/02/13 9:45 AM, Amitabh Choudhury wrote:
>         > Hello
>         >
>         > This is in continuation of my previous mail related to
>         Netbeans 14.
>         >
>         > Got aware that Netbeans 14 isn't supported, so downloaded
>         Netbeans 16
>         > and configured with Java 18.
>         >
>         > Created Ant project and checked java.base.
>         > java.sql is missing in this as well.
>         >
>         > Please guide to configure Netbeans 16 to include java.sql in
>         java.base
>         > module of Default Library.
>         > Images attached ...
>         >
>         > Warm wishes
>         >
>         > ~~~
>         > Amitabh Choudhury
>         >
>         >
>         ---------------------------------------------------------------------
>         > To unsubscribe, e-mail:
>         users-unsubscribe@netbeans.apache.org
>         <ma...@netbeans.apache.org>
>         > For additional commands, e-mail:
>         users-help@netbeans.apache.org
>         <ma...@netbeans.apache.org>
>         >
>         > For further information about the NetBeans mailing lists, visit:
>         >
>         https://cwiki.apache.org/confluence/display/NETBEANS/Mailing+lists
>         <https://cwiki.apache.org/confluence/display/NETBEANS/Mailing+lists>
>
>
>
>         ---------------------------------------------------------------------
>         To unsubscribe, e-mail: users-unsubscribe@netbeans.apache.org
>         <ma...@netbeans.apache.org>
>         For additional commands, e-mail:
>         users-help@netbeans.apache.org
>         <ma...@netbeans.apache.org>
>
>         For further information about the NetBeans mailing lists, visit:
>         https://cwiki.apache.org/confluence/display/NETBEANS/Mailing+lists
>         <https://cwiki.apache.org/confluence/display/NETBEANS/Mailing+lists>
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@netbeans.apache.org
> For additional commands, e-mail: users-help@netbeans.apache.org
>
> For further information about the NetBeans mailing lists, visit:
> https://cwiki.apache.org/confluence/display/NETBEANS/Mailing+lists

Re: java.sql missing from java.base in Netbeans 16 JDK 18 defaults

Posted by Amitabh Choudhury <am...@gmail.com>.
This is the bunch of  screenshots.

On Tue, Feb 14, 2023 at 12:15 AM Amitabh Choudhury <am...@gmail.com>
wrote:

> Hi Ernie (and others)
>
> Have used all default configurations. There is java.sql module. That is
> being displayed in "Java Platform Manager" but not getting displayed in
> "Libraries" of the Ant application. Screenshots are attached.
> All settings are defaults.
>
> So, the action required is to include the java.sql module in the Libraries
> of the application. Even though it is in Java Platform Manager, its missing
> in the default libraries.
>
> Please guide.
>
> Warm wishes
>
>
>
> On Mon, Feb 13, 2023 at 11:42 PM Ernie Rael <er...@raelity.com> wrote:
>
>> The sql stuff is not in the "java.base" module; there are separate
>> modules for the sql stuff. I don't use modules, but I'm guessing the
>> problem is how your app (not NetBeans) is configured.
>>
>> -ernie
>>
>> On 23/02/13 9:45 AM, Amitabh Choudhury wrote:
>> > Hello
>> >
>> > This is in continuation of my previous mail related to Netbeans 14.
>> >
>> > Got aware that Netbeans 14 isn't supported, so downloaded Netbeans 16
>> > and configured with Java 18.
>> >
>> > Created Ant project and checked java.base.
>> > java.sql is missing in this as well.
>> >
>> > Please guide to configure Netbeans 16 to include java.sql in java.base
>> > module of Default Library.
>> > Images attached ...
>> >
>> > Warm wishes
>> >
>> > ~~~
>> > Amitabh Choudhury
>> >
>> > ---------------------------------------------------------------------
>> > To unsubscribe, e-mail: users-unsubscribe@netbeans.apache.org
>> > For additional commands, e-mail: users-help@netbeans.apache.org
>> >
>> > For further information about the NetBeans mailing lists, visit:
>> > https://cwiki.apache.org/confluence/display/NETBEANS/Mailing+lists
>>
>>
>>
>> ---------------------------------------------------------------------
>> To unsubscribe, e-mail: users-unsubscribe@netbeans.apache.org
>> For additional commands, e-mail: users-help@netbeans.apache.org
>>
>> For further information about the NetBeans mailing lists, visit:
>> https://cwiki.apache.org/confluence/display/NETBEANS/Mailing+lists
>>
>>

Re: java.sql missing from java.base in Netbeans 16 JDK 18 defaults

Posted by Amitabh Choudhury <am...@gmail.com>.
Hi Ernie (and others)

Have used all default configurations. There is java.sql module. That is
being displayed in "Java Platform Manager" but not getting displayed in
"Libraries" of the Ant application. Screenshots are attached.
All settings are defaults.

So, the action required is to include the java.sql module in the Libraries
of the application. Even though it is in Java Platform Manager, its missing
in the default libraries.

Please guide.

Warm wishes



On Mon, Feb 13, 2023 at 11:42 PM Ernie Rael <er...@raelity.com> wrote:

> The sql stuff is not in the "java.base" module; there are separate
> modules for the sql stuff. I don't use modules, but I'm guessing the
> problem is how your app (not NetBeans) is configured.
>
> -ernie
>
> On 23/02/13 9:45 AM, Amitabh Choudhury wrote:
> > Hello
> >
> > This is in continuation of my previous mail related to Netbeans 14.
> >
> > Got aware that Netbeans 14 isn't supported, so downloaded Netbeans 16
> > and configured with Java 18.
> >
> > Created Ant project and checked java.base.
> > java.sql is missing in this as well.
> >
> > Please guide to configure Netbeans 16 to include java.sql in java.base
> > module of Default Library.
> > Images attached ...
> >
> > Warm wishes
> >
> > ~~~
> > Amitabh Choudhury
> >
> > ---------------------------------------------------------------------
> > To unsubscribe, e-mail: users-unsubscribe@netbeans.apache.org
> > For additional commands, e-mail: users-help@netbeans.apache.org
> >
> > For further information about the NetBeans mailing lists, visit:
> > https://cwiki.apache.org/confluence/display/NETBEANS/Mailing+lists
>
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@netbeans.apache.org
> For additional commands, e-mail: users-help@netbeans.apache.org
>
> For further information about the NetBeans mailing lists, visit:
> https://cwiki.apache.org/confluence/display/NETBEANS/Mailing+lists
>
>

Re: java.sql missing from java.base in Netbeans 16 JDK 18 defaults

Posted by Ernie Rael <er...@raelity.com>.
The sql stuff is not in the "java.base" module; there are separate 
modules for the sql stuff. I don't use modules, but I'm guessing the 
problem is how your app (not NetBeans) is configured.

-ernie

On 23/02/13 9:45 AM, Amitabh Choudhury wrote:
> Hello
>
> This is in continuation of my previous mail related to Netbeans 14.
>
> Got aware that Netbeans 14 isn't supported, so downloaded Netbeans 16 
> and configured with Java 18.
>
> Created Ant project and checked java.base.
> java.sql is missing in this as well.
>
> Please guide to configure Netbeans 16 to include java.sql in java.base 
> module of Default Library.
> Images attached ...
>
> Warm wishes
>
> ~~~
> Amitabh Choudhury
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@netbeans.apache.org
> For additional commands, e-mail: users-help@netbeans.apache.org
>
> For further information about the NetBeans mailing lists, visit:
> https://cwiki.apache.org/confluence/display/NETBEANS/Mailing+lists



---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@netbeans.apache.org
For additional commands, e-mail: users-help@netbeans.apache.org

For further information about the NetBeans mailing lists, visit:
https://cwiki.apache.org/confluence/display/NETBEANS/Mailing+lists