title: Jar File Not Functioning
body: <p>I have been trying to get my program built into an excecutable .jar. The function of my program is to create a text file, place data in that text file, then upload the text file to my ftp server.</p>
  
  <p>Inside eclipse, the program works perfectly with no errors or problems. Once I extract it to an excecutable .jar, the program does not display my JOptionPane.showMessageDialog() outputs and the text files are created and uploaded to the ftp server but the copy inside the ftp server has no data (the copy on my localmachine does have the data). When I ran it from the command prompt to check for errors, it ran perfectly.</p>
  
  <p>The Class that is malfunctioning:</p>
  
  <pre><code>import java.io.FileInputStream;
  import java.io.IOException;
  
  import org.apache.commons.net.ftp.FTP;
  import org.apache.commons.net.ftp.FTPClient;
  import org.apache.commons.net.ftp.FTPReply;
  
  public class UploadKey {
      public void Send(String fileName) {
          FTPClient client = new FTPClient();
          FileInputStream fis = null;
          System.out.println("5");
  
          try {
              client.connect("host");
              client.login("username", "password");
              int replyCode = client.getReplyCode();
              System.out.println("6");
              if (!FTPReply.isPositiveCompletion(replyCode)) {
                  client.disconnect();
                  System.err.println("FTP server refused connection.");
                  System.exit(1);
              }
              fis = new FileInputStream("C:\\" + fileName);
              System.out.println("7");
              client.setFileType(FTP.BINARY_FILE_TYPE);
              client.setFileTransferMode(FTP.BINARY_FILE_TYPE);
              System.out.println("8");
              client.storeFile(fileName, fis);
              System.out.println("9");
              fis.close();
              System.out.println("10");
              client.logout();
          } catch (IOException e) {
              e.printStackTrace();
          }
      }
  }
  </code></pre>
  
  <p>Thank you for your time,</p>
  
  <p>Philip</p>
  
  <p>EDIT: Solved, the .jar was being read as a javaw.exe instead of a java archive. Fixed via Jarfix application (<a href="http://johann.loefflmann.net/en/software/jarfix/index.html" rel="nofollow">http://johann.loefflmann.net/en/software/jarfix/index.html</a>). Thank you all for your help.</p>