Java Forums

Main Menu
Home
Today's Posts
FAQ
Search
Contact Us

Java Network
Java Tips
Java Tips Blog

Sponsored Links





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.

Reply
 
LinkBack Thread Tools Display Modes
  #1 (permalink)  
Old 04-23-2008, 03:57 AM
Member
 
Join Date: Dec 2007
Posts: 30
Leprechaun is on a distinguished road
[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.
Bookmark Post in Technorati
Reply With Quote
Sponsored Links
  #2 (permalink)  
Old 04-23-2008, 04:04 AM
roots's Avatar
Moderator
 
Join Date: Jan 2008
Location: Dallas
Posts: 260
roots is on a distinguished road
Java System Properties
__________________
dont worry newbie, we got you covered.
Bookmark Post in Technorati
Reply With Quote
  #3 (permalink)  
Old 04-23-2008, 05:29 AM
Member
 
Join Date: Dec 2007
Posts: 30
Leprechaun is on a distinguished road
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 ;
Bookmark Post in Technorati
Reply With Quote
  #4 (permalink)  
Old 04-23-2008, 06:07 AM
rpwtdj's Avatar
Member
 
Join Date: Dec 2007
Posts: 15
rpwtdj is on a distinguished road
Send a message via MSN to rpwtdj
You should use:
System.out.println(System.getProperty("user.dir")) ;
Bookmark Post in Technorati
Reply With Quote
  #5 (permalink)  
Old 04-23-2008, 06:16 AM
Eranga's Avatar
Moderator
 
Join Date: Jul 2007
Location: Colombo, Sri Lanka
Posts: 3,039
Eranga has a spectacular aura aboutEranga has a spectacular aura about
Send a message via Yahoo to Eranga
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.
Bookmark Post in Technorati
Reply With Quote
  #6 (permalink)  
Old 04-23-2008, 06:22 AM
Member
 
Join Date: Dec 2007
Posts: 30
Leprechaun is on a distinguished road
Working now...
Quote:
You should use:
System.out.println(System.getProperty("user.dir")) ;
Thanks, that works.

Quote:
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.
Bookmark Post in Technorati
Reply With Quote
  #7 (permalink)  
Old 04-23-2008, 06:25 AM
Eranga's Avatar
Moderator
 
Join Date: Jul 2007
Location: Colombo, Sri Lanka
Posts: 3,039
Eranga has a spectacular aura aboutEranga has a spectacular aura about
Send a message via Yahoo to Eranga
Quote:
Originally Posted by Leprechaun View Post
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.
Bookmark Post in Technorati
Reply With Quote
  #8 (permalink)  
Old 04-23-2008, 06:28 AM
Member
 
Join Date: Dec 2007
Posts: 30
Leprechaun is on a distinguished road
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.
Bookmark Post in Technorati
Reply With Quote
  #9 (permalink)  
Old 04-23-2008, 06:30 AM
Eranga's Avatar
Moderator
 
Join Date: Jul 2007
Location: Colombo, Sri Lanka
Posts: 3,039
Eranga has a spectacular aura aboutEranga has a spectacular aura about
Send a message via Yahoo to Eranga
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.
Bookmark Post in Technorati
Reply With Quote
Sponsored Links
Reply


Thread Tools
Display Modes

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

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


Similar Threads
Thread Thread Starter Forum Replies Last Post
Ant Paths(II) JavaForums Java Blogs 0 03-02-2008 01:45 AM
Ant Paths(I) JavaForums Java Blogs 0 03-02-2008 01:45 AM
Ant Paths(III) JavaForums Java Blogs 0 02-18-2008 12:52 PM
getting paths and directories marco Java Applets 3 11-25-2007 08:28 AM
How can i get current directory? Ashley New To Java 1 05-26-2007 02:21 PM


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