SORU
3 EYLÜL 2010, Cuma


Nasıl Java ile bir dizin oluşturmak için?

Nasıl Dizin/klasör oluştururum?

Bir zamanlar System.getProperty("user.home"); test ettik

Bir dizin oluşturmak zorunda (dizin adı "Yeni klasör" ) ve yeni klasör yoksa sadece.

CEVAP
3 EYLÜL 2010, Cuma


File theDir = new File("new folder");

// if the directory does not exist, create it
if (!theDir.exists()) {
    System.out.println("creating directory: "   directoryName);
    boolean result = false;

    try{
        theDir.mkdir();
        result = true;
    } 
    catch(SecurityException se){
        //handle it
    }        
    if(result) {    
        System.out.println("DIR created");  
    }
}

Bunu Paylaş:
  • Google+
  • E-Posta
Etiketler:

YORUMLAR

SPONSOR VİDEO

Rastgele Yazarlar

  • Anthony Le

    Anthony Le

    10 EKİM 2006
  • Ayite Atiwoto (superjiffrey)

    Ayite Atiwot

    29 EYLÜL 2010
  • Xcode programming tutorials

    Xcode progra

    17 EYLÜL 2006