How to use .dbf files zipped into a .zip file from within a java program

i have a .zip file containing several .dbf files.
the zip file is automatically downloaded regularly and data from the .dbf files is inserted into the database.
how do i facilitate automatic extraction of a zip file or how do i fetch data from the .dbf file? (this cannot be done manually)
anu.

you could write a little polling class checking the zip file. you can use the java.util.jar package to extract the zip file (http://java.sun.com/docs/books/tutorial/jar/api/index.html). you could also use Jakarta ant (http://ant.apache.org/manual/index.html) to do this job (core task "zip") and call ant's target file on a regular basis (dependend on the OS you use, you can set os tasks/schedules).

Similar Messages

  • How to call up an executable file (eg. MSPaint) from within my java program

    How to call up an executable file (eg. MSPaint) from within my java program

    Ummm... why would you want to get MSPaint anyway? Even in the absense of real software, Java's own graphics tools are way more sophisticated - with a little time and effort, you could write a simple paint package that beat MSPaint hands down.

  • How to start a browser from within a java program?

    I want to make a help file for my java program and want to run the browser from the menu of my program.
    How can I start my browser from my program?
    A small code will be helpful.
    Thanks.
    Niteen

    This should work on Windows without having to know where the browser is located. See http://www.javaworld.com/javaworld/javatips/jw-javatip66.html for more details
      public static void viewHtml(URL url, boolean fixHtmlExtension){
          String cmd = "rundll32 url.dll,FileProtocolHandler " + url.toExternalForm();
          if (fixHtmlExtension){
            //There is a bug in rundll32. For http requests, it doesn't like .html or .htm extensions,
            //but replacing the 'm' with '%6D' works. 
            //This fix is not needed for file requests.
            if (cmd.endsWith(".htm")){
              cmd = cmd.substring(0,cmd.length()-1) + "%6D";
            else if (cmd.endsWith(".html")){
              cmd = cmd.substring(0,cmd.length()-2) + "%6Dl";
          Process process = Runtime.getRuntime().exec(cmd);
          try{
            process.waitFor();
          catch(InterruptedException e){

  • Problem with creation of a jar file from inside a java program

    Hi,
    I am trying to create a jar file at runtime from within a java program.
    I am able to create a jar file just fine using:
    String[] jarArgs = new String[3];
    jarArgs[0] = "cvf";
    jarArgs[1] = "C:\temp\myjar.jar";
    jarArgs[2] = "C:\temp\this";
    sun.tools.jar.Main main1 = new sun.tools.jar.Main(System.out, System.err, "jar");
    main1.run(jarArgs);However, when I look at the jar it puts the absolute path to the files inside such as:
    C:\temp\this\is\my\package\Class.class
    instead of only this\is\my\package\Class.class
    When running the jar command from the command line it works just fine and I have the relative paths in my jar file.
    Does anyone have any experience with this and could help me out?
    Thanks in advance
    Edited by: mruf on Apr 11, 2008 1:51 AM

    Shouldn't jarArgs[2] = "-C C:\temp\this"

  • How to run java programs from a master java program?

    Hello,
    I have several java programs which run from the command prompt. I am seeking help with code for starting java programs from within a java program. For example, a program called master.java works something like this:
    import java.*;
    create connection pool
    create variables and result sets
    start/run slave1.java (var1, var2);
    start/run slave2.java (var3, var4, var5);
    start/run slave3.java (var1, var4);
    end of program master.java
    Each of the slave.java programs will run for up to an hour. I do not want the master.java program to pause for each slave program to stop. Instead, the master program will keep running and multiple slave programs will be running simultaneously with the master program. When a slave program starts, it is on its own. Also, if possible, I would like to have each of these slave.java programs open in a new separate command window, so I can observe each slave program running in separate windows.
    Any suggestions for code or helpful documentation are greatly appreciated.
    Thank you,
    Logan

    Thank you all.
    At the bottom of master.java I have successfully started a batch file with these lines:
    String jcmd = "cmd.exe /c start c:/data/simulations/MsgViewCount2.bat";
    Process proc = Runtime.getRuntime().exec(jcmd);
    But I still cannot get a java program to start. Here is one variation I have tried:
    String [] cmdArray = new String[2];
    cmdArray[0] = "java";
    cmdArray[1] = "slave1";
    Runtime runtime = Runtime.getRuntime();
    Process process = runtime.exec(cmdArray);
    This compiles, and no errors occur, but nothing happens.
    Regarding this comment:
    Why Runtime.exec? Either make the slaves Runnable or
    just call their main() methods.
    Oh, I see. Sepearate output. :PNone of the slave.java programs have any output.
    Thanks again.

  • How to execute a Perl program from within a Java prog

    How do I execute a Perl program from within a Java program.
    Lets say the Perl program that I want to execute is 'abc'. Now, 'abc' requires some input that I want to give it from within the Java program. How do I do it?
    And finally, how do I execute that Perl program from within the Java program.
    If I execute the Perl program alone then I do it in the following way -
    perl abc inp1 inp2 inp3
    where inp1, inp2, inp3 are inputs to the Perl program. I will not be able to change or modify the coding of the Perl program - 'abc' as I do not have access to its code. Its a kind of an application whose usual method of execution is in the above shown way. So, how do I execute 'abc' from within a Java program.

    what part of don't crosspost, don't you understand?
    http://forum.java.sun.com/thread.jsp?forum=4&thread=427193

  • How to output a query results into a text file

    How to output a query results into a text file instead of outputing it to the screen..
    is there a way for us to write a SQL query which specifies to output the query results to a text file.
    Pls let me know how to do it
    Thanking u in advance
    regards
    Muraly

    Muraly,
    If you are using SQL*Plus 8.1.6 or later, you can also spool output to a file in HTML format, eg
    SET MARKUP HTML ON SPOOL ON PREFORMAT OFF ENTMAP ON
    SPOOL c:\temp\report.html
    SELECT DEPARTMENT_NAME, CITY
    FROM EMP_DETAILS_VIEW
    WHERE SALARY>12000;
    SPOOL OFF
    SET MARKUP HTML ENTMAP OFF
    In iSQL*Plus 9.0.1 (the browser-based interface to SQL*Plus) onwards, you can also send the HTML output to a new web browser window, or an html file -- much easier than the command line method.
    Alison

  • How do i convert a pdf into a word file, i have tried doing save as?

    how do i convert a pdf into a word file, i have tried doing save as?

    Hi Jack,
    What version of Acrobat are you using?
    You might need to go to File> Save As Other> Microsoft Word or choose 'Adobe PDF printer' from the File menu.
    Is save as option not functioning correctly? Do you get any specific error?
    Please let me know.
    Regards,
    Anubha

  • How to write the JTables Content into the CSV File.

    Hi Friends
    I managed to write the Database records into the CSV Files. Now i would like to add the JTables contend into the CSV Files.
    I just add the Code which Used to write the Database records into the CSV Files.
    void exportApi()throws Exception
              try
                   PrintWriter writing= new PrintWriter(new FileWriter("Report.csv"));
                   System.out.println("Connected");
                   stexport=conn.createStatement(ResultSet.TYPE_SCROLL_INSENSITIVE, ResultSet.CONCUR_UPDATABLE);
                   rsexport=stexport.executeQuery("Select * from IssuedBook ");
                   ResultSetMetaData md = rsexport.getMetaData();
                   int columns = md.getColumnCount();
                   String fieldNames[]={"No","Name","Author","Date","Id","Issued","Return"};
                   //write fields names
                   String rec = "";
                   for (int i=0; i < fieldNames.length; i++)
                        rec +='\"'+fieldNames[i]+'\"';
                        rec+=",";
                   if (rec.endsWith(",")) rec=rec.substring(0, (rec.length()-1));
                   writing.println(rec);
                   //write values from result set to file
                    rsexport.beforeFirst();
                   while(rsexport.next())
                        rec = "";
                         for (int i=1; i < (columns+1); i++)
                             try
                                    rec +="\""+rsexport.getString(i)+"\",";
                                    rec +="\""+rsexport.getInt(i)+"\",";
                             catch(SQLException sqle)
                                  // I would add this System.out.println("Exception in retrieval in for loop:\n"+sqle);
                         if (rec.endsWith(",")) rec=rec.substring(0,(rec.length()-1));
                        writing.println(rec);
                   writing.close();
         }With this Same code how to Write the JTable content into the CSV Files.
    Please tell me how to implement this.
    Thank you for your Service
    Jofin

    Hi Friends
    I just modified my code and tried according to your suggestion. But here it does not print the records inside CSV File. But when i use ResultSet it prints the Records inside the CSV. Now i want to Display only the JTable content.
    I am posting my code here. Please run this code and find the Report.csv file in your current Directory. and please help me to come out of this Problem.
    import javax.swing.*;
    import java.util.*;
    import java.io.*;
    import java.awt.*;
    import java.awt.event.*;
    import javax.swing.table.*;
    public class Exporting extends JDialog implements ActionListener
         private JRadioButton rby,rbn,rbr,rbnore,rbnorest;
         private ButtonGroup bg;
         private JPanel exportpanel;
         private JButton btnExpots;
         FileReader reading=null;
         FileWriter writing=null;
         JTable table;
         JScrollPane scroll;
         public Exporting()throws Exception
              setSize(550,450);
              setTitle("Export Results");
              this.setLocation(100,100);
              String Heading[]={"BOOK ID","NAME","AUTHOR","PRICE"};
              String records[][]={{"B0201","JAVA PROGRAMING","JAMES","1234.00"},
                               {"B0202","SERVLET PROGRAMING","GOSLIN","1425.00"},
                               {"B0203","PHP DEVELOPMENT","SUNITHA","123"},
                               {"B0204","PRIAM","SELVI","1354"},
                               {"B0205","JAVA PROGRAMING","JAMES","1234.00"},
                               {"B0206","SERVLET PROGRAMING","GOSLIN","1425.00"},
                               {"B0207","PHP DEVELOPMENT","SUNITHA","123"},
                               {"B0208","PRIAM","SELVI","1354"}};
              btnExpots= new JButton("Export");
              btnExpots.addActionListener(this);
              btnExpots.setBounds(140,200,60,25);
              table = new JTable();
              scroll=new JScrollPane(table);
              ((DefaultTableModel)table.getModel()).setDataVector(records,Heading);
              System.out.println(table.getModel());
              exportpanel= new JPanel();
              exportpanel.add(btnExpots,BorderLayout.SOUTH);
              exportpanel.add(scroll);
              getContentPane().add(exportpanel);
              setVisible(true);
          public void actionPerformed(ActionEvent ae)
              Object obj=ae.getSource();
              try {
              PrintWriter writing= new PrintWriter(new FileWriter("Report.csv"));
              if(obj==btnExpots)
                   for(int row=0;row<table.getRowCount();++row)
                             for(int col=0;col<table.getColumnCount();++col)
                                  Object ob=table.getValueAt(row,col);
                                  //exportApi(ob);
                                  System.out.println(ob);
                                  System.out.println("Connected");
                                  String fieldNames[]={"BOOK ID","NAME","AUTHOR","PRICE"};
                                  String rec = "";
                                  for (int i=0; i <fieldNames.length; i++)
                                       rec +='\"'+fieldNames[i]+'\"';
                                       rec+=",";
                                  if (rec.endsWith(",")) rec=rec.substring(0, (rec.length()-1));
                                  writing.println(rec);
                                  //write values from result set to file
                                   rec +="\""+ob+"\",";     
                                   if (rec.endsWith(",")) rec=rec.substring(0,(rec.length()-1));
                                   writing.println(rec);
                                   writing.close();
         catch(Exception ex)
              ex.printStackTrace();
         public static void main(String arg[]) throws Exception
              Exporting ex= new Exporting();
    }Could anyone Please modify my code and help me out.
    Thank you for your service
    Cheers
    Jofin

  • How to include several PDF documents into just one file?

    I have a Word document with 6 pages that I saved in PDF.
    I wanted to transform the entire document in JPEG (JPG) immage, so that I could use it in other tools, such as Facebook for example.
    The problem is that using Adobe Photoshop it opens and saves page by page.
    Can you give me s solution or hint?
    Flavio
    [email protected]

    Thank you!
    I already saved all pages as .pdf w/ Acrobat and have all 6 pages saved in
    .jpg, using Photoshop.
    Problem is that I want to post the whole text in my Facebook page, and to
    have it in six pieces is not quite readable...
    Thanks anyway and have a joyful Xmas!
    2011/12/24 try67 <[email protected]>
       Re: How to include several PDF documents into just one file?  created
    by try67 <http://forums.adobe.com/people/try67> in Adobe Reader - View
    the full discussion <http://forums.adobe.com/message/4102594#4102594>

  • Got adobe reader8 on my desktop,how to use it create afile into pdf

    got adobe reader8 on my desktop,how to use it create afile into pdf

    Adobe Reader by itself cannot create PDF files, unless you use https://createpdf.acrobat.com/
    Adobe Acrobat can do this as well.

  • How to use one report column into the another report in obiee

    How to use one report column into the another report in obiee

    i dont want to use column as a filter for another report it should be report column for another report
    Thanks,
    Vivek

  • How do i scan multiple pages into one pdf file

    How do I scan multiple pages into one pdf file?

    That depends on your scanning software. Adobe Reader doesn't scan.

  • How to transfer a mac document into a pdf file to open on a microsoft computer.

    how to transfer a mac document into a pdf file to open on a microsoft computer.

    Choose to print it, click on PDF, and then Save as PDF.
    (113984)

  • How to use runtime.exe to activate the native file coping commands

    How to use runtime.exe to activate the native file coping commands.(It might include using process(), and such.. but how?

    Why would you want to do this? It's harder than copying the file in Java (by reading the file and writing it to a new file) and you'll need to write new code each time you want to port your code to a new OS.

Maybe you are looking for

  • OBIEE 11g RPD deployment issue.

    I have installed OBIEE 11.1.1.5.0 32 bit on windows7. I am getting issue while deploying RPD. I clicked on Lock & Edit button and it enabled the "Browse" button. I clicked "Browse" button and selected the new RPD file but it is not taking new rpd fil

  • Insert link is not functioning properly. Please help.

    Hello :) My insert link option used to work just fine. Recently, it is not allowing me to do this and I cannot understand why. All I get is 'NO NAMED ANCHORS OR HEADINGS IN THIS PAGE'. This is VERY frustrating! Please help me as I need to send many l

  • The following Nuget packages could not be installed in project~

    When i create a new azure cloud service project in VS, the VS process fails with dialog message. See this error, Windows Azure Tools for Microsoft Visual Studio The following NuGet packages could not be installed in project WebRole: Microsoft.Windows

  • Urg: Effort Estimation of Migration Work, Any standards !

    Hi, I wanted to know is there any "standard" of estimating the "work effort" (In person-months or in other terms) to establish the fact of actual work to be done. Like, is there any category of migration eg. complex, simple etc. Could you please help

  • Batch classification view for MSC2N

    HI, when i loading inventory using movement type 561its asking for the production date but its not updating the classification view in the batch master data MSC2N screen.every time I have to go in to the transaction MSC2N and update the batch classif