Questions tagged [javac]

javac is the primary Java compiler, included in the Java Development Kit (JDK) from Sun Microsystems (now Oracle), and also in versions from other vendors.

javac is the primary Java compiler, included in the Java Development Kit (JDK) from Sun Microsystems (now Oracle), and also in versions from other vendors.

The compiler accepts source code conforming to the Java language specification (JLS) and produces bytecode conforming to the Java Virtual Machine Specification (JVMS). javac is itself written in Java. The compiler can also be invoked programmatically.

2467 questions
16
votes
1 answer

Error: "Class names are only accepted if annotation processing is explicitly requested"

Possible Duplicate: Java Compile Problem: Class names are only accepted if annotation processing is explicitly requested I have encountered a problem. I am using crimson editor. Could someone explain what this error means? // here is my program…
Chris Kevorkian
  • 157
  • 1
  • 1
  • 3
15
votes
4 answers

How to tell ant to build using a specific javac executable?

How can I tell ant to use a specific javac executable from the command line? I have an installation of gcj, built as part of gcc, within a library we distribute, and I'd like to have a particular piece of Java software built against that. However,…
MGwynne
  • 3,512
  • 1
  • 23
  • 35
15
votes
1 answer

What is the “Use '--release' option” in IntelliJ 2018.1 preferences?

In the preferences for IntelliJ 2018.1 (Build, Execution, Deployment > Compiler > Java Compiler) is an checkbox labeled: Use '--release' option for cross-compilation (Java 9 and later) I found for information when doing an internet search. The "?"…
Basil Bourque
  • 303,325
  • 100
  • 852
  • 1,154
15
votes
3 answers

Intellij long "integer value is too big" but in range of long.maxvalue

This might be a silly thing but how is this possible that compiler will show this while Long.Max = 9223372036854775807 ?
vach
  • 10,571
  • 12
  • 68
  • 106
15
votes
2 answers

Ambiguous overload in Java8 - is ECJ or javac right?

I have the following class: import java.util.HashSet; import java.util.List; public class OverloadTest extends HashSet> { private static final long serialVersionUID = 1L; public OverloadTest(OverloadTest other) {} …
Ian Robertson
  • 1,312
  • 1
  • 13
  • 14
15
votes
4 answers

javac complains: cannot find symbol on enum implementing interface

I have three java types as defined below: Main.java: import java.util.Arrays; import java.util.List; public class Main { private Object callFunction() { OperationDefinitions func = OperationDefinitions.CONCATENATE; …
amarillion
  • 24,487
  • 15
  • 68
  • 80
15
votes
5 answers

Java generics compile in Eclipse, but not in javac

I had to discover I have Java code in my project, which compiles and runs fine in Eclipse, but throws a compilation error in javac. A self-contained snippet: import java.util.HashSet; import java.util.Set; public class Main { public static…
mtsz
  • 2,725
  • 7
  • 28
  • 41
14
votes
1 answer

How do you get *ant* to not print out javac warnings?

I just want the errors, and nothing else, to be printed out for now. Thanks :)
Java Confused
  • 153
  • 1
  • 2
  • 6
14
votes
2 answers

How to keep argument names of interface after compilation in Java?

I want to keep argument names of interface methods after compilation in Java. Below is an example. Before compiling: interface IFoo { void hello(String what); } After compiling using javac -g:vars IFoo.java interface IFoo { void…
BaiJiFeiLong
  • 3,716
  • 1
  • 30
  • 28
14
votes
7 answers

Compiling multiple packages using the command line in Java

Hi i have been using an IDE but now I need to run and compile from the command line. The problem is that I have multiple packages and I have tried to find the answer but nothing has worked. So I have src/ Support/ (.java files) Me/ (.java…
Altober
  • 956
  • 2
  • 14
  • 28
14
votes
3 answers

Building Java package (javac to all files)

How to compile all files in directory to *.class files?
Vytas P.
  • 953
  • 4
  • 12
  • 17
14
votes
4 answers

Deprecated compiling error

I'm trying to compile my Java program, however I am getting a "Deprecated File" error. I normally compile the file by typing "Javac FileName.java", however I get an error saying: FileName.java uses or overrides a depreacted API. Recompile with…
hunterge
  • 657
  • 2
  • 10
  • 15
14
votes
6 answers

Java: How will JVM optimise the call to a void and empty function?

Let's imagine we have the following classes: public class Message extends Object {} public class Logger implements ILogger { public void log(Message m) {/*empty*/} } and the following program: public static void main(String args[]) { ILogger l…
David Andreoletti
  • 4,485
  • 4
  • 29
  • 51
14
votes
8 answers

How do I make the JDK the default JRE?

I use Eclipse with ant scripts, and Eclipse works well with the default JRE installation on Windows XP. The annoyance comes when I want to run ant scripts compiling with the javac-tag, where it fails because there is no tools.jar in the…
Thorbjørn Ravn Andersen
  • 73,784
  • 33
  • 194
  • 347
14
votes
1 answer

javac behavior change in JDK 7 regarding private member access

This code compiles OK using javac JDK version 1.6.0_33-b03-424, but doesn't compile using javac JDK version 1.7.0_06. public class Test { private final int i = 0; void test(Object o) { if (getClass().isInstance(o)) { …
Phil Shapiro
  • 143
  • 1
  • 6