Making folders in java

I have a combo box that lists customers. It gets the list from a database. My question is how can I create a folder for each of the customers in java using the database or the combo box. I tried this and it just creates a folder for the very last customer in the database.
        File f = new File("C:\\TEST\\" + nombre);
try{
if(f.mkdir())
System.out.println("Directory Created");
else
System.out.println("Directory is not created");
}catch(Exception e){
}

IYIaster wrote:
I tried this and it just creates a folder for the very last customer in the database.Then obviously your folder creation code works fine, and your looping code and/or the part where you decide which folder to create is borked.

Similar Messages

  • Getting all webI reports in a folder and its sub-folders using java sdk.

    hi,
    I need a java code to get the Id of all webi  reports in a folder and recursive sub folders .
    Is there any sample code or tutorial  available for It?
    regards,
    nitin

    I didn't test this but it should work. Import required packages.
    <%
    String username = "administrator";
    String password = "<password>";
    String cmsname = "<cmsname>";
    String authtype = "secEnterprise";
    IEnterpriseSession oEnterpriseSession = CrystalEnterprise.getSessionMgr().logon(username, password, cmsname, authtype);
    IInfoStore oInfoStore = (IInfoStore)oEnterpriseSession.getService("","InfoStore");
    getWebi(oInfoStore,0,out);
    oEnterpriseSession.logoff();
    %>
    <%!
    public void getWebi(IInfoStore oInfoStore, int sourceFolderID, javax.servlet.jsp.JspWriter out)
    try
         String query = "select * from ci_infoobjects where si_kind='webi' and si_instance =0 and si_parentid =" + sourceFolderID ;
         IInfoObjects oInfoObjects = oInfoStore.query(query);
         for(int i=0;i< oInfoObjects.size(); i++)
              IInfoObject oInfoObject = (IInfoObject) oInfoObjects.get(i);
              out.println(oInfoObject.getID() + "  " + oInfoObject.getTitle() +"<br>");
         String query = "select * from ci_infoobjects where si_kind='folder' and si_parentid = " + sourceFolderID ;
         oInfoObjects = oInfoStore.query(query);
         for(int i=0;i< oInfoObjects.size(); i++)
              IInfoObject oInfoObject = (IInfoObject) oInfoObjects.get(i);
              getWebi(oInfoStore, oInfoObject.getID(), out);               
    catch(SDKException e)
         out.println(e.toString());
    %>

  • File Making Directories Problem. java.io.FileNotFoundException

    When ever I run my program it is SUPPOSED to make the directories, instead it tells me the file doesn't exist and fails.
    Here is my Code:
    * To change this template, choose Tools | Templates
    * and open the template in the editor.
    package passworddatamacsetup;
    import java.io.File;
    import java.io.FileInputStream;
    import java.io.FileNotFoundException;
    import java.io.FileOutputStream;
    import java.io.IOException;
    import java.io.InputStream;
    import java.io.OutputStream;
    import java.util.logging.Level;
    import java.util.logging.Logger;
    import javax.swing.JOptionPane;
    * @author jacobgarber
    public class Main {
         * @param args the command line arguments
        public static void main(String[] args) {
            try {
                File PasswordDATA = new File("/Applications/PasswordDATA");
                PasswordDATA.mkdirs();
                File passwords = new File("/Applications/PasswordDATA/PasswordFiles");
                passwords.mkdirs();
                File main = new File("./PasswordDATA_-_MAC.jar");
                File out = new File(PasswordDATA.getPath()+"/PasswordDATA.jar");
                copy(main, PasswordDATA);
                JOptionPane.showMessageDialog(null, "Framework setup complete!", "Completed!", JOptionPane.INFORMATION_MESSAGE);
            } catch(Exception ex) {
                JOptionPane.showMessageDialog(null, ex);
        // Copies src file to dst file.
        // If the dst file does not exist, it is created
        public static void copy(File src, File dst) throws IOException {
            try {
                InputStream in = new FileInputStream(src);
                OutputStream out = new FileOutputStream(dst);
                // Transfer bytes from in to out
                byte[] buf = new byte[1024];
                int len;
                while ((len = in.read(buf)) > 0) {
                    out.write(buf, 0, len);
                in.close();
                out.close();
            } catch (FileNotFoundException ex) {
                JOptionPane.showMessageDialog(null, ex);
    }Here is my exception:
    java.io.FileNotFoundException: /Applications/PasswordDATA

    This looks suspicious:
                File out = new File(PasswordDATA.getPath()+"/PasswordDATA.jar");
                copy(main, PasswordDATA);You probably meant:
                File out = new File(PasswordDATA.getPath()+"/PasswordDATA.jar");
                copy(main, out);

  • Tool to make easy code for making pictures in java

    e.g.
    g.drawLine(10,10,50,100)
    Is there a simple tool where I can draw a line on a screen and that that tool gives me then the right coordinates to put it in the java code?
    Of course this simple line is just an example.
    I want to use this to create advanced pictures in a Java applet.
    I hope you guys understand what I mean. I'm from Belgium and my English is not very very good.
    thx for reading this!

    I'm searching just for a more simple tool with interface of Paint for example where I can make pictures. That tool gives than the right code in java.
    Just like when you in eg Dreamweaver make a webpage and then gereates the html code.
    I'm almost sure this must exist but I can't find a tool like that... :-(

  • Making animation using java, need help, image doesn't get painted

    I was trying to make some sort of animation and it is done by painting a head and a body at a time. The problem is the body never gets painted but the head is perfect. Unless I replace the int variable within imgBodypics[int variable] with a variable at counts from 0 to N or an integer , the body doesn't get painted, that is not what i want, as the images that make up the animation consists of 8 frames starting from the image006.gif ~ image014.gif
    import java.awt.Image;
    import java.awt.Graphics;
    import java.awt.Color;
    public class Knight extends java.applet.Applet implements Runnable {
         Image imgBodypics[]= new Image[115];
         Image imgHeadpics[]= new Image[15];
         Image imgCurrentbody, imgCurrenthead;
         int intBodyposx,intBodyposy,intHeadposx,intHeadposy;
         int brainwalkxpos,brainwalkypos,bodywalkxpos,bodywalkypos;
         Thread thdRunner;
         public void init() {
              for (int i=0;i < 115; i++){
                   imgBodypics[i] = getImage(getCodeBase(),"images/knight/knight000"+i+".gif");
              for (int i=0;i < 15; i++){               
                   imgHeadpics[i] = getImage(getCodeBase(),"images/headboy02/headboy02000"+i+".gif");
         public void start() {
              if (thdRunner == null) {
                   thdRunner = new Thread(this);
                   thdRunner.start();
         public void stop() {
              if (thdRunner != null) {
                   thdRunner.stop();
                   thdRunner = null;
         public void paint(Graphics g) {
              g.drawImage(imgCurrentbody, intBodyposx, intBodyposy,this);
              g.drawImage(imgCurrenthead, intHeadposx, intHeadposy,this);
         public void walk(int intNumtimes, String strDirection) {
         int intDirectionx,intDirectiony,intBodyimagecode;
              if (strDirection == "down")      {     intDirectionx = 0;
                                                      intDirectiony = 1;
                                                      intBodyimagecode = 6;}
              else if(strDirection == "leftdown"){intDirectionx =-1;
                                                      intDirectiony =1;
                                                      intBodyimagecode = 14;}
              else if(strDirection == "left") {     intDirectionx = -1;
                                                      intDirectiony = 0;
                                                      intBodyimagecode = 22;}
              else if(strDirection =="leftup") {     intDirectionx =-1;
                                                      intDirectiony =-1;
                                                      intBodyimagecode = 30;}
              else if(strDirection == "up")      {     intDirectionx = 0;
                                                      intDirectiony = -1;
                                                      intBodyimagecode = 38;}
              else if(strDirection =="rightdown") {intDirectionx =1;
                                                      intDirectiony =1;
                                                      intBodyimagecode = 14;}
              else if(strDirection == "right") {     intDirectionx = 1;
                                                      intDirectiony = 0;
                                                      intBodyimagecode = 22;}
              else if(strDirection =="rightup") {     intDirectionx =1;
                                                      intDirectiony =-1;
                                                      intBodyimagecode = 30;}
              else{      intDirectionx = 0;
                        intDirectiony = 0;
                        intBodyimagecode = 6;}
              int intLastBodyimagecode = intBodyimagecode + 8;
              int intFirstBodyimagecode = intBodyimagecode;
         for (int intCount = intNumtimes; intCount > 0; intCount--){
              for (int i = 0; i < 8; i++){
              int intJ,intI;
              intJ = i;
              intI = intBodyimagecode + i;
              imgCurrentbody = imgBodypics[intI];
              intBodyposx = 250 - (imgCurrentbody.getWidth(this) / 2) + (intDirectionx * intJ * 12);
              intBodyposy = 200 - (imgCurrentbody.getHeight(this) / 2) + (intDirectiony * intJ * 12);
              imgCurrenthead = imgHeadpics[intJ];
              intHeadposx = 250 - (imgCurrenthead.getWidth(this) / 2) + (intDirectionx * intJ * 12);
              intHeadposy = 200 - (imgCurrenthead.getHeight(this) / 2) + (intDirectiony * intJ * 12);
              repaint();
              intBodyimagecode++;
              try { Thread.sleep(200); }
              catch (InterruptedException e) { }
         public void update(Graphics g) {
         paint(g);
         public void run() {
              setBackground(Color.lightGray);
              walk(1, "left");
              walk(1, "right");
              walk(1, "up");
              try {Thread.currentThread().sleep(5000);}
              catch (InterruptedException e) { }

    Erm, i tried to highlight the code and then press the code tag but after posting it is still plain, and there is no way to edit the post, sorry about that, next time i'll try. About the book "Filthy Rich Clients", no i don't have it, is there any free version of similiar resources?
    testing123

  • Making movies using Java

    Hi,
    I am trying to make movies using Java, and naturally with Java Media Framework it is doable. However, it is a huge overhead to my tiny tool to be distributed over the Internet, and also makes the program very hard to install for my end users, so I cannot use it.
    In essence, what need to do is to take a series of jpeg images generated by my program, and convert them into a movie. Preferably to mpeg-1.
    It only needs to work on Windows platforms, so I have been looking for a command line tool I can call from my Java program that will automatically compress the jpeg files.
    Do you have any pointers? Help would be greately appreciated, as I have been looking near and far for such a program.
    Thank you...

    Although I can't offer any help, I'd be interested to see where you go with this topic. I had a request for a program to sequence JPEG and TIFF images (taken from a E.Microsope) into movie sequences a while ago. Similar kinds of limitations. Are there any C libraries in existance that you could call into using JNI?

  • Making Folders on Bookmarks Bar?

    We noticed that some of the bookmarks on our Safari 2.0.1 bookmarks bar have a little 'down arrow' next to them. If you click on it you'll see more than one thing listed under that bookmark, essentially making the bookmark act like a folder.
    How do you make one of these?
    We've tried right clicking on a bookmark and dragging something to an existing bookmark, but no joy.

    MyMac8MyPC, from the Bookmarks menu, select Show All Bookmarks. Then from the Collections sidebar on the left, select Bootmarks Bar. Then click the "+" below the blue and white striped window to the right. This will create an untitled folder which you can name and then select Hide All Bookmarks. The newly named folder should show up in the Bookmarks Bar. When you go to a site that you want to add to the new folder in the Bookmarks Bar, select Add Bookmark and then select the new folder from the list in Bookmarks Bar.

  • Making folders in playlist and having those folders transfer to ipod

    I listen to alot of live shows and for that I have made folders for each bands live shows to make it easier to scroll through my ipod. When I sync my ipod with my itunes the ipod doesn't show up with the folders like I have it in itunes. With not being able to have those folders on my ipod it takes much longer to scroll through the ipod. Especially since when my ipod is plugged into my headunit in my car I can only scroll through my music on the interface one cd at a time. Does anyone know how to get the folders to show up on the ipod and thus being able to show up that what on the interface of my headunit in my car. Thanks alot for any help.
    -Kevin

    Apple don't as a rule pre-announce what features will be available in software updates or much if anything about new models. The support for folders could be an option, it's a case of wait and see. In the meantime you can leave your feedback and a feature request at this link: Apple Product Feedback

  • Problem with making folders in finder

    when i use finder to make a new folder, the new folder has all the contents of my desktop in it. How do i correct this?

    How are you making the new folder? Where are you creating this new folder?  Does this happen no matter where the new folder is created?

  • MP3 burn sorted by Album not making Folders

    Trying to burn an MP3 CD of some albums, but when I sort by album in album view, so I will get the albums songs split into folders (as described by Apple themselves), I end up with just a long list of songs...no folders. Am I missing something?
    My MacBook won't burn over 4x too...that is VERY disappointing.

    I suppose the only solution within iTunes is to rename the albums themselves so that alphabetical order reflects chronological order. This is sad that it cannot be done without heavy lifting on the part of the user.
    With more car stereos supporting MP3 CDs it makes sense to improve this experience in iTunes. Not all of us want to haul an iPod around and hook it up everywhere we go.

  • Making some basic Java games

    Can anyone help on how to make some basic java games for my website if you could that would be helpful
    thanks,
    Louie

    Well, first of all you program the Framework, add Graphics / sounds / Data , then you put it in your HP - There you are!

  • Making folders or categories in Library/Books in iTunes or in iBooks ???

    If I add pdf files by using FILE/ADD FILE TO LIBRARY... in iTunes, then those files are visible in iPad's iBooks.
    Is there some way of creating folders or categories in iBooks or in iTunes so I can group pdf files easily?
    Tnx
    Adrian

    +1
    Any type of organization would be welcome, especially in the iWork apps. For example being able to tag items whether they're documents in Pages or pdf's in iBooks and then browsing or filtering on the tags would be cool.

  • Making Games in Java!!!

    hey i want to make a game in java but i want to get a lot more ideas about what the game should be like and what it should do. I want to actually work with someone else to make the game and then we can sell it or something like that. So if anyone is interested just make a reply OR e-mail me at [email protected] thanks.

    hey i want to make a game in java but i want to get a
    lot more ideas about what the game should be like and
    what it should do. I want to actually work with
    someone else to make the game and then we can sell it
    or something like that. So if anyone is interested
    just make a reply OR e-mail me at [email protected]
    thanks.This post is an email harvester's dream.

  • Making .exe in java

    Hai
    How to make .exe in java,i know it is not possible.
    but if you give the class along with the product then customer can decomile this class file can see the source.
    with this regard how java is sucure in product delevery
    pls suggest is there any other way other than giving the class files to customers
    my mail Id:[email protected]
    Yogisha

    hai webprowler!
    can u explain what u told,i tried by compiling
    like this
    javac -g:none a.java
    then also i can decompile ,i can see the methods ,
    pls help me .
    Yogisha

  • Making folders on iPhone 4S

    Hi there,
    I'm a bit confused about how to make folders on my iPhone 4S. I have things on different pages that I'd like to consolidate into folders, but can't figure out how to move them from one page to another. ?
    Thanks

    It is a bit harder to move app from one page to the other. But it can be done. You have to move to the edge (left or right) and hold it there for a second, the page will turn and you can drop it into a folder or over another icon to create a new folder.
    The easier way is to do it on computer iTunes:
    Connect and select iPhone in computer iTunes (left panel under DEVICES), choose the Apps tab and you can arrange them there.

Maybe you are looking for