when i run my source code on winows xp then progress bar work fine but on linux it just stuck and not run at all,
My Code is as follows

import java.sql.Connection;
import java.sql.Statement;
import java.awt.BorderLayout;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
import java.io.File;
import java.io.FileReader;
import java.io.IOException;
import java.sql.DriverManager;
import java.text.DateFormat;
import java.text.ParseException;
import java.text.SimpleDateFormat;
import java.util.Calendar;
import java.util.Date;
import java.util.GregorianCalendar;
import java.util.Random;
import java.util.Scanner;
import javax.swing.Timer;
import javax.swing.ImageIcon;
import javax.swing.JFrame;
import javax.swing.JLabel;
import javax.swing.JOptionPane;
import javax.swing.JProgressBar;
import javax.swing.SwingUtilities;
import javax.swing.UIManager;

class StartingFrame extends JFrame
{
    private static final long serialVersionUID = 1L;
    JFrame frame;
    JLabel logo;
    Date date;
    Timer timer;
    JProgressBar progressBar;
    public StartingFrame() 
    {
        frame =new JFrame();
        try 
    {
      UIManager.setLookAndFeel(UIManager.getSystemLookAndFeelClassName());
    } catch(Exception e) 
    {
      JOptionPane.showMessageDialog(null, "Error, " + e.getMessage(), null, JOptionPane.ERROR_MESSAGE);
    }
        
        logo=new JLabel(new ImageIcon("bankabout.png"));
        frame.setUndecorated(true);
        
        frame.setSize(440, 250);
        frame.setLocationRelativeTo(null);
        frame.add(logo);
        frame.setVisible(true);
        progressBar = new JProgressBar(0, 10);
        progressBar.setValue(0);
        ActionListener listener = new ActionListener() {
            int counter = 0;
            public void actionPerformed(ActionEvent ae) {
                counter++;
                progressBar.setValue(counter);
                if (counter>9) {
                    frame.setVisible(false);
        new bank();
                    timer.stop();
                } 
            }
        };
        Random rn = new Random();
        int ranf=rn.nextInt(1000);
        timer = new Timer(ranf, listener);
        timer.start();
       
        if(fileExist())
        {
             initialize(numDay());
        }
        else
        {
            initialize(1);
        }
        frame.add(progressBar, BorderLayout.PAGE_END);
    }
    public static void main(String args[])
    {
        SwingUtilities.invokeLater( new Runnable() {
            public void run() {
                StartingFrame startingFrame = new StartingFrame();
            }
        });
        
    }
    
     
private void initialize(long interval)
    {
        try
                {                
                    String url1="jdbc:mysql://localhost/bank";
                    Connection cn=DriverManager.getConnection(url1,"root","rushikesh");
                    Statement stmt=cn.createStatement();           
                    stmt.executeUpdate("UPDATE account SET accountBalance=accountBalance+((accountBalance*0.04)/365)*"+interval+" WHERE accTypeName='Saving'");
                    stmt.close();
                    cn.close();
                }catch(Exception er)
                {                   
                   JOptionPane.showMessageDialog(null, "Error, " + er.getMessage(), null, JOptionPane.ERROR_MESSAGE);
                }
    }
long DateSubstract(Date d1, Date d2)
{
    long ONE_HOUR = 60 * 60 * 1000L;
    return ((d2.getTime()-d1.getTime() + ONE_HOUR) / (ONE_HOUR * 24));
}
Date appCloseDate() throws ParseException,IOException
{ 
       FileReader file = new FileReader("Data.acd");
       Scanner s=new Scanner(file);
       String d=s.nextLine();
       DateFormat dateFormat = new SimpleDateFormat("yyyy-MM-dd");
       Date datew = dateFormat.parse(d);
     return datew;
}

Date appStartDate() throws ParseException
{
    try{
    SimpleDateFormat sdfDate = new SimpleDateFormat("yyyy-MM-dd");
    Date now = new Date();
    sdfDate.format(now);
    date = sdfDate.parse(sdfDate.format(now));
       }catch(Exception e){JOptionPane.showMessageDialog(null, "Error, " + e.getMessage(), null, JOptionPane.ERROR_MESSAGE);}
    return date;
}
private long numDay()
{
    long dist=0;
    try{
        Date e=appStartDate();  
        SimpleDateFormat sdf=new SimpleDateFormat("yyyy");
    Calendar c1 = new GregorianCalendar();
    int f=e.getDate();
    int y=e.getMonth();
     
    int t=Integer.parseInt(sdf.format(e));
   
    c1.set(t ,y ,f);
      Date r=appCloseDate();
    Calendar c2 = new GregorianCalendar();
    int f1=r.getDate();
    int y1=r.getMonth();
    int t1=Integer.parseInt(sdf.format(r));
    c2.set(t1 ,y1 ,f1);
   
         dist=DateSubstract(c2.getTime(), c1.getTime());
    }catch(Exception t){
        JOptionPane.showMessageDialog(null, "Error, " + t.getMessage(), null, JOptionPane.ERROR_MESSAGE);
    }
    System.out.println("Ellapse Days : "+dist);
    return dist;
}

private boolean fileExist()
{
    File file = new File("Data.acd");  
    boolean exists = file.exists();  
                if (!exists) 
                {  
                    return false;                         
                }else
                {  
                    return true; 
                }
}
}

I didn't trace thru all that code, but I notice you've ported a file name from Windows to Linux. Apart from the obvious working directory differences, you are also moving from a case-insensitive environment to a case-sensitive one. Maybe that's a problem?

ps

boolean exists = file.exists();
if (!exists)
{
  return false;
}else
{
  return true;
}

why not just

return file.exists();
Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.