How to recompile with -Xlint:unchecked?

57,565

Solution 1

open up command prompt in the directory with your source files. then type javac -Xlint:unchecked *.java

Solution 2

Please refer to the BlueJ FAQ which has the exact answer.

Edit: Sorry for the runaround. This is what the FAQ says for Windows. Go to your Bluej installation directory and open lib\bluej.defs file. Then go to the section that says bluej.windows.vm.args and add the value the other user said.

So you have:

bluej.windows.vm.args=-Xlint:unchecked

I would listen to paulsm4's advice and start learning from command-line if you really want to understand java. This is the best I can do.

Solution 3

@viggom555:

Here is a complete command line example:

1) Create the file "ATest.java" (EXAMPLE: notepad ATest.java):

import java.util.*;

public class ATest {

  public static void main (String[] args) {
    ArrayList<String> test = new ArrayList<String>();
    System.out.println ("My array has " + test.size() + " items");
    test.add ("abc");
    System.out.println ("My array has " + test.size() + " items");
  }

}

2) Compile (EXAMPLE: "javac -Xlint:unchecked ATest.java"; you don't really need the "XLint" in this example; I'm just showing you where it would go if you wanted):

C:\temp>javac -Xlint:unchecked ATest.java

3) Run the test program:

C:\temp>java ATest
My array has 0 items
My array has 1 items

I hope that helps .. PSM

Share:
57,565
viggom555
Author by

viggom555

Updated on July 09, 2022

Comments

  • viggom555
    viggom555 almost 2 years

    I keep getting this message in BlueJ/Java.

    http://cache.gyazo.com/19c325e77bbc120892d1035dcfda5377.png

    I know there are several other questions like this already on StackOverflow, but none of the answers were specific enough for me, a Java noob. For example, one of them said to add something on the javac command line," and I have no idea what is that. So use that information to know how specific you must be with me. Sorry. Thanks!