Win a copy of Think Java: How to Think Like a Computer Scientist this week in the Java in General forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Recompile with -Xlint:unchecked

 
saikrishna cinux
Ranch Hand
Posts: 689
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Note: C:\Documents and Settings\sai\Desktop\Test.java uses unchecked or unsafe operations.
Note: Recompile with -Xlint:unchecked for details.

why i am getting this warning while i am compiling my program i am using util package arraylist class inside the program

and how to use this -xlint function ?


thanks in advance
 
Campbell Ritchie
Sheriff
Posts: 48917
58
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
It's -Xlint not -xlint.

Lint is a tool which shows details of potential errors or vulnerabilities recognised by the compiler. So to show the full details, rather than writing
javac Test.java, write
javac -Xlint Test.java

And you have already told us why you are getting an error. It is because you are not using generics correctly on your ArrayList.
 
saikrishna cinux
Ranch Hand
Posts: 689
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
now i've tried this using -Xlint tool
and i got this error message
Test.java:2: error while writing Test: Xlint\Test.class (The system cannot find the path sp
ecified)
public class Test {
^
1 error

can you please tell me now what should i do to eliminate that warning?

thanking you in advance
 
Jesper de Jong
Java Cowboy
Saloon Keeper
Posts: 15272
37
Android IntelliJ IDE Java Scala Spring
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
You are typing in something wrong on the command line. The message says:

Note: Recompile with -Xlint:unchecked for details.

So, it's very simple. Do exactly what the message says: add "-Xlint:unchecked" to the command line, like this:

javac -Xlint:unchecked Test.java
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic