Java connect to FTP server and download files with java default libraries
<p>I need to connect to an FTP server and browse all files without using any libraries like apache.commons because I don't have the option to get these libraries at the moment.</p>

<p>I tried using a simple URL connection:</p>

<pre><code>URL url = new URL("username:password@ip/folder/");
URLConnection conn = url.openConnection();
BufferedReader reader = new BufferedReader(new InputStreamReader(conn.getInputStream()));

String line;

while ( (line = reader.readLine()) != null ) {
    System.out.println(line);
}

reader.close();
</code></pre>

<p>When I don't include the <code>/folder/</code> it works, but it prints me many things that I can't even see in the home location of the FTP server, I don't know if it gives me the files or other data.</p>

<p>But when I do include <code>/folder/</code> i get error  <code>CWD /folder/:550 failed to change directory</code></p>

<p>and I cannot change the directoy's permissions, its read-only and thats what I need.</p>

<p>What is wrong with it? Is it possible to do with just java's default libraries?</p>