0

当我尝试运行我的代码时出现此错误:“它的平台引用已损坏。”

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

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;
      }
4

1 回答 1

2

file

etc/netbeans.conf  

last setting (netbeans_jdkhome) is path to your JDK. Check it and restart NetBeans

于 2012-09-19T17:47:35.720 回答