java and path

Posted on 2006-05-15
Last Modified: 2011-09-20

I would like to implement a filepath where i generate the directory directly from java.....
its mean whenever some one use the program so he can establish the directories automatically....
Question by:Maggieshah
    LVL 86

    Accepted Solution


    File home = new File(System.getProperty("user.home"));
    LVL 30

    Assisted Solution

    >> where i generate the directory directly from java

    You mean create a directory? For that you need something like:

    File f = new File ( "directories you want to create" ) ;

    if ( ! f.exists () )
      f.mkdirs () ;

    Author Comment


    jbuilder should create  afoldero r directory by itself when i compile or do something.....because when im selling the program i want no one shoul dthink about where and how to put the directories....
    LVL 86

    Expert Comment

    That's why i mentioned what i did. Also you can be sure of having the permissions to read from and write to that directory
    LVL 30

    Expert Comment

    When you run the program, you might be running on a machine that does not have JBuilder (it might be used only for development). Can you explain the broader requirement?

    Featured Post

    Do You Know the 4 Main Threat Actor Types?

    Do you know the main threat actor types? Most attackers fall into one of four categories, each with their own favored tactics, techniques, and procedures.

    Join & Write a Comment

    Suggested Solutions

    Title # Comments Views Activity
    canBalance challenge 34 58
    classnotfoundexception 3 29
    basic hardware to learn oop advanced design patterns 3 52
    endX challenge 2 33
    Java contains several comparison operators (e.g., <, <=, >, >=, ==, !=) that allow you to compare primitive values. However, these operators cannot be used to compare the contents of objects. Interface Comparable is used to allow objects of a cl…
    Java had always been an easily readable and understandable language.  Some relatively recent changes in the language seem to be changing this pretty fast, and anyone that had not seen any Java code for the last 5 years will possibly have issues unde…
    The viewer will learn how to implement Singleton Design Pattern in Java.
    This tutorial will introduce the viewer to VisualVM for the Java platform application. This video explains an example program and covers the Overview, Monitor, and Heap Dump tabs.

    745 members asked questions and received personalized solutions in the past 7 days.

    Join the community of 500,000 technology professionals and ask your questions.

    Join & Ask a Question

    Need Help in Real-Time?

    Connect with top rated Experts

    16 Experts available now in Live!

    Get 1:1 Help Now