0

I am getting this error when i try to run my code: "It has a broken platform reference."

I can't run my code. Could someone run this code and let me know if its giving errors or not?Also, could you tell me how to fix my net beans?

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

ファイル

etc/netbeans.conf  

最後の設定 ( netbeans_jdkhome) は、JDK へのパスです。確認して NetBeans を再起動します

于 2012-09-19T17:47:35.720 に答える