On Mon, Oct 14, 2019 at 11:16 AM Peter Toye <netbe...@ptoye.com> wrote:
> Dear Geertjan, > > I agree that the "java" command has nothing to do with Netbeans. I'll try > to be more explicit: > > I have a project which dates back to about 2006 and has a main class which > I'll call A. This uses a separate class B which I developed separately. I > included B as a library using A's project properties. > > Using Netbeans 8 (and earlier) it was possible to run the project using a > command line like > java -jar A.jar > and the program ran. The Java version was 1.8. The path to the Java > executable is in my PATH. > > Earlier this year I wanted to develop it further, and decided to move to > the latest version of NetBeans (11.1) and Java (12). Now the command line > as given in the build output is > C:\Program Files\Java\jdk-12.0.1/bin/java -cp *directory\*A.jar; > *directory\*B.jar *classpath.*A > > My main point is that I don't understand how or why this has changed. > https://openjdk.java.net/projects/jigsaw/ There is now a module system in Java, meaning that there is now a module path and a class path. That was not there in JDK 8 and is now there since then. Can you join the Java mailing lists and discuss further there: https://mail.openjdk.java.net/mailman/listinfo Gj > I agree that Oracle no longer have a JAVA_HOME environment variable to > point to the java run-time executable and they don't put it in the PATH, > which is a pain, but I can do that myself. > > But as far as I can see, the "Libraries" sections of "project properties" > are identical for the NB8 and NB11 projects, with a few directory changes. > So why is the command line different? Is this a Java issue or has someting > changed in the way that NB builds its jar files? > > And also, the NB11.1 command line as given by Ant is incorrect - the Java > program path needs quotes because of the space in the path. A minor bug, > but annoying when you use cut-and-paste to put it into a batch file! > > > Does this clear things up? > > Best regards, > > Peter > mailto:netbe...@ptoye.com > www.ptoye.com > > ------------------------- > Sunday, October 13, 2019, 7:47:57 PM, you wrote: > > > > > You appear to be talking about the “java” command line below, which has > nothing at all to do with NetBeans. You seen to be using different versions > of Java. > > Gj > > > On Fri, 20 Sep 2019 at 16:44, Peter Toye <netbe...@ptoye.com> wrote: > > Having just moved from NB version 8 to 11.1 there seems to have been a > change in the command line needed to run a project. > > The OS is Windows 7 Home. > > The project has two external libraries: one in the Java modules in the > NetBeans 11 directory, and one of my own. In version 8 it was possible to > run the program with a command line like > > java -jar program.jar > > but this no longer works, and I have to put in a command line like > > java -cp library paths program.jar > > which is a pain, as I can't automate that into a batch file. > > Is there any way of getting the libraries (or references to them) included > in the jar file? The properties|Libraries|Run tab shows that the classpaths > for Compiling Sources and Compiled Sources are included (at least as I > understand the symbols on that page). Does the "Build Dependencies" tickbox > have any significance here? The lack of a help file means that I can't find > out what most of the window items actually mean. > > As a rider to this question, there seems to be two small bugs in the Ant > script which produces the command line for running the project : > > To run this application from the command line without Ant, try: > ??C:\Program Files\Java\jdk-12.0.1/bin/java -cp C:\Program Files\NetBeans > 11\netbeans\java\modules\ext\AbsoluteLayout.jar;D:\Peter\Netbeans\Partitions511\dist\Partitions511.jar;D:\Peter\Netbeans\KillerSudoku11\dist\KillerSudoku11.jar > com.ptoye.TestKiller.TestKiller?? > > 1) In Windows, the Java executable and Netbeans are in the "Program Files" > or "Program Files (x86)" folder. This should have quotes round it to run > successfully. > > 2) In NB 11.1, the output mentions "Netbeans 11" - Shouldn't this be > C:\Program Files\NetBeans-11.1? > > Regards, > > Peter > mailto:netbe...@ptoye.com <netbe...@ptoye.com> > www.ptoye.com >