Domanda

My program runs fine under eclipse. If I open it with the textPad and compile it, I get this message:

Note: C:\Users\Aezur\Desktop\Project2\SummerQ1.java uses unchecked or unsafe operations. Note: Recompile with -Xlint:unchecked for details.

It says that has compiled successfully, but it doesn't run.

Any ideas?

È stato utile?

Soluzione

It is just Warring,do not have any affect on compilation or execution.
Accorind to Java Doc

-Xlint:unchecked  
Give more detail for unchecked conversion warnings that are mandated by the Java Language Specification.

Generally This comes up in Java 5 and later if you're using collections without type specifiers.
Example : using Arraylist() instead of Arraylist<String>().

You can avoid that warring by using @SuppressWarnings("unchecked").

class NoWarn {
   public static Map<String, String[]> getParameterMap(ServletRequest r) 
   {
      @SuppressWarnings("unchecked")
      Map<String, String[]> result = r.getParameterMap();
      return result;
    }
 }

For more information please look into this link

Altri suggerimenti

You'll find compiler behavior from Eclipse vs standalone compiling varies because:

  • Eclipse has it's own internal compiler; it doesn't use the standard Oracle Java compiler.

  • The Eclipse Java compiler allows a relatively high degree of settings to ignore, warn or generate an errora for many coding issues.

Autorizzato sotto: CC-BY-SA insieme a attribuzione
Non affiliato a StackOverflow
scroll top