JOOQ Generation Netbeans 9

18 views
Skip to first unread message

sumner_...@yahoo.com

unread,
Jan 29, 2019, 2:50:17 PM1/29/19
to jOOQ User Group
I am a Netbeans user looking to adopt JOOQ 3.11.7 for my project.  I can't figure out how to use Netbeans for the class generation.  Does anyone have or know of a NB generation tool project I can look at.  The manual only cites an eclipse project which doesn't seem to translate.

Lukas Eder

unread,
Jan 31, 2019, 5:26:07 AM1/31/19
to jooq...@googlegroups.com
Hi there,

What's not working for you?

Cheers,
Lukas

On Tue, Jan 29, 2019 at 8:50 PM sumner_andrews via jOOQ User Group <jooq...@googlegroups.com> wrote:
I am a Netbeans user looking to adopt JOOQ 3.11.7 for my project.  I can't figure out how to use Netbeans for the class generation.  Does anyone have or know of a NB generation tool project I can look at.  The manual only cites an eclipse project which doesn't seem to translate.

--
You received this message because you are subscribed to the Google Groups "jOOQ User Group" group.
To unsubscribe from this group and stop receiving emails from it, send an email to jooq-user+...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Sumner R Andrews Jr

unread,
Jan 31, 2019, 1:10:14 PM1/31/19
to jooq...@googlegroups.com

Lukas,

 

Thank you for your reply.  My goal is to create a netbeans project I can run dynamically to generate JOOQ code classes.  I reviewed the Eclipse manual suggestion which passes the directory reference to the code generator as an argument.  At a minimum, I want to do the same with nb.  However, I haven’t found an argument setting.  Therefore, I loaded in the required libraries and looked for ways to call the appropriate class methods such as GenerationTool generate or some such. Still working on that. Hasn’t someone done this with nb previously?

 

Sent from Sumner Andrews

Rob Sargent

unread,
Jan 31, 2019, 1:16:52 PM1/31/19
to jooq...@googlegroups.com
Are you not using any of maven, ivy, gradle or other similar tool?  Do you have a command-line build at all?

Sumner R Andrews Jr

unread,
Jan 31, 2019, 2:16:51 PM1/31/19
to jooq...@googlegroups.com

Rob,

 

No.  nb uses ant which during this development effort is sufficient.  Have not dipped into any of the others.  Please keep in mind that I have never worked with JOOQ before but see it becoming a go to on all my projects.

 

  However, I put together a command line process from the manual which produces the following:

 

sumner@sumner-System-Product-Name:~/JNB/generatedcode/jooq$ java -cp jooq-3.11.7.jar;jooq-meta-3.11.7.jar;jooq-codegen-3.11.7.jar;postgresql-42.2.5.jar;org.jooq.codegen.GenerationTool /jooqsradb.xml

Usage: java [options] <mainclass> [args...]

           (to execute a class)

   or  java [options] -jar <jarfile> [args...]

           (to execute a jar file)

   or  java [options] -m <module>[/<mainclass>] [args...]

       java [options] --module <module>[/<mainclass>] [args...]

           (to execute the main class in a module)

 

Arguments following the main class, -jar <jarfile>, -m or --module

<module>/<mainclass> are passed as the arguments to main class.

 

