che eccezioni ti solleva? posta tutto il codice che hai

Per esempio
codice:
<%@page contentType="text/html"%>
<%@page pageEncoding="UTF-8"%>
<%@page import="java.io.*;"%>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"
   "http://www.w3.org/TR/html4/loose.dtd">

<html>
    <head>
        <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
        <title>JSP Page</title>
    </head>
    <body>

    <h1>Write File Example</h1>
    

Tentativo di scrittura file su server</p>
    <%
    try {
        File writeFile = new File("C:/Documents and Settings/Andrea/Desktop/jsptestfile.txt");
        BufferedWriter bw = new BufferedWriter(new FileWriter(writeFile));
        bw.write("This is a test");
        bw.flush();
        bw.close();
    }
    
    catch (Exception e) {
        e.printStackTrace();
    }
    %>
    
    
    
    </body>
</html>
Mi scrive correttamente il file sul desktop.