aspose file tools
The moose likes Java in General and the fly likes Detecting Startup Folder on Windows Big Moose Saloon
  Search | Java FAQ | Recent Topics
Register / Login


Win a copy of The Mikado Method this week in the Agile and other Processes forum!
JavaRanch » Java Forums » Java » Java in General
Reply Bookmark "Detecting Startup Folder on Windows" Watch "Detecting Startup Folder on Windows" New topic
Author

Detecting Startup Folder on Windows

Jim Bruno Goldberg
Greenhorn

Joined: Dec 18, 2009
Posts: 4
Hi, folks.

I known that it should be a dumb question but...you known...I really do not find the answer....
How do I detect the Startup Folder on Windows using Java?
Yes, I am working on a platform dependent software but trying to avoid native binarys.
Thanks.
Rob Spoor
Sheriff

Joined: Oct 27, 2005
Posts: 19216

You can't avoid system-specific code. That may be calling an external tool, or use a native library, but in the end you will need a different piece of code for each different system.


SCJP 1.4 - SCJP 6 - SCWCD 5
How To Ask Questions How To Answer Questions
Jim Bruno Goldberg
Greenhorn

Joined: Dec 18, 2009
Posts: 4
Rob Prime wrote:You can't avoid system-specific code. That may be calling an external tool, or use a native library, but in the end you will need a different piece of code for each different system.


Ok. I am focusing Windows now.
How can I locate it in windows? I check calls like System.getProperty(); or System.getEnv(); but there is no pointer to this on System class.
(Actually, I discover the "user.home" using this but no clue about the physical location on startup folder.) Thanks for any help.
Rob Spoor
Sheriff

Joined: Oct 27, 2005
Posts: 19216

SHGetFolderPath. Yes, that's a Windows API call, but that's the only way I know of to get the start up folder regardless of language or where a user may have moved it to.
Jim Bruno Goldberg
Greenhorn

Joined: Dec 18, 2009
Posts: 4
Rob Prime wrote:SHGetFolderPath. Yes, that's a Windows API call, but that's the only way I know of to get the start up folder regardless of language or where a user may have moved it to.


Do you known how I use it through Java?

May you send me some java code samples?
Thanks.
Rob Spoor
Sheriff

Joined: Oct 27, 2005
Posts: 19216

Check out how JNI works. You can find several useful links on Google, and also by using the search here. I'd search the Other JSE/JEE APIs and Java in General forums in particular.
Jim Bruno Goldberg
Greenhorn

Joined: Dec 18, 2009
Posts: 4
Rob Prime wrote:Check out how JNI works. You can find several useful links on Google, and also by using the search here. I'd search the Other JSE/JEE APIs and Java in General forums in particular.

I will. Thank you.
Campbell Ritchie
Sheriff

Joined: Oct 13, 2005
Posts: 32675
    
    4
Rob Prime wrote:. . . I'd search the Other JSE/JEE APIs and Java in General forums in particular.
so I shall move this thread. Probably JiG. Thank you, Rob
 
I agree. Here's the link: http://ej-technologies/jprofiler - if it wasn't for jprofiler, we would need to run our stuff on 16 servers instead of 3.
 
subject: Detecting Startup Folder on Windows
 
Similar Threads
Adding an exe to startup
How to automaticlly start an application
How do I get startup programmes
graceful windows command line shutdown
Start when windows starts