where options include:

 

    -zero   to select the "zero" VM

    -cp <class search path of directories and zip/jar files>

    -classpath <class search path of directories and zip/jar files>

    --class-path <class search path of directories and zip/jar files>

                  A : separated list of directories, JAR archives,

                  and ZIP archives to search for class files.

    -p <module path>

    --module-path <module path>...

                  A : separated list of directories, each directory

                  is a directory of modules.

    --upgrade-module-path <module path>...

                  A : separated list of directories, each directory

                  is a directory of modules that replace upgradeable

                  modules in the runtime image

    --add-modules <module name>[,<module name>...]

                  root modules to resolve in addition to the initial module.

                  <module name> can also be ALL-DEFAULT, ALL-SYSTEM,

                  ALL-MODULE-PATH.

    --list-modules

                  list observable modules and exit

    -d <module name>

    --describe-module <module name>

                  describe a module and exit

    --dry-run     create VM and load main class but do not execute main method.

                  The --dry-run option may be useful for validating the

                  command-line options such as the module system configuration.

    --validate-modules

                  validate all modules and exit

                  The --validate-modules option may be useful for finding

                  conflicts and other errors with modules on the module path.

    -D<name>=<value>

                  set a system property

    -verbose:[class|module|gc|jni]

                  enable verbose output

    -version      print product version to the error stream and exit

    --version     print product version to the output stream and exit

    -showversion  print product version to the error stream and continue

    --show-version

                  print product version to the output stream and continue

    --show-module-resolution

                  show module resolution output during startup

    -? -h -help

                  print this help message to the error stream

    --help        print this help message to the output stream

    -X            print help on extra options to the error stream

    --help-extra  print help on extra options to the output stream

    -ea[:<packagename>...|:<classname>]

    -enableassertions[:<packagename>...|:<classname>]

                  enable assertions with specified granularity

    -da[:<packagename>...|:<classname>]

    -disableassertions[:<packagename>...|:<classname>]

                  disable assertions with specified granularity

    -esa | -enablesystemassertions

                  enable system assertions

    -dsa | -disablesystemassertions

                  disable system assertions

    -agentlib:<libname>[=<options>]

                  load native agent library <libname>, e.g. -agentlib:jdwp

                  see also -agentlib:jdwp=help

    -agentpath:<pathname>[=<options>]

                  load native agent library by full pathname

    -javaagent:<jarpath>[=<options>]

                  load Java programming language agent, see java.lang.instrument

    -splash:<imagepath>

                  show splash screen with specified image

                  HiDPI scaled images are automatically supported and used

                  if available. The unscaled image filename, e.g. image.ext,

                  should always be passed as the argument to the -splash option.

                  The most appropriate scaled image provided will be picked up

                  automatically.

                  See the SplashScreen API documentation for more information

    @argument files

                  one or more argument files containing options

    -disable-@files

                  prevent further argument file expansion

To specify an argument for a long option, you can use --<name>=<value> or

--<name> <value>.

 

jooq-meta-3.11.7.jar: command not found

jooq-codegen-3.11.7.jar: command not found

postgresql-42.2.5.jar: command not found

org.jooq.codegen.GenerationTool: command not found

 

 

This is my xml file:

 

<?xml version="1.0" encoding="UTF-8" standalone="yes"?>

<configuration xmlns="http://www.jooq.org/xsd/jooq-codegen-3.11.0.xsd">

  <!-- Configure the database connection here -->

  <jdbc>

    <driver>"org.postgresql.Driver"</driver>

    <url>"jdbc:postgresql://localhost/sradb"</url>

    <user>"sumner"</user>

    <password>"blanked"</password>

   

    <!-- You can also pass user/password and other JDBC properties in the optional properties tag: -->

    <properties>

      <property><key>user</key><value>"sumner"</value></property>

      <property><key>password</key><value>"blanked"</value></property>

    </properties>

  </jdbc>

 

  <generator>

    <database>

     

      <name>org.jooq.meta.postgres.PostgresDatabase</name>

 

      <includes>.*</includes>

 

      <!-- All elements that are excluded from your schema (A Java regular expression.

           Use the pipe to separate several expressions). Excludes match before

           includes, i.e. excludes have a higher priority -->

      <excludes>

           UNUSED_TABLE                # This table (unqualified name) should not be generated

         | PREFIX_.*                   # Objects with a given prefix should not be generated

         | SECRET_SCHEMA\.SECRET_TABLE # This table (qualified name) should not be generated

         | SECRET_ROUTINE              # This routine (unqualified name) ...

      </excludes>

 

      <!-- The schema that is used locally as a source for meta information.

           This could be your development schema or the production schema, etc

           This cannot be combined with the schemata element.

 

           If left empty, jOOQ will generate all available schemata. See the

           manual's next section to learn how to generate several schemata -->

      <inputSchema>[your database schema / owner / name]</inputSchema>

    </database>

 

    <generate>

      <!-- Generation flags: See advanced configuration properties -->

    </generate>

 

    <target>

      <!-- The destination package of your generated classes (within the

           destination directory)

          

           jOOQ may append the schema name to this package if generating multiple schemas,

           e.g. org.jooq.your.packagename.schema1

                org.jooq.your.packagename.schema2 -->

      <packageName>[org.jooq.your.packagename]</packageName>

 

      <!-- The destination directory of your generated classes -->

      <directory>"/home/sumner/JNB/generatedcode/jooq/sradb"</directory>

    </target>

  </generator>

</configuration>

 

My directory is this:

 

 

Sent from Sumner Andrews

--
You received this message because you are subscribed to a topic in the Google Groups "jOOQ User Group" group.
To unsubscribe from this topic, visit https://groups.google.com/d/topic/jooq-user/Epax4tJW4RI/unsubscribe.
To unsubscribe from this group and all its topics, send an email to jooq-user+...@googlegroups.com.

Rob Sargent

