This code works, and writes to a file on my desktop.

import java.io.*;
public class writetofile
{
public static void main(String[] args) throws Exception
{
File tempfile = new...