G
Glenn McCall
Hi there I am using Netbeans 4.0 on windows XP. My problem is that the
compiler
doesn't seem to be receiving *some* of my options. Has anyone else come
across
this and how did you fix it?
I am trying to compile so that the .class files will run in the 1.4 JVM. To
achieve this I need to run the compiler with the switch "-source 1.4". But
Netbeans doesn't appear to be passing this switch to javac!?!?!?!?
Details follow.
If I compile from the command prompt (with the following), I can run it on
the
1.4 JVM no problems.
javac -source 1.4 TestB.java
as a matter of interest if I omit the "-source 1.4" switch I get the
following
notes (i.e. the compiler is recognising the switch):
Note: TestB.java uses unchecked or unsafe operations.
Note: Recompile with -Xlint:unchecked for details.
If I compile in the IDE and don't specify any switches, I get the above 2
messages (notes).
If I set the -Xlint:unchecked switch (right click "Source Packages" then
select
"Properties". Then select "Compiling Sources" in the dialog and enter the
switch
in "additional compiler options"). Then the I get the lint output as
follows:
TestB.java:21: warning: [unchecked] unchecked call to add(E) as a member
of the
raw type java.util.LinkedList
This means that the -Xlint:unchecked is being passed to the compiler. So far
so
good.
Now if I follow the logical sequence and enter -source 1.4 in the
"additional
compiler options" in Netbeans, I still get the Notes or Warnings depending
on
the presence or absence of the -Xlint:unchecked switch. The class should
compile
without warnings just as it did in when I ran the compiler from the DOS
prompt.
So all I can assume is that NetBeans is not passing the switch to the
compiler.
On the other hand if I put the switch in quotes (single or double) I get the
message "javac: invalid flag: -source 1.4"
For what it is worth, here is the class I am working with:
package com.test;
import java.util.*;
public class TestB {
public TestB() {
LinkedList l = new LinkedList ();
String s = "why";
l.add (s);
s = "is this";
l.add (s);
Iterator i = l.iterator ();
while (i.hasNext ()) {
String v = (String) i.next ();
System.out.println (v);
}
}
public static void main (String [] args) {
TestB b = new TestB ();
}
}
compiler
doesn't seem to be receiving *some* of my options. Has anyone else come
across
this and how did you fix it?
I am trying to compile so that the .class files will run in the 1.4 JVM. To
achieve this I need to run the compiler with the switch "-source 1.4". But
Netbeans doesn't appear to be passing this switch to javac!?!?!?!?
Details follow.
If I compile from the command prompt (with the following), I can run it on
the
1.4 JVM no problems.
javac -source 1.4 TestB.java
as a matter of interest if I omit the "-source 1.4" switch I get the
following
notes (i.e. the compiler is recognising the switch):
Note: TestB.java uses unchecked or unsafe operations.
Note: Recompile with -Xlint:unchecked for details.
If I compile in the IDE and don't specify any switches, I get the above 2
messages (notes).
If I set the -Xlint:unchecked switch (right click "Source Packages" then
select
"Properties". Then select "Compiling Sources" in the dialog and enter the
switch
in "additional compiler options"). Then the I get the lint output as
follows:
TestB.java:21: warning: [unchecked] unchecked call to add(E) as a member
of the
raw type java.util.LinkedList
This means that the -Xlint:unchecked is being passed to the compiler. So far
so
good.
Now if I follow the logical sequence and enter -source 1.4 in the
"additional
compiler options" in Netbeans, I still get the Notes or Warnings depending
on
the presence or absence of the -Xlint:unchecked switch. The class should
compile
without warnings just as it did in when I ran the compiler from the DOS
prompt.
So all I can assume is that NetBeans is not passing the switch to the
compiler.
On the other hand if I put the switch in quotes (single or double) I get the
message "javac: invalid flag: -source 1.4"
For what it is worth, here is the class I am working with:
package com.test;
import java.util.*;
public class TestB {
public TestB() {
LinkedList l = new LinkedList ();
String s = "why";
l.add (s);
s = "is this";
l.add (s);
Iterator i = l.iterator ();
while (i.hasNext ()) {
String v = (String) i.next ();
System.out.println (v);
}
}
public static void main (String [] args) {
TestB b = new TestB ();
}
}