javac Questions

1

Solved

Consider the following two classes and interface: public class Class1 {} public class Class2 {} public interface Interface1 {} Why does the second call to mandatory invoke the overloaded method ...
Seise asked 20/12, 2019 at 18:47

6

Solved

Recently, I was reading this article. According to that article, Java Compiler i.e. javac does not perform any optimization while generating bytecode. Is it really true? If so, then can it be impl...
Folsom asked 12/5, 2011 at 16:42

5

Solved

I have a problem with my compiled Java application on Ubuntu. It throws UnsupportedClassVersionError. I am compiling with a higher JDK version than the one that is configured in my PATH to run Java...
Pollination asked 14/5, 2012 at 14:15

2

Solved

I'm using Java 13 (13.0.1.hs-adpt) and I enabled the preview language features (mainly because of text blocks). My code is properly annotated with @SuppressWarnings("preview") wherever relevant, b...
Aubervilliers asked 24/11, 2019 at 16:42

4

Solved

I am facing some issue in IntelliJ IDEA compiler settings. I have JDK 8 installed and one of the project in idea works only on JDK 6. I have changed the compiler version in idea in preferences -> ...
Catenane asked 5/8, 2015 at 12:49

2

Solved

Ex. javac -g ButtMonkey.java Where do you configure the -g flag when Eclipse compiles Java source? (Using Ganymede but I doubt that has changed in later versions so any answer probably helps.) ...
Douville asked 28/2, 2012 at 14:2

4

Solved

Error: Failed to run "javac -version", make sure that you have a JDK installed. You can get it from: http://www.oracle.com/technetwork/java/javase/downloads. Your JAVA_HOME is invalid: C:\Prog...
Havildar asked 31/10, 2017 at 16:53

8

Solved

Will code compiled using 1.5 and 1.6 run on a 1.4 JRE? We weren't sure which Java versions the 1.4 JRE supports. We know that if the code in question implements 1.5 or 1.6 supported features then ...
Benares asked 10/11, 2009 at 20:23

5

Solved

I have a snippet of simple Java code: public static void main(String[] args) { String testStr = "test"; String rst = testStr + 1 + "a" + "pig" + 2; System.out.println(rst); } Compile it with ...
Roderick asked 28/7, 2019 at 15:58

3

Hello and thank you for reading my post. My problem is the following: I want to compile a Java source file with "javac" with this file being UTF-8 encoded with a BOM (the OS is WinXP). Below is w...
Crony asked 21/3, 2012 at 19:17

2

Solved

I made a java program with a GUI using eclipse so whenever I want to run it I run it there, but my friend wants to run it on his computer so I made a class-file using javac in command prompt and al...
Recept asked 12/5, 2013 at 16:57

1

Solved

i have a complex problem with Java 8. Problem With nested lambda compiler crash with a NullPointerException! I know that lambdas must be stateless indeed in this case the codes that have state a...
Gorgonian asked 12/6, 2019 at 15:55

11

Solved

I saved my Java source file specifying it's encoding type as UTF-8 (using Notepad, by default Notepad's encoding type is ANSI) and then I tried to compile it using: javac -encoding "UTF-8" One.ja...
Undertrump asked 12/11, 2009 at 23:37

3

Solved

In all of my projects, I use gradle and specify the following: sourceCompatibility = "1.7"; // for example targetCompatibility = "1.7"; // defaults to sourceCompatibility Now, I have three diffe...
Mahla asked 21/1, 2015 at 10:57

4

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...
Smidgen asked 26/4, 2013 at 14:43

2

I need to create an EnumSet from a Set. I decided to use the EnumSet#copyOf method. However, because of a restriction on this method: the specified collection must contain at least one element (in...
Conservatism asked 22/9, 2015 at 17:7

1

Solved

I recently upgraded to Java11. There are 150 new Nashorn deprecation warnings: Utils.java:31: warning: [removal] NashornScriptEngineFactory in jdk.nashorn.api.scripting has been deprecated and mar...
Topple asked 11/4, 2019 at 21:56

2

I have two questions: Why does javac -cp not need .? $ javac -cp /home/t/programs/java/test/junit-4.11.jar TestCase.java Why does java -cp need .? $ java -cp /home/t/programs/java/test/junit-4...
Boynton asked 11/4, 2019 at 12:44

1

Solved

I have the following piece of code public class TeeingCollector { public static void main(String[] args) { // var strs = List.of("abc"); var dividedStrings = Stream.of("foo", "hello", "bar", "...
Wart asked 3/4, 2019 at 12:52

3

My employer has a business need to make Java builds byte-for-byte reproducible. I am aware of the difficulties in making JAR files reproducible (due to archiving order and time stamps), but at this...
Agreement asked 13/3, 2019 at 20:36

2

Solved

Here's a minimal example of the code I'm working with: public class Temp { enum SomeEnum {} private static final Map<SomeEnum, String> TEST = new EnumMap<>( Arrays.stream(SomeEnum....
Damning asked 14/2, 2019 at 4:15

1

Solved

We are currently evaluating our next-generation company-wide developer pc-configuration and have noticed something really weird. Our rather large monolith has - on our current configuration a buil...
Unwarranted asked 17/2, 2018 at 12:44

2

Solved

I want to compile my code down to Java version 1.0. I managed to compile down to 1.1: $ java -version openjdk version "1.8.0_181" OpenJDK Runtime Environment (build 1.8.0_181-8u181-b13-2~deb9u1-b...
Shrink asked 10/2, 2019 at 20:12

2

Solved

Is it possible to tell eclipse to add the following command line option: --add-exports jdk.compiler/com.sun.tools.javac.tree=ALL-UNNAMED when compiling. I think it may also be needed when runnin...
Stipitate asked 7/1, 2019 at 5:35

2

I need to add the -parameters java compiler parameter for my tests to succeed. I can do this in gradle already for ./gradlew build to work, or manually by adding -parameters under IntelliJ Settings...
Disaccustom asked 21/3, 2017 at 1:7

© 2022 - 2024 — McMap. All rights reserved.