Results 1 to 1 of 1
  1. #1
    rizowski is offline Member
    Join Date
    Nov 2010
    Posts
    37
    Rep Power
    0

    Default Creating a file is Holding up java.

    [EDIT]Never mind I have figured out the issue. Please delete.
    Is there any particular reason why this method (which creates a folder and sets a file name for a file i will use later on) is holding up my compiler. Is there anything i need to close like a Stream? It is not preceding to move forward with my program after creating the file.

    Java Code:
    public void createReq(){
    		Scanner scan = new Scanner(System.in);
    		System.out.println("What would you like to name the folder to store your information?");
    		String directory = scan.nextLine();
    		File folderDir = new File(directory);
    		if(directory.contains("/")||directory.contains("\\")){
    			System.out.println("Sorry But you can't have Slash");
    		}else{
    			folderDir.mkdir();
    		}
    		System.out.println("What would you like to name the file you will store the information into?");
    		file = new File(folderDir, scan.nextLine());
    		if(folderDir.exists()){
    			System.out.println("Folder Created Successfully");
    			choice();
    		}else{
    			System.out.println("[Error] Creating the file, Please try again.");
    		}
    		
    		
    	}
    Last edited by rizowski; 04-20-2011 at 05:49 PM.

Similar Threads

  1. Replies: 8
    Last Post: 11-23-2010, 11:03 AM
  2. Creating jar file
    By Heather in forum Advanced Java
    Replies: 4
    Last Post: 02-11-2009, 09:58 AM
  3. Replies: 1
    Last Post: 10-22-2008, 05:02 PM
  4. Creating Folder in JAVA and Copying File
    By fnoman in forum New To Java
    Replies: 8
    Last Post: 10-18-2008, 07:33 AM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •