Skip to main content

Simple Newbie Question

3 replies [Last post]
ziwy
Offline
Joined: 2007-08-09

When i run the first time a jxta program, the jxta configurator start.
then i have to enter my name and two times my password.

Now the question...

In the code, which variable tell me the name that I insert in the jxta configurator?

Reply viewing options

Select your preferred way to display the comments and click "Save settings" to activate your changes.
ziwy
Offline
Joined: 2007-08-09

I don't want an autoconfigurator. I use the Jxta configurator.
I want to save the PeerName in a variable so I can use that String...

I need to know how to save the PeerName that I enter in the JXTA Configurator.

anegri
Offline
Joined: 2007-07-26

Make a properties file for you application and stored it there.

anegri
Offline
Joined: 2007-07-26

Usually there is a startJxta method that contains something similar to the following:

try {
System.setProperty("net.jxta.tls.principal", "server");
System.setProperty("net.jxta.tls.password", "password");
System.setProperty("JXTA_HOME", System.getProperty("JXTA_HOME", "server"));
File home = new File(System.getProperty("JXTA_HOME", "server"));
if (!JxtaSocketExample.configured(home)) {
JxtaSocketExample.createConfig(home, "JxtaServerSocketExample", true);
}

// create, and Start the default jxta NetPeerGroup
netPeerGroup = PeerGroupFactory.newNetPeerGroup();
//JxtaSocketExample.login(netPeerGroup, "server", "password");
} catch (PeerGroupException e) {
// could not instantiate the group, print the stack and exit
System.out.println("fatal error : group creation failure");
e.printStackTrace();
System.exit(1);
}

I think here is where the username and password are set before displaying the dialog. Also if you try using the NetworkManager instead you can avoid the dialog, such as the following:

try {
File home = new File(JXTA_PATH);
home.mkdirs();
manager = new NetworkManager(NetworkManager.ConfigMode.ADHOC, JXTA_NAME,
home.toURI());
manager.startNetwork();
} catch (Exception e) {
e.printStackTrace();
System.exit(-1);
}

netPeerGroup = manager.getNetPeerGroup();

if (waitForRendezvous) {
manager.waitForRendezvousConnection(0);
}