|
|
|
|
Welcome to the Java Forums.
You are currently viewing our boards as a guest which gives you limited access to view most discussions and access our other features. By joining our free community, you will:
- have access to post topics
- communicate privately with other members (PM)
- not see advertisements between posts
- have the possibility to earn one of our surprises if you are an active member
- access many other special features that will be introduced later.
Registration is fast, simple and absolutely free so please, join our community today!
If you have any problems with the registration process or your account login, please contact us.
|
|

04-23-2008, 03:57 AM
|
|
Member
|
|
Join Date: Dec 2007
Posts: 30
|
|
|
[SOLVED] Getting directory paths
Lots of computers have there main hardrive named C but some don't. Also, some users don't have the same My Pictures directory or Program Files directory. I was wondering if it's possible to find out what those paths are in order to make my programs more user friendly. I know the data is in the registry somewhere but I have no experience with getting that info with Java.
Last edited by Leprechaun : 04-23-2008 at 06:31 AM.
|
|

04-23-2008, 04:04 AM
|
 |
Moderator
|
|
Join Date: Jan 2008
Location: Dallas
Posts: 260
|
|
|
__________________
dont worry newbie, we got you covered.
|
|

04-23-2008, 05:29 AM
|
|
Member
|
|
Join Date: Dec 2007
Posts: 30
|
|
|
Those look like what I need. However, I'm pretty new to java and am having problems using them.
For example, I tried
System.out.println(user.dir);
but I got an error. I don't know if I need to import something, and if so I'm not sure what.
Last edited by Leprechaun : 04-23-2008 at 05:30 AM.
Reason: Added ;
|
|

04-23-2008, 06:07 AM
|
 |
Member
|
|
Join Date: Dec 2007
Posts: 15
|
|
|
You should use:
System.out.println(System.getProperty("user.dir")) ;
|
|

04-23-2008, 06:16 AM
|
 |
Moderator
|
|
Join Date: Jul 2007
Location: Colombo, Sri Lanka
Posts: 3,039
|
|
|
Leprechaun, I think you worked on a Java IDE. Because almost all IDEs prompt that error. You can get an idea why it is wrong just looking at the error message.
__________________
Use an appropriate Subject. "Help, urgent!" isn't one. To view links or images in signatures your post count must be 10 or greater. You currently have 0 posts.
Has someone helped you? Then you can To view links or images in signatures your post count must be 10 or greater. You currently have 0 posts. their helpful post.
Want to make your IDE the best? To view links or images in signatures your post count must be 10 or greater. You currently have 0 posts.
To view links or images in signatures your post count must be 10 or greater. You currently have 0 posts. To view links or images in signatures your post count must be 10 or greater. You currently have 0 posts. (Close on September 4, 2008)
To view links or images in signatures your post count must be 10 or greater. You currently have 0 posts.
|
|

04-23-2008, 06:22 AM
|
|
Member
|
|
Join Date: Dec 2007
Posts: 30
|
|
|
Working now...
You should use:
System.out.println(System.getProperty("user.dir")) ;
Thanks, that works.
Leprechaun, I think you worked on a Java IDE. Because almost all IDEs prompt that error. You can get an idea why it is wrong just looking at the error message.
I did see that but didn't know what to do. It said it didn't recognize the symbol which is why I thought I might need to import something. I'll be sure to always check that before posting errors I can't solve in my code.
|
|

04-23-2008, 06:25 AM
|
 |
Moderator
|
|
Join Date: Jul 2007
Location: Colombo, Sri Lanka
Posts: 3,039
|
|
Originally Posted by Leprechaun
I did see that but didn't know what to do. It said it didn't recognize the symbol which is why I thought I might need to import something. I'll be sure to always check that before posting errors I can't solve in my code.
No anytime you can post your questions here. What I try to say is, those error message really helpful for Java newbie. I don't know how far JCreator(you are working on that, right?) descriptive with error messages. In Netbeans, Eclipse it is nice. 
__________________
Use an appropriate Subject. "Help, urgent!" isn't one. To view links or images in signatures your post count must be 10 or greater. You currently have 0 posts.
Has someone helped you? Then you can To view links or images in signatures your post count must be 10 or greater. You currently have 0 posts. their helpful post.
Want to make your IDE the best? To view links or images in signatures your post count must be 10 or greater. You currently have 0 posts.
To view links or images in signatures your post count must be 10 or greater. You currently have 0 posts. To view links or images in signatures your post count must be 10 or greater. You currently have 0 posts. (Close on September 4, 2008)
To view links or images in signatures your post count must be 10 or greater. You currently have 0 posts.
|
|

04-23-2008, 06:28 AM
|
|
Member
|
|
Join Date: Dec 2007
Posts: 30
|
|
|
I think JCreator (you were right) does pretty good as far as displaying errors. It lists the errors, what line numbers there on and what the error is. Once I have more free time (4 AP Exams coming up for those who know what that means) I'll probably try different IDE's and play around more with Java in general.
|
|

04-23-2008, 06:30 AM
|
 |
Moderator
|
|
Join Date: Jul 2007
Location: Colombo, Sri Lanka
Posts: 3,039
|
|
It's up to you pal. If you have solved the question please mark it as SOLVED.
Best of luck for the exam. 
__________________
Use an appropriate Subject. "Help, urgent!" isn't one. To view links or images in signatures your post count must be 10 or greater. You currently have 0 posts.
Has someone helped you? Then you can To view links or images in signatures your post count must be 10 or greater. You currently have 0 posts. their helpful post.
Want to make your IDE the best? To view links or images in signatures your post count must be 10 or greater. You currently have 0 posts.
To view links or images in signatures your post count must be 10 or greater. You currently have 0 posts. To view links or images in signatures your post count must be 10 or greater. You currently have 0 posts. (Close on September 4, 2008)
To view links or images in signatures your post count must be 10 or greater. You currently have 0 posts.
|
|
| Thread Tools |
|
|
| Display Modes |
Linear Mode
|
Posting Rules
|
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts
HTML code is Off
|
|
|
|
|
All times are GMT +3. The time now is 07:44 PM.
|
|
VBulletin, Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
Content Relevant URLs by vBSEO ©2007, Crawlability, Inc.
Copyright ©2006 - 2007, www.java-forums.org