0

I am working on a Warlords game, based on JavaFX, where I am making a LAN version (client-server) from a single-machine one.

The problem is that I cannot input the program arguments with the same way as in a classical Java project. Plus, I have no problems for passing arguments in command line (including JavaFX projects), like :

$ java -classpath Classes/ warlords.client.game.Main --address=127.0.0.1 --name=Barspicer9

But when I run the project from Netbeans, it looks like the arguments are not handled properly. For example :

String ipAddress = "localhost";
static String player = "anonimus";

for (String arg : args) {
    // Check if the current argument begins with "--address=" or "--name="
    if (arg.startsWith("--address=")) {
        // 10 characters before server address
        ipAddress = arg.substring(10);
    } 
    else if (arg.startsWith("--name=")) {
        // 7 characters before player name
        player = arg.substring(7);
    }
}

The server terminal outputs (with the arguments specified above):

Player connected : "anonimus"

And the client terminal outputs :

Trying to connect to the server : rmi://localhost/TestServeur ... 
Connection done

There is the configuration window on a classic Java project : Classic Java - Project Properties

And there is the configuration window on a JavaFX project : JavaFX - Project Properties

The "Arguments" does not displayed in the second window, instead there is another field named "Parameters", but not directly editable. Is it an equivalent to the "Arguments" field in the first window ? How can I input these arguments, if the "Parameters" field in the second window is not equivalent ?

Thanks in advance.

0 Answers0