javac Questions

1

Solved

Trying out JDK/12 EarlyAccess Build 20, where the JEP-325 Switch Expressions has been integrated as a preview feature. A sample code for the expressions (as in the JEP as well): Scanner scanner = ...
Gattis asked 19/11, 2018 at 19:22

1

Solved

I am running into errors like these while trying to build my project on IntelliJ on Mac. Error:(12, 39) java: diamond operator is not supported in -source 1.5 (use -source 7 or higher to enable ...
Warwick asked 7/11, 2018 at 21:41

8

I am trying to use the JavaCompiler class: http://docs.oracle.com/javase/6/docs/api/javax/tools/JavaCompiler.html When I call ToolProvider.getSystemJavaCompiler() it returns null. I think th...
Unesco asked 20/3, 2013 at 0:52

4

Solved

I have the following Java class public class HelloWorld { public static void main(String []args) { } } When I compile this file and run a sha256 on the resulting class file I get 9c8d09e27ea...
Mcmillen asked 3/10, 2018 at 10:35

2

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...
Kempis asked 19/9, 2018 at 7:58

1

Background I have to contact different kind of Java project with various of build system. Sometimes the directory structure is different from the package hierarchy. So it is difficult to package. E...
Glycogen asked 28/7, 2018 at 9:47

4

Solved

I have two classes Owning and OwningAccessor. The files are in the same directory. public class Owning { String _name = ""; public void printBanner() { } public void printOwning(double amount...
Pouliot asked 15/11, 2012 at 23:21

1

I may do some cross-compilations for legacy projects and I noticed with recent JDKs that we are limited to some specific versions for the source, target and release JVM arguments. How to get the su...
Gilges asked 5/8, 2018 at 8:39

5

Solved

I have read the previously posted questions. Some are vague and none solved my problem so I am forced to ask again. I have two simple classes, package One; import One.Inner.MyFrame; public class ...
Succinctorium asked 17/10, 2013 at 17:28

1

Solved

I have the following code: package test; import java.util.stream.IntStream; public class A { public static void main(String[] args) { IntStream.range(0, 10).mapToObj(n -> new Object() { in...
Damiondamita asked 23/6, 2018 at 1:12

4

Solved

I have written a .java file, called Main.java, and have compiled it using the javac in the Windows Command Prompt. The compiler is creating multiple .class files (called Main.class, Main$1.class, &...
Hampden asked 11/2, 2013 at 22:2

2

Solved

Consider the following code public class JDK10Test { public static void main(String[] args) { Double d = false ? 1.0 : new HashMap<String, Double>().get("1"); System.out.println(d); } } ...
Yahairayahata asked 9/6, 2018 at 0:29

1

Solved

For a challenge, a fellow code golfer wrote the following code: import java.util.*; public class Main { public static void main(String[] args) { int size = 3; String[] array = new String[size]; ...
Vicarial asked 4/6, 2018 at 15:16

9

Solved

The Java static compiler (javac) inlines some static final variables and brings the values directly to the constant pool. Consider the following example. Class A defines some constants (public stat...
Omniscient asked 19/8, 2010 at 16:53

1

Solved

The following code causes Eclipse to display a dead code warning although the code is reachable. Am I missing something here, or is this an Eclipse/javac bug? import java.util.ArrayList; public c...
Catima asked 15/5, 2018 at 13:46

9

Solved

When I compile, javac outputs: Note: Some input files use or override a deprecated API. Note: Recompile with -Xlint:deprecation for details.` I wish to suppress this warning. Trying -Xlint:none ...
Economically asked 12/10, 2009 at 13:20

5

I know running javac file1.java produces file1.class if file1.java is the only source file, then I can just say java file1 to run it. However, if I have 2 source files, file1.java and file2.java, ...
Chubb asked 26/1, 2011 at 1:58

2

Solved

The following code creates a Collector that produces an UnmodifiableSortedSet: package com.stackoverflow; import java.util.Collections; import java.util.SortedSet; import java.util.TreeSet; impor...
Brecher asked 10/4, 2018 at 21:1

3

Solved

I'm testing Java on a Windows Surface Pro. The Surface Pro has Java 7 Update 55, but does not have the JDK installed. I compiled a program on my MacBook from the command line using javac. The MacB...
Conyers asked 13/5, 2014 at 9:34

2

Solved

I recently upgrade my machine to the latest version of java 6, and keep getting this error when building the project. Does anyone what this means? [ERROR] Failed to execute goal org.apache.maven....
Prepositor asked 5/9, 2013 at 1:48

4

Solved

I do not have a %CLASSPATH% set up. As I understand, this should not be a problem because Javac will assume a classpath of the current directory. As you can see below, javac is unable to find my C...
Bul asked 13/5, 2011 at 21:38

1

Solved

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...
Coopersmith asked 2/4, 2018 at 20:12

1

Solved

The following example describes the generation of the following lines of code until Java 9. List data = new ArrayList<>();for (String b : data); public class Test { public Test() {...
Ens asked 2/4, 2018 at 9:52

0

How can I use a custom classpath when overriding a native class like java.util.regex.Matcher in a non-modular code base. Basically what I want to do is to use a different class path like --class-p...
Unprofitable asked 8/3, 2018 at 14:51

4

Solved

If I write private void check(){ if(true) return; String a = "test"; } Above code works normally, but if I write private void check(){ return; String a = "test"; } The compiler/gradle ...
Martita asked 16/2, 2018 at 10:30

© 2022 - 2024 — McMap. All rights reserved.