我该如何修理我的网豆?

时间:2012-09-19 17:43:11

标签: java

当我尝试运行我的代码时出现此错误: “它有一个破碎的平台参考。”

我无法运行我的代码。有人可以运行此代码,让我知道它是否给出错误?另外,你能告诉我如何修复我的网豆吗?

import java.io.*;

     public class ResourcesTesterApp
  {
public static void main(String[] args)
{
    String s1 = readLineWithResources();
    String s2 = readLineWithFinally();
}

public static String readLineWithResources() throws IOException 
{
 System.out.println("Starting readLineWithResources method.");

 try (
 RandomAccessFile in = new RandomAccessFile("products.ran", "r")) 
   {
    return in.readLine();   
          }
         }

     catch (IOException e)
   {
  System.out.println(e.toString());
     return null;
    }
     }

public static String readLineWithFinally() 
{
    System.out.println("Starting readLineWithFinally method.");
      RandomAccessFile in = null;
      String s = null;

      try {
   in = new RandomAccessFile("products.ran", "r");
      s = in.readLine();
     } 
      catch (IOException e) 
      {
        System.out.println(e.toString());
        } 
      finally {
      if (in != null) {
     try {
      in.close();
      System.out.println("RandomAccessFile closed");
       } 
     catch (IOException e) {
 System.out.println("RandomAccessFile " + e.getMessage());
      }
     }
    }
       return s;
      }

1 个答案:

答案 0 :(得分:2)

档案

etc/netbeans.conf  

上次设置(netbeans_jdkhome)是JDK的路径。检查并重新启动NetBeans

相关问题