Creating a new directory in Java

Can anyone tell me how I can create a directory on the C: drive using java code.
Eg:C:\javacode\workspace

new File("/dev/null").mkdirs()

Similar Messages

  • Is there a way to create a new directory or file in application install directory programatically

    Hi to all,
    Is there a way to create a new directory or file in
    application install directory programatically.
    I want a xml file to be created with in the application
    install directory programatically(not the application storage
    directory)
    I have used the following code snippet:
    var file:File = new File();
    file = File.applicationDirectory;
    file = file.resolvePath("assets");
    if(!file.exists)
    file.createDirectory()
    I am thrown an exception when using this .....Security
    Exception

    Thanks, but my main problem is to delete the locally stored
    data that is stored in the application storage directory when the
    application is uninstalled.
    The data is not being deleted automatically when the
    application is uninstalled, thats why I want to write some file to
    application directory.
    My application is remembering the login username and password
    even I uninstall the application and reinstall the next
    time.

  • Trouble Creating a New Directory to Import into

    I just upgraded to Lightroom 5 today and installed the update to 5.2 on Windows 7 64 bit.  I have run into a problem I never had before.  In the import module I want to create a new directory to import into.  I go through the same steps I did in Lightroom 4, but when I am done, the directory does not show up on the list.  I can find it in Windows Explorer, but not Lightroom.  If I leave the import module and then return, the directory shows up in the Lightroom list of directories.  I have tried this twice with the same result both times.  Has anyone else seen this?  Is there a Fix?

    Thanks that works.  I found that even though the new directory did not show in the Import list of directories when I created it usind the right-click method as I did in LR4,  LR5 is in fact creating it and will import to it.  Another odd thing is when I create the directory using the right-click, Windows Explorer method, the directory list in the Import module flickers like it is adding the new directory.  However, the new directory cannot be seen.

  • Create a new File from java code

    Hi,
    I'd like to create a new File on IFS, using Java code. Moreover, this file will be an image file, and I'd like to store meta data with this file... and then execute a search on this meta data.
    I know it must not be very difficult to do, but I can't find any code sample.
    Does anyone could give me some usefull link or advice ?
    thanks in advance,
    Roger.

    First of all, you need to create your custom class. You can do it using iFS Manager, extending the class DOCUMENT. Let's call this class IMAGE with the attributes "length", "width", "colorDepth". Take a look at the code that creates one instance:
    You need one instance of LibrarySession (that appears in the code named "ifsSession").
    You need also the InputStream of the image you want to store (that appears in the code named "contentStream").
    // Setting the attributes
    DocumentDefinition def = new DocumentDefinition(ifsSession);
    def.setClassname("IMAGE");
    def.setAttribute("NAME", AttributeValue.newAttributeValue("nameOfTheImage"));
    def.setAttribute("LENGTH", AttributeValue.newAttributeValue(100));
    def.setAttribute("WIDTH", AttributeValue.newAttributeValue(230));
    def.setAttribute("COLORDEPTH", AttributeValue.newAttributeValue(1024));
    def.setContentStream(contentStream);
    // Creation
    Document doc = (Document) ifsSession.createPublicObject(def);
    I hope this helps,
    Fabio Nunes

  • Create a new directory in existing Zip archive

    Hello Every One
    I want create a new folder in existing Zip archive. Can any one help in this regard.
    Thanks
    Edited by: SatishBejgum on Dec 18, 2007 12:42 AM

    Delete the ZIP, write a new one. You can't modify an existing archive.

  • Create a new directory in server with JSP

    Hi,
    How can I create a directory in server with JSP.
    File dir = new File("a");
    dir.mkdir();
    does not work. what do I do?
    best regards,

    Hi
    Check the following things.
    1. What is the path where you are creating the directory.
    2. Do you permissions to create file in that directory.
    3. do a delete on that filename if that exists just to be sure. isdeleted = filedir.delete(). Check the boolean flag isdeleted too.
    Thanx and Regards
    Aruneesh

  • Creating a new OrdImage in Java

    I want to manipulate and validate an incoming OrdImage object before adding a record for it in the database. Specifically, I want to do a hash on the file and check for duplicates.
    The few examples I've seen fetch an existing row from the database that already has an initialized OrdImage, but I'd rather do something like this:
    OrdImage tempImage = new OrdImage(); // not able to do this
    uploadPhoto.loadImage(tempImage);
    Is there some code showing how to do this?
    Alternately, is there a Java example that shows how to generically upload a file as a blob, and then push it into a new record that uses OrdImage?
    Thanks!
    Mike

    Hi,
    I am thinking you want to create the hash after putting it in the database because you are getting the image from HTTP? You could check the hash before insertion into the database, if you want it in the database before checking the hash, and you find a duplicate, you could simply roll back the transaction... This should not be a common case, so overhead should not be onerous.
    I don't understand why you would want to upload a file into a simple blob before putting the blob in the intermedia object. We have examples, and utility classes for inserting images into interMedia.
    See: http://www.oracle.com/technology/sample_code/products/intermedia/index.html
    http://www.oracle.com/technology/products/intermedia/htdocs/intermedia_quickstart/intermedia_java_qs.html
    http://www.oracle.com/technology/sample_code/products/intermedia/htdocs/imedia_servlet_jsp.html
    Larry

  • How to create a new directory?

    Hi!
    I want to export each Layer to a png file in a directory named like the file.
    That directory is not exisiting.
    var document = app.activeDocument;
    folder = document.fullName+"-png";
    var file = new File(folder+"/"+layer.name+".png");
    document.exportFile(file,ExportType.PNG24,options);
    leads into an error that "documentname-png/" is not found.
    How do I create the directory 'document.fullName+"-png"'

    Thanks, that was exactly what I searched for.
    (I use a folder to go around the 31 character file length warning:
    http://www.electrictoolbox.com/change-adobe-photoshop-filename-compatibility-options/
    "Some names of the files being saved will be truncate to 31 characters for compatibility with Macintosh browsers.")

  • Create a folder(directory) in java

    i need to create a folder on a certain path on the hard drive from the java code..
    does anybody have an idea?

    Check out the File class

  • Creating new process through java

    Hello,
    I wanna create a new "process" through java and wanna do interprocess communication.

    Usually the way to make something else run on your computer outside your JVM is to use the Runtime.exec() method.

  • Timestamp not correct for new directory created

    Hi,
    I'm facing a problem on my solaris machine.
    Issue is whenever I create a new directory(using mkdir), it shows timestamp as exactly one year before whereas data and time shown are correct.
    It remains as for 24 hours and next day when I see that directory it shows correct timestamp.
    Could somebody help me out in this.
    Thanks in advance,

    Hi,
    Field MSEG-MBLNR is a document number field
    so it doesn't have a search help already.
    Go to transaction se11 and display this field
    you won't see any search help or check table assigned to this field.
    You can design your own search help and assign it to this field on the screen painter directly :
    > double click on your field and fill field Search Help on right screen
    or you call search help in event :
    PROCESS ON VALUE-REQUEST.
       FIELD mseg-mblnr MODUE zz_mblnr_help.

  • How to create search index files for Java Pet Store

    Hi All,
    As you may know, the java pet store application uses for the search function a search index object, which itself uses the following files '_36.cfs', 'deletable', 'segments'.
    Now as I want to change the data of the database (delete some pets, and names, etc.), it does not have an effect on the search results. This is because the application uses the search index files and does not use the database for the search query.
    So can anybody help me and tell me how I can create this three files from my *.sql file, so I can search in my own data?
    Thank you very much for your help.
    Regards,
    Wolfgang

    gonso777 wrote:
    Solved:
    I had the same problem. It seems that the installer does not unzip three files where it should.
    With NetBeans (Using File Perspective) or just editing build.xml
    Netbeans: select build.xml/Run Target/Other Targets/unzipindexes: Tough it should work it fails in resolving $javaee.domaindir$ at least in my system, but it does suscessfully create a new directory named ${jee.domaindir} that includes lib/petstore/searchindex and three files: _36.cfs , deletable, segments.
    Copy those three files to your_glasshfish_path/domains/domain1/petstore/searchindex.
    Now you are done. I hope that you had a nice time while waiting two years for it to be answered. How is it that it is not answered anywhere else?
    Regards,
    Ramon Talavera
    www.sciencetechworks.comThanks. I didn't wait 2 years for this, but I just replied on a 2 year old post. I only recently tried the petstore app. I thought I needed to study lucene first to figure things out, it turns out there was an 'internal target' on the build file for this. Thanks a bunch!

  • Installed a new update of iTunes and it created a new folder

    Hi,
    I lost a hard drive last month and had to purchase a new one.  I copied my actual music files to a similar directory format that they were in before (\Music\iTunesMusic\ and under that, the artists and the songs.
    I then installed the most recent version of iTunes and it asked where my music was and I told it.  It then created a new directory called \Music\iTunes\iTunesMedia\Music where all new downloads now appear.  I now have music in two locations (just a few in the new folder, but all of my apps were moved there from my iPod touch and all of my old music in the old folder) and two libraries in two locations (the old one in \Music and the new one in \Music\iTunes and I would like my music to be in one location and managed by one library and I'll delete the library that isn't being used (I don't really care which location).  My question is:  If I just copy the large folder of music to the newly created location, how do I get it recognized in iTunes and then which library is the correct one so I can delete the other?  Is there a better way to manage this so all files are under one location? 
    Also, I was using Home Sharing on the computer in the other room.  How do I change that computer to point to the new location?
    Thanks in advance,
    Gwen

    Oh ok...try using a third party program such as YamiPod or CopyPod, both free and will let you rip your iPod onto your iTunes.
    Or do it this way: http://docs.info.apple.com/article.html?artnum=300173
    Sorry, I am getting tired and easily confused. Time to call it a night.
    Good Luck,
    Rachyl

  • Help with creating a new window

    Hi there
    Could anyone help me with the coding to create a new window in java? Basically its when i click on a button a new window pops up
    thanks

    Icer_age828 wrote:
    Could anyone help me with the coding to create a new window in java? Basically its when i click on a button a new window pops upWe need more information on what you mean here, what you know and what you don't know. Do you understand the basics of Java? Are you talking about using Swing? If so, what exactly do you mean by a "new window"? You can create a simple dialog via the method JOptionPane.showMessage(...) method. Do you mean to create and show a new JDialog? JFrame? Do you know about ActionListeners and how to add them to jbuttons? Given your post, I think that your best bet would be to start going through the Sun Java Swing tutorial from the beginning. Look here .

  • Creating technical system Web As java

    Hi All
    I am creating a new technical system Web As Java in SLD.Can anybody please tell what "Installed Products" I need to select  to create the system
    Regards
    Pawan

    Hi
    If ur creating a new Web AS Java technical system...I hope u would have already defined the corresponding software components and the product for that particular system...U should add this product which was created.
    Hope i got it right..Do let me know if u have further queries
    Regards
    Krishna

Maybe you are looking for