Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > Java > where to have same user.home path or share same properties

Reply
Thread Tools

where to have same user.home path or share same properties

 
 
John_Woo
Guest
Posts: n/a
 
      07-21-2006
Hi,

if an app writes to a file, the location may be user.home, in Windowns
it is okay, but in unix, different user have different full-path.

I'm wondering, what's the idea to have unique full-path, which is
cross-platform? That way same app, event executed twice/more at the
same time in same machine, can share same file.

or, better idea to have same app run in different JVM <same machine>
share a properties, like System.getProperties("my app") always return
same value? -- it may be done by socket, rmi,..but it doesn't sound
good.

--
Thanks
John
Toronto

 
Reply With Quote
 
 
 
 
Steve W. Jackson
Guest
Posts: n/a
 
      07-21-2006
In article < om>,
"John_Woo" <> wrote:

> Hi,
>
> if an app writes to a file, the location may be user.home, in Windowns
> it is okay, but in unix, different user have different full-path.


In Windows 98, every user's home directory is in the same location. In
newer versions, each user account has a home directory of its own just
as in Unix (and they could be shared among users, as they also could in
Unix).

> I'm wondering, what's the idea to have unique full-path, which is
> cross-platform? That way same app, event executed twice/more at the
> same time in same machine, can share same file.


I suggest you check out the Java Preferences API as one possible
solution. It allows user-level preferences or system-level preferences
to be created and maintained. Where the information is stored for these
is system-dependent and transparent to your application. In Windows,
it's typically in the Registry. In the Linux system I've used, it's in
a user's .java/.userPrefs directory structure. On Mac OS X, it's in a
PList file in the user's own ~/Library/Preferences directory.

> or, better idea to have same app run in different JVM <same machine>
> share a properties, like System.getProperties("my app") always return
> same value? -- it may be done by socket, rmi,..but it doesn't sound
> good.
>
> --
> Thanks
> John
> Toronto


From the last part, I'm not quite clear on what it is you really want to
accomplish, so I can't offer much more than I have above.

= Steve =
--
Steve W. Jackson
Montgomery, Alabama
 
Reply With Quote
 
 
 
 
John_Woo
Guest
Posts: n/a
 
      07-21-2006

Steve W. Jackson wrote:
> In article < om>,
> "John_Woo" <> wrote:
>
> > Hi,
> >
> > if an app writes to a file, the location may be user.home, in Windowns
> > it is okay, but in unix, different user have different full-path.

>
> In Windows 98, every user's home directory is in the same location. In
> newer versions, each user account has a home directory of its own just
> as in Unix (and they could be shared among users, as they also could in
> Unix).
>
> > I'm wondering, what's the idea to have unique full-path, which is
> > cross-platform? That way same app, event executed twice/more at the
> > same time in same machine, can share same file.

>
> I suggest you check out the Java Preferences API as one possible
> solution. It allows user-level preferences or system-level preferences
> to be created and maintained. Where the information is stored for these
> is system-dependent and transparent to your application. In Windows,
> it's typically in the Registry. In the Linux system I've used, it's in
> a user's .java/.userPrefs directory structure. On Mac OS X, it's in a
> PList file in the user's own ~/Library/Preferences directory.
>
> > or, better idea to have same app run in different JVM <same machine>
> > share a properties, like System.getProperties("my app") always return
> > same value? -- it may be done by socket, rmi,..but it doesn't sound
> > good.
> >
> > --
> > Thanks
> > John
> > Toronto

>
> From the last part, I'm not quite clear on what it is you really want to
> accomplish, so I can't offer much more than I have above.
>
> = Steve =
> --
> Steve W. Jackson
> Montgomery, Alabama


Thanks Steve.

Can you tell how to make java app write an entry to Registry <for
windows os>?

the last question was: any simple way for an app to set system
properties, and other app <event though same app, but running in other
folder> can get this properties?

--
John

 
Reply With Quote
 
Steve W. Jackson
Guest
Posts: n/a
 
      07-21-2006
In article <. com>,
"John_Woo" <> wrote:

[ snip ]

> Thanks Steve.
>
> Can you tell how to make java app write an entry to Registry <for
> windows os>?
>
> the last question was: any simple way for an app to set system
> properties, and other app <event though same app, but running in other
> folder> can get this properties?
>
> --
> John


I gave you the clue to what I was suggesting in the earlier post, which
is the use of Preferences in Java (introduced in 1.4).

<http://java.sun.com/j2se/1.4.2/docs/...eferences.html
>


<http://java.sun.com/j2se/1.5.0/docs/...eferences.html
>


You might use the static systemNodeForPackage method there, for example.
If you have a class at com.acme.myclass, the system-level preference
node would be created for "com.acme". On Windows, it happens that the
stored preference data would be in the Registry. But that's not really
important. What is important is that information can be placed there
once and then is accessible to other users in the same way to read it.

A warning is in order, though, if you want to use this for communication
between running applications. It's not a good idea and may not work
reliably.

And Preferences may still not be the best solution for whatever problem
you're actually trying to solve, which you haven't actually said clearly
so far.
--
Steve W. Jackson
Montgomery, Alabama
 
Reply With Quote
 
 
 
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Share-Point-2010 ,Share-Point -2010 Training , Share-point-2010Hyderabad , Share-point-2010 Institute Saraswati lakki ASP .Net 0 01-06-2012 06:39 AM
The properties for the Img1 element do not have the additional RoundedCornersExtender properties. AAaron123 ASP .Net 2 10-07-2009 12:34 PM
same object share same static variable??? Mug C++ 4 09-03-2009 12:51 PM
Designer Support: How to have user control's properties appear in IDE's properties window? Max2006 ASP .Net 2 07-13-2007 01:45 PM
Is it possible to have two VPNs share the same IP address on pix 501 awade@gulfstatesmanufacturers.com Cisco 1 05-10-2006 09:37 PM



Advertisments
 



1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57