Dear Geertjan,
OK, I've read up on modules and written my first Hello World program which
compiles and runs fine using NetBeans. However, it doesn't run from a command
line, even after I've removed the mistakes in the Ant-generated suggestion:
D:\>"C:\Program Files\Java\jdk-12.0.1/bin/java" --module-path
D:\Peter\Netbeans\TestModules1\build\modules com.ptoye.greetings.Main
Picked up _JAVA_OPTIONS: -Djava.net.preferIPv4Stack=true
Error: Could not find or load main class com.ptoye.greetings.Main
Caused by: java.lang.ClassNotFoundException: com.ptoye.greetings.Main
The main class is:
package com.ptoye.greetings;
????import com.ptoye.astro.World;
??public class Main {??
public static void main(String[] args) {
?? System.out.format("Greetings %s!%n", World.name());
?? }
??}??
Where does one go from here? I'm using the Oracle version of Java, Would
OpenJDK make any difference? AFAICS it's the same.
Thanks for the mailing list link. I looked at them but they all seem to be
oriented towards people developing OpenJDK rather than users. There isn't a
"support" or "help" link on the OpenJDK site.
Best regards,
Peter
mailto:[email protected]
www.ptoye.com
-------------------------
Monday, October 14, 2019, 10:18:27 AM, you wrote:
On Mon, Oct 14, 2019 at 11:16 AM Peter Toye <[email protected]> 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