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
2,479
questions
-1
votes
1
answer
57
views
Why can't my class be run after declaring package and be found by another class in the same package/folder?
I am having problems understanding how packages work. Not using any IDE.
I have the following folder structure:
~/dropbox/api/data
Inside the data folder, there are (only) Producer.java, Consumer.java....
2
votes
0
answers
73
views
Javac thinks a lambda may actually be an instance of a class, "ambiguous call". Why? [duplicate]
Why can the Java compiler not compile this?
private ButtonGroup groupButtons(AbstractButton... buttons) {
return groupButtons(() -> new ButtonGroup(), buttons);
}
private <BG extends ...
-1
votes
1
answer
64
views
How to solve the issue resulting in output of the error message "class not found wrong class name"? [duplicate]
I have the following Java code in a file:
package hello_project;
public class Hello {
public static void main(String[] args) {
System.out.println("Hello world");
}
}
The ...
-4
votes
1
answer
70
views
Why does using lambda break definite assignment in Java?
Attempting to compile the following code with java-1.21.0-openjdk-amd64 results in these errors
.../TransactionProfile.java:[60,22] variable emvData might already have been assigned
.../...
0
votes
0
answers
39
views
Using com.sun classes without --add-opens
I am making a lib that modifies the AST with an annotation handler for parameter injection (src: http://github.com/PhoenixOrigin/DependencyInjector). Right now, all users are required to include
...
0
votes
1
answer
36
views
Issue with javac makefile
I have an issue with the makefile I am doing using java. So:
./bin/fp2/poo/utilidades/TitularInterfaz.class:
./bin/fp2/poo/utilidades/CodigoPostalInterfaz.class \
...
1
vote
1
answer
58
views
How to compile a Java class with javac without any dependencies even on the base classes like java.lang.*?
I want to "recreate" J2ME / CLDC with a recent version of javac (e.g. 11.0.19) and compile a purposely built Java program without any or minimal base classes. Obviously classes like java....
0
votes
0
answers
24
views
control javac options per class from annotation processor
I'd like to use reflection to get names (in addition to types) of a class method parameters in runtime. This is only possible when my class is compiled with -parameters javac option. There are ...
0
votes
0
answers
61
views
No openjdk development package found, please install JDK package,
I have my java installed and linked.
Still when I run another config it shows no openjdk development package found. Although I have java installed and linked using a pre built release
pegasus@pegasus:...
2
votes
1
answer
98
views
Is there a way to separate Java annotation processing errors from other compilation errors?
I have a maven module with 1000+ Java source files. Some of these have annotations that are processed via processors Dagger and Immutables, each of which generates code. When I have an error in a ...
0
votes
0
answers
17
views
mismatch between java and javac version in MAC [duplicate]
Initially, I had java 21 installed in my MAC. But I need to run an application which requires Java 8. So, I installed Java8 and exported the path in .bash_profile as well. But from the terminal when I ...
1
vote
2
answers
64
views
Java compiler throws 'might not have been initialized' error incorrectly?
Here's a sample method:
boolean method(int value, boolean check1, boolean check2) {
String code;
boolean valueIncorrect = false;
boolean otherIncorrect = false;
if (value < 0 || ...
2
votes
0
answers
42
views
How tu suppress warnings issued by javac task
Recent version of Moshi (1.15.0) is issuing a warning
Kapt support in Moshi Kotlin Code Gen is deprecated and will be removed in 2.0. Please migrate to KSP. https://github.com/square/moshi#codegen&...
2
votes
0
answers
99
views
Strange Compiler Error with Collectors.toMap() : reference to method is ambiguous, both Map and List match
This class doesn't compile (using javac 17 or 21), because the second invocation of set() is allegedly ambiguous, while the first one is OK:
import java.util.HashMap;
import java.util.List;
import ...
0
votes
1
answer
160
views
How to specify Java version in VS Code?
I have created a virtual machine to run some java code in it and have specified the VM to run with java 11
ubuntu@go-v12as34df:~$ java -version
openjdk version "11.0.21" 2023-10-17
OpenJDK ...