7 Replies Latest reply: Apr 24, 2009 5:30 AM by 807588 RSS

    Loading files when .exe is clicked

    807588
      Hi All,

      Everyone might have seen many softwares while getting installed says loading/copying files which include(images,html..etc)..I want to do the same when my .exe is clicked.How is it possible to perform???

      Any help appreciated.

      Thanks in advance.

      regards,
      Viswanadh
        • 1. Re: Loading files when .exe is clicked
          793415
          >
          ...
          Everyone might have seen many softwares while getting installed says loading/copying files which include(images,html..etc)..>
          Use webstart.
          >
          I want to do the same when my .exe is clicked.>
          Why are you asking about .exe's on a Java forum?

          Ask someone who cares.
          • 2. Re: Loading files when .exe is clicked
            807588
            Hi Andrew,

            Thanks for the reply..

            Basically my .exe is a Java Application i have the doubt only of how to load the files when i click on my application.

            Thanks in advance.

            regards,
            Viswanadh
            • 3. Re: Loading files when .exe is clicked
              807588
              You need to prepare a FilesToCopy.txt programmatic, which contains the list of files to be copied. You can read those file path from that file an display it to the end user during copying for files.
              public void listFiles(File a_strDirName)
                   {  
                        String strFileName = a_strDirName.getName();
                        try
                        {     
                             File[] files = a_strDirName.listFiles();
                             for (int intNum = 0; intNum < files.length; ++intNum) 
                             { 
                                 if (files[intNum].isDirectory())
                                  {
                                       strFileName = strFileName + files[intNum].getName();
                                       listFiles(files[intNum]);
                                  }
                                  if (!files[intNum].isDirectory())
                                       strFilePath = strFilePath + a_strDirName + File.separator  + files[intNum].getName() + ";";
                             }
                        }
                        catch(Exception e)
                        {
                             System.out.println("Error while listing directory");
                        }
                   }
              • 4. Re: Loading files when .exe is clicked
                807588
                Hi Eraianban,

                Thanks for the help and reply.I require the same functionality as you provided along with JProgressBar for each file when copying..

                Can i add a changeListener to JProgressBar and increment the progress when each file is added???

                Thanks in advance.

                regards,
                Viswanadh
                • 5. Re: Loading files when .exe is clicked
                  807588
                  You can show the Percentage of files copied in the JProgressBar.
                  And above the JProgressBar put a JLabel above it.. You can show the percentage of files copied in javax.swing.event.ChangeListener event.
                  • 6. Re: Loading files when .exe is clicked
                    807588
                    I think what you're after is an installer package. Take a look, for example, at IZPack, which allows you to build an installer for a Java program, you just have to write a configuration file.
                    • 7. Re: Loading files when .exe is clicked
                      807588
                      Hi All,

                      Thanks for the full support..Got the idea and implemented well.

                      Thanks for all.

                      regards,
                      Viswanadh