This Bugzilla instance is a read-only archive of historic NetBeans bug reports. To report a bug in NetBeans please follow the project's instructions for reporting issues.
Hi, i created a basic Java Desktop Application and created a button, jButton1 and in the Action Performed function i wrote the below code... private void jButton1ActionPerformed(java.awt.event.ActionEvent evt) { Test t = new Test(); System.out.println("Starting FTP..."); t.main(null); System.out.println("FTP Completed..."); } But on clicking the button it hangs at the following location :- ftp.connect( server ); in Utilities class. But if i compile and Run Test.java , it works perfectly fine. i don't know why the same code hangs in jButton1ActionPerformed() function. please help... package ftpclient; public class Test { public static void main(String args[]) { Utilities utilities = new Utilities(); String server = "snv"; String username = "xlc"; String password = "pass"; String remoteFolder = "testftp"; utilities.targetFileWithFolder = "C:\\1\\Test\\xyz.zip"; String localZipFileWithPath = utilities.targetFileWithFolder; utilities.putFilesToServer(server, username, password, remoteFolder, localZipFileWithPath); } } package ftpclient; import java.io.File; import java.io.FileInputStream; import java.io.FileOutputStream; import java.util.zip.ZipEntry; import java.util.zip.ZipOutputStream; import org.apache.commons.net.ftp.FTP; import org.apache.commons.net.ftp.FTPClient; public class Utilities { public String sourceFolder = ""; public String targetFileWithFolder = ""; public long size = 0; public int numOfFiles = 0; public void putFilesToServer( String server, String username, String password, String remoteFolder, String localZipFileWithPath) { try { // Connect and logon to FTP Server FTPClient ftp = new FTPClient(); System.out.println("222"); ftp.connect( server ); // this SOP doesnt got displayed . it hangs on previous line i.e. at connect(server)... System.out.println("333"); ftp.login( username, password ); System.out.println("Connected to " + server + "."); System.out.print(ftp.getReplyString()); ftp.changeWorkingDirectory( remoteFolder ); ftp.setFileType(FTP.BINARY_FILE_TYPE); ftp.enterLocalPassiveMode(); ftp.setRemoteVerificationEnabled(false); ftp.setDataTimeout(100000000); ftp.storeFile("rpl.zip", new FileInputStream(localZipFileWithPath)); System.out.println("FTP Done..."); // Logout from the FTP Server and disconnect ftp.logout(); ftp.disconnect(); } catch( Exception e ) { e.printStackTrace(); } } }
I am sorry, I don't understand how to reproduce your issue. > But on clicking the button it hangs at the following location :- > ftp.connect( server ); in Utilities class. Could you, please, provide some context? Where/when do you click the button? The assigned event handlers are not invoked during design time (e.g. inside the IDE) and you wrote that it works in run time (outside the IDE).
Created attachment 65146 [details] Program for reproducing the scenario
i have attached the files which will reproduce the scenario in the Test.java just change the values of the below String variables . server, username, password, remoteFolder
Could you, please, provide _exact_ description of the steps to reproduce. I still don't understand what is this issue about. Could you, please, read and answer questions from my previous comment?
Created attachment 65201 [details] Netbeans Project
Created attachment 65202 [details] Netbeans Project
please import the entire FTPclient project which i have attached now (the latest one) and then build it and run it . there is ONLY one button, click it . BUT before running it,,, change the varaible names... server, username, password, remoteFolder . it should be remote machine where you need to do FTP. please revert back to me in case of any confusion
I am sorry, I don't know why the execution hangs on your machine. It works correctly on my machine. On the other hand, this issue has nothing to do with GUI builder or NetBeans => closing as invalid.
Hi, can u plz suggest, as to which topic this problem related to. bcoz i m getting this problem. by the way , did u tried with FTP on to remote unix machine.
Finally, I was able to reproduce this issue. It is related to system proxy settings and to their usage in Java Desktop Application. See my last comment (Jul 28 13:10:10) in issue 134745 for explanation and workarounds.
o wow!!! it worked. thank you so much :-)
Closing this issue as "will not fix" because it is caused by suspicious feature of Swing Application Framework.