Dear Geertjan,

Thanks again. I'd found that page, and the code I produced was a copy of the 
code there. It seems that  a "-m" option is needed to indicate the main class.
It still gives problems, but I'll try your suggestion of trying to join the 
openJDK mailing list.

So the Ant script output now has three bugs:

No double quotes round the Java executable directory "Program Files"
"-module-path" should read "--module-path"
"-m" needed before the main class.

Why the Java designer can't just stick to a single syntax is beyond me.....

Best regards,

Peter
mailto:netbe...@ptoye.com
www.ptoye.com

-------------------------
Monday, October 21, 2019, 9:07:54 AM, you wrote:


https://openjdk.java.net/projects/jigsaw/quick-start

That should help, it includes the java command line syntax you're looking for.

Gj

On Sun, Oct 20, 2019 at 11:21 PM Geertjan Wielenga <geert...@apache.org> wrote:

To be honest, I'd love to help but I'm not going to spend any time guessing 
about your application, you're going to need to provide a way to access it, 
e.g., put it on GitHub, so that it can be downloaded, e.g., sorry, "import 
com.ptoye.astro.World", no idea what that is, and please do not try to explain 
-- just take your application and put it on GitHub or somewhere else (please 
not as a ZIP file) and then I'll be happy to help.

Indeed, yes, it would be very useful to everyone if you'd join the openjdk 
mailing lists and explain the problems you're having running java on the 
command line -- they need to know that otherwise they'll never hear from you 
and never make it work the way you'd like.

Gj



On Sun, Oct 20, 2019 at 8:10 PM Peter Toye <netbe...@ptoye.com> wrote:

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:netbe...@ptoye.com
www.ptoye.com

-------------------------
Monday, October 14, 2019, 10:18:27 AM, you wrote:






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

Reply via email to