- Joined
- Feb 11, 2011
- Messages
- 220
- Reaction score
- 5
- Trophies
- 0
- Location
- Colorado Springs
- XP
- 252
- Country

Hey temps, need more help with JAVA. Need to put user.name into a filepath
here's the code
here's the code
Code:
import java.net.*;
import java.io.*;
public class Download
{
public static void main(String[] args)
{
String Username;
Username = System.getProperty("user.name");
try
{
System.out.println ("Connecting to ROMBox Server...\n");
URL FCEUltraX = new URL("http://www.fileden.com/files/2010/12/14/3038162/Emulators/FCE%20Ultra%20X%20v2.1.5.zip");
FCEUltraX.openConnection();
InputStream reader = FCEUltraX.openStream();
System.out.println ("Connected! Downloading File...");
FileOutputStream writer = new FileOutputStream("C:/Users/USERNAME/Downloads/FCE Ultra X v2.1.5.zip");
byte[] buffer = new byte[153600];
int totalBytesRead = 0;
int bytesRead = 0;
while ((bytesRead = reader.read(buffer)) > 0)
{
writer.write(buffer, 0, bytesRead);
buffer = new byte[153600];
totalBytesRead += bytesRead;
}
System.out.println ("");
System.out.println ("Done! Please Enjoy Your Download File!");
writer.close();
reader.close();
}
catch (MalformedURLException e)
{
e.printStackTrace();
}
catch (IOException e)
{
e.printStackTrace();
}
}
}