unread,
Jan 31, 2019, 2:21:10 PM1/31/19
to jooq...@googlegroups.com
I would say your classpath needs full paths (d:/...jar) or you need to work in the directory with the jars (but that’s a bad idea generally). 

<A3406CCB5B164B70A646C1B0E71CCEEF.jpg>
<A3406CCB5B164B70A646C1B0E71CCEEF.jpg>

Rob Sargent

unread,
Jan 31, 2019, 2:22:28 PM1/31/19
to jooq...@googlegroups.com
Wait, maybe you’re not on a PC? the classpath separator is “:” 

<A3406CCB5B164B70A646C1B0E71CCEEF.jpg>
<A3406CCB5B164B70A646C1B0E71CCEEF.jpg>

Sumner R Andrews Jr

unread,
Jan 31, 2019, 2:32:49 PM1/31/19
to jooq...@googlegroups.com

I am running Ubuntu 18.04 Linux AMD 64

Rob Sargent

unread,
Jan 31, 2019, 2:42:13 PM1/31/19
to 'Sumner R Andrews Jr' via jOOQ User Group

The for sure you classpath separator is colon (:).  The bash command separator is semi-colon (;) and that's why you see those "command not found" for each of the jars

Rob Sargent

unread,
Jan 31, 2019, 2:43:14 PM1/31/19
to 'Sumner R Andrews Jr' via jOOQ User Group

You may still need the full path to those jars.  The should not be in you code tree.

Sumner R Andrews Jr

unread,
Jan 31, 2019, 3:29:48 PM1/31/19
to jooq...@googlegroups.com

Rob,

 

You are being pretty patient with me.  I have gotten past the java help warnings by more or less doing as recommended.  I should have mentioned that I am running java 1.10.

I think it may now be a syntax issue:

 

sumner@sumner-System-Product-Name:~/JNB/generatedcode/jooq$ java -cp /home/sumner/JNB/generatedcode/jooq/jooq-3.11.7.jar;jooq-meta-3.11.7.jar;jooq-codegen-3.11.7.jar;postgresql-42.2.5.jar;org.jooq.codegen.GenerationTool jooqsradb.xml

 

Error: Could not find or load main class jooq-3.11.7.jar

Caused by: java.lang.ClassNotFoundException: jooq-3.11.7.jar

jooq-meta-3.11.7.jar: command not found

jooq-codegen-3.11.7.jar: command not found

postgresql-42.2.5.jar: command not found

 

org.jooq.codegen.GenerationTool: command not found

Sent from Sumner Andrews

Rob Sargent

unread,
Jan 31, 2019, 3:37:26 PM1/31/19
to jooq...@googlegroups.com


On 1/31/19 1:29 PM, 'Sumner R Andrews Jr' via jOOQ User Group wrote:

Rob,

 

You are being pretty patient with me.  I have gotten past the java help warnings by more or less doing as recommended.  I should have mentioned that I am running java 1.10.

I think it may now be a syntax issue:

 

sumner@sumner-System-Product-Name:~/JNB/generatedcode/jooq$ java -cp /home/sumner/JNB/generatedcode/jooq/jooq-3.11.7.jar;jooq-meta-3.11.7.jar;jooq-codegen-3.11.7.jar;postgresql-42.2.5.jar;org.jooq.codegen.GenerationTool jooqsradb.xml

My old, tired eyes think they see semi-colons, not colons. Try the following

export CLASSPATH=/home/sumner/JNB/generatedcode/jooq/jooq-3.11.7.jar:/home/sumner/JNB/generatedcode/jooq/jooq-meta-3.11.7.jar:/home/sumner/JNB/generatedcode/jooq/jooq-codegen-3.11.7.jar:/home/sumner/JNB/generatedcode/jooq/postgresql-42.2.5.jar

java org.jooq.codegen.GenerationTool jooqsradb.xml

You may bump into trouble with the refactoring work (jigsaw) done after java 1.8.  I'm still using 1.8

Lukas Eder

unread,
Feb 1, 2019, 3:14:29 AM2/1/19
to jooq...@googlegroups.com
Thanks Rob. Indeed, on Unix/Linux systems, colons need to be used to separate classpath elements, not semi colons. Also, as Rob correctly mentioned, the jar files need full qualification each, not just the first one. Finally, there's a missing whitespace between your classpath and the org.jooq.codegen.GenerationTool class. This is not going to be an issue when you use the classpath environment variable as Rob suggested.

However, since you're using Ant, I would suggest you set up your classpath using Ant:

The examples are missing the JDBC driver, which you should add as well, of course.

I hope this helps,
Lukas

Reply all
Reply to author
Forward
0 new messages