2011-02-25 20 views
0
private static void saveCallers(String fName, RadioShow r) throws IOException { 
     //TODO write the code to save the callers to a file 
     try 
     { 
      FileOutputStream outStream = new FileOutputStream("C:\\Desktop\\text1.txt"); 
      ObjectOutputStream out = new ObjectOutputStream(outStream); 
      out.writeObject(r); 
      out.close(); 
     } 
     catch(Exception e) 
     { 
      System.out.println("something went wrong here! : " + e); 
     } 

     } 

它给我一个URLClassLoaderException,所以我认为即时通讯给它一个不正确的格式?但我似乎无法找出正确的方法来做到这一点。我如何通过一个文件位置作为参数在java

谢谢

+0

URLClassLoaderException?这是什么例外? – reef 2011-02-25 16:39:46

+1

添加实际的异常消息和堆栈跟踪 - 这是最重要的信息。 – 2011-02-25 16:41:27

+0

URClassLoader异常?你的代码似乎没有任何URL的东西。请发布整个代码。 – 2011-02-25 16:42:10

回答

0

确保存在“C:\ Desktop \”文件夹。

相关问题