Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > Java > find windows folder

Reply
Thread Tools

find windows folder

 
 
Bjorn Borud
Guest
Posts: n/a
 
      06-13-2005
["massimo visman" <(E-Mail Removed)>]
| Hi all! I have a question about Java and Windows systems...It's possible to
| obtain the exact path of windows installation folder using Java functions? I
| need this to be valid on different versions, from Win98 to WinXP

you could inspect the JVM system properties. specifically properties
like java.home. have a look at the Properties instance returned by
System.getProperties() on your various deployment platforms and see if
this at least can be used as a hint.

-Bjørn
 
Reply With Quote
 
 
 
 
massimo visman
Guest
Posts: n/a
 
      06-13-2005
Hi all! I have a question about Java and Windows systems...It's possible to
obtain the exact path of windows installation folder using Java functions? I
need this to be valid on different versions, from Win98 to WinXP

Thanks at all! Massimo


 
Reply With Quote
 
 
 
 
Lucy
Guest
Posts: n/a
 
      06-13-2005

"massimo visman" <(E-Mail Removed)> wrote in message
news:_Ogre.3482$(E-Mail Removed)...
> Hi all! I have a question about Java and Windows systems...It's possible

to
> obtain the exact path of windows installation folder using Java functions?

I
> need this to be valid on different versions, from Win98 to WinXP
>
> Thanks at all! Massimo
>

It is %windir%


 
Reply With Quote
 
Roland
Guest
Posts: n/a
 
      06-13-2005
On 13-6-2005 21:50, Lucy wrote:

> "massimo visman" <(E-Mail Removed)> wrote in message
> news:_Ogre.3482$(E-Mail Removed)...
>
>>Hi all! I have a question about Java and Windows systems...It's possible

>
> to
>
>>obtain the exact path of windows installation folder using Java functions?

>
> I
>
>>need this to be valid on different versions, from Win98 to WinXP
>>
>>Thanks at all! Massimo
>>

>
> It is %windir%
>
>

And in JRE 1.5 retrievable with:
System.getenv("windir");

In older JRE versions getenv(String) is deprecated and, when run, throws
an error, like:
java.lang.Error: getenv no longer supported, use properties and -D
instead: windir
--
Regards,

Roland de Ruiter
` ___ ___
`/__/ w_/ /__/
/ \ /_/ / \
 
Reply With Quote
 
Lucy
Guest
Posts: n/a
 
      06-13-2005

"Roland" <(E-Mail Removed)> wrote in message
news:42adeb2b$0$83537$(E-Mail Removed)4all.nl...
> On 13-6-2005 21:50, Lucy wrote:
>
> > "massimo visman" <(E-Mail Removed)> wrote in message
> > news:_Ogre.3482$(E-Mail Removed)...
> >
> >>Hi all! I have a question about Java and Windows systems...It's possible

> >
> > to
> >
> >>obtain the exact path of windows installation folder using Java

functions?
> >
> > I
> >
> >>need this to be valid on different versions, from Win98 to WinXP
> >>
> >>Thanks at all! Massimo
> >>

> >
> > It is %windir%
> >
> >

> And in JRE 1.5 retrievable with:
> System.getenv("windir");
>


on older can you try ....run("echo %windir%")....

I forget the syntax exactly.


 
Reply With Quote
 
Andrew Thompson
Guest
Posts: n/a
 
      06-14-2005
On Mon, 13 Jun 2005 14:33:30 GMT, massimo visman wrote:

> Hi all! I have a question about Java and Windows systems...


Why Windows specifically?

>..It's possible to
> obtain the exact path of windows installation folder using Java functions?


Why do you feel you need to know?

A lot of people misunderstand things like where to put their
own Java classes, or resource files like images and web pages
and such.
<http://www.physci.org/codes/javafaq.jsp#js>

In any case, you can get it this way..
<sscce>
public class JavaLocation {
public static void main(String[] args) {
Object o = new Object();
java.net.URL url =
o.getClass().getResource("/java/lang/Object.class");
// you can use the String methods to extract the path
System.out.println( url.toString() );
}
}
</sscce>

Note that yhis will throws security exceptions in unsigned
applets, unless the user is running IE and using the MSVM.

HTH

--
Andrew Thompson
http://www.PhySci.org/codes/ Web & IT Help
http://www.PhySci.org/ Open-source software suite
http://www.1point1C.org/ Science & Technology
http://www.LensEscapes.com/ Images that escape the mundane
 
Reply With Quote
 
Andrew Thompson
Guest
Posts: n/a
 
      06-14-2005
On Tue, 14 Jun 2005 12:06:06 GMT, Andrew Thompson wrote:

> A lot of people misunderstand things like where to put their
> own Java classes, or resource files like images and web pages
> and such.
> <http://www.physci.org/codes/javafaq.jsp#js>


Sorry, that link should have been.
<http://www.physci.org/codes/javafaq.jsp#path>

--
Andrew Thompson
http://www.PhySci.org/codes/ Web & IT Help
http://www.PhySci.org/ Open-source software suite
http://www.1point1C.org/ Science & Technology
http://www.LensEscapes.com/ Images that escape the mundane
 
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
How to exclude action of Find::Find::find in subdirectories withknown names? vdvorkin Perl Misc 3 02-14-2011 05:28 AM
How to exclude action of Find::Find::find in subdirectories withknown names? vdvorkin Perl Misc 0 02-10-2011 05:18 PM
SOLVED - windows xp rename folder within shared folder, notrefreshing window jameshanley39@yahoo.co.uk Computer Information 0 07-30-2008 06:33 PM
Find.find does not find orphaned links? Wybo Dekker Ruby 1 11-15-2005 02:50 PM
Can't copy Outlook Ex files in folder to Windows folder? Paul - xxx Computer Support 2 08-20-2003 03:06 AM



Advertisments