Re: [JXTA discuss] [ext.config] JXTA_HOME trouble

Michele Amoretti <[email protected]> Tue, 21 Feb 2006 14:50:30 +0100
Newsgroups gmane.comp.java.jxta.general
Message-ID <[email protected]>
For the Murphy's Law, I found the solution JUST after posting on the mailing 
list.

I post here the solution, hope this help also other people:

...........

	String userdir = System.getProperty("user.dir");  // <------ 

	URI jh = null;
 
	try {
	    jh = new URI("file://" + userdir + "/.jxta"); 
	} 
	catch (URISyntaxException use) {
	    use.printStackTrace();
	}
	
	if (jh != null) {
	
	    System.setProperty("JXTA_HOME", jh.getPath());
	
	    Profile peerProfile = null;
	    Configurator c = null;
	    
	    try {
		peerProfile = ....		
		c = new Configurator(jh, peerProfile);

.............


Bye!





On Tuesday 21 February 2006 14:38, Michele Amoretti wrote:
> Hello,
>
> I am trying to use the auto-conf with jxta 2.3.6. I have a problem, since I
> want to create several folders, each one with its .jxta/config.properties.
> I have to pass the "/path/to/.jxta" to the Configurator constructor, i.e.
>
> .........
>
> 	URI jh = null;
>
> 	try {
> 	    jh = new URI("file:///path/to/.jxta");
> 	}
> 	catch (URISyntaxException use) {
> 	    use.printStackTrace();
> 	}
>
>         c = new Configurator(jh, peerProfile);
>
> ........
>
> Now, how can tell the URI that .jxta is in the local folder (i.e., in .)?
>
> I tried with jh = new URI("file:///./.jxta"); and so on, but nothing seems
> to work. And I do not want to set an absolute path...
>
>
> p.s. if I do not declare the path to .jxta, the platform uses by default
> ~/.jxta, which is absolutely ugly! I do not understand why, with 2.3.6
> release, the default behaviour did changed...
>
>
> Thank you