javac

Error: “Class names are only accepted if annotation processing is explicitly requested” [duplicate]

こ雲淡風輕ζ 提交于 2019-12-03 20:39:26
问题 This question already has answers here : Closed 7 years ago . 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 package test.rim.bbapps.testcase.lib; import java.awt.*; import java.awt.event.*; import javax.swing.*; public class michaeltictactoe2 implements ActionListener { /* Instance variables */

How can I exclude sources in a javac task in ant?

穿精又带淫゛_ 提交于 2019-12-03 19:49:32
问题 I have the following in my build.xml: <target name="compile.baz" depends="init"> <javac destdir="${build.dir}/classes" debug="on"> <compilerarg value="-Xlint:deprecation"/> <src> <pathelement location="${src.dir}/com/foo/bar/baz/" /> <pathelement location="${src.dir}/com/foo/bar/quux/" /> <!-- Need to exclude ${src.dir}/com/foo/bar/quux/dontwant/ --> </src> <classpath refid="classpath.jars" /> </javac> ... </target> This mostly does what I want, except that (as the comment says) I do not want

Javac is not found

拜拜、爱过 提交于 2019-12-03 19:03:14
问题 I'm running Windows 8 and I can not get javac to work. I have set my PATH in environmental variables to C:\Program Files (x86)\Java\jdk1.7.0_17\bin I have tried both with and without ';' but to no avail. I recently had this issue on my desktop and adding ; worked but it's not in this case. I have made sure that javac does exist in the bin too. Any suggestions on fixes would be greatly appreciated. EDITS echo %PATH% gives: C:\Users\Arktri\Desktop>echo %PATH% C:\Program Files (x86)\Intel\iCLS

Maven: How to specify Javac plugin argument with maven-compiler-plugin?

半腔热情 提交于 2019-12-03 17:31:17
Javac provides the following nonstandard option (from "javac -X" command line help): -Xplugin:"name args" Name and optional arguments for a plug-in to be run However, Maven does not handle that format. For example, the following does not work: <plugin> <groupId>org.apache.maven.plugins</groupId> <artifactId>maven-compiler-plugin</artifactId> <configuration> <compilerArgs> <arg>-Xplugin:"Manifold static"</arg> </compilerArgs> </configuration> </plugin> I've tried several different variations and tried replacing the space with '=', still no bueno. Is there a workaround? Note I am using the

Javac vs Java within -classpath option

别说谁变了你拦得住时间么 提交于 2019-12-03 17:03:31
问题 What is the difference in calling the -classpath option from javac and from java for example: javac -classpath MyJar.jar GetJar.java java -classpath MyJar.jar:. GetJar it works as well as: javac -classpath MyJar.jar GetJar.java java GetJar So basically where the first -classpath related to javac needs to be there, on the other hand in the java command line it might be optional. Why? Do you know in which circumstance it would be mandatory. And more in general what is the effect of -classpath

Lower-bounded wild card causes trouble in javac, but not Eclipse

不羁的心 提交于 2019-12-03 16:48:14
问题 This piece of code compiles in Eclipse but not in javac: import java.util.function.Consumer; public class Test { public static final void m1(Consumer<?> c) { m2(c); } private static final <T> void m2(Consumer<? super T> c) { } } javac output: C:\Users\lukas\workspace>javac -version javac 1.8.0_92 C:\Users\lukas\workspace>javac Test.java Test.java:5: error: method m2 in class Test cannot be applied to given types; m2(c); ^ required: Consumer<? super T> found: Consumer<CAP#1> reason: cannot

How can I capture Java compiler errors into a file?

守給你的承諾、 提交于 2019-12-03 16:43:11
I compiled a Java program as javac t1.java > a in order to redirect the error messages to file a . But a doesn't have the error contents (they still appear in the terminal). The command is executed from Linux command prompt. The contents of t1.java is as: class t1 { public static void main(String[] args) { System.out.printn("Hello World!"); // Display the string. } } So now there is an error, i.e. println is written as printn . How can I capture this error message in file a ? Try redirecting the stderr : javac t1.java 2> error_file > foo implies 1> foo where 1 is the stdout stream. In bash, if

Building Java package (javac to all files)

纵然是瞬间 提交于 2019-12-03 16:29:37
问题 How to compile all files in directory to *.class files? 回答1: Well, this seems pretty obvious, so I may be missing something javac *.java (With appropriate library references etc.) Or perhaps: javac -d bin *.java to javac create the right directory structure for the output. Were you looking for something more sophisticated? If so, could you give more details (and also which platform you're on)? 回答2: Yet another way using "find" on UNIX is described here: http://stas-blogspot.blogspot.com/2010

Compile in Java 6, run in 7 - how to specify useLegacyMergeSort?

萝らか妹 提交于 2019-12-03 15:37:39
问题 I'm wondering if I compile in Java 6, but someone runs the program on Java 7, will the Java 6 or 7 version of Arrays.sort be used? It's important because the new mergesort throws an IllegalArgumentException, and the old one doesn't (see Comparison method violates its general contract! Java 7 only) Now, it's possible to compile in Java 7 using Arrays.useLegacyMergeSort, but obviously that flag isn't available for Java 6 - and we want to be compatible on Mac OS Snow Leopard (which uses 6). For

javac treating static final differently based on assignment method

余生长醉 提交于 2019-12-03 15:37:31
When I compile: public static final boolean FOO = false; public static final void fooTest() { if (FOO) { System.out.println("gg"); } } I get an empty method fooTest() {} . However when I compile: static boolean isBar = false; public static final boolean BAR = isBar; public static final void fooTest() { if (BAR) { System.out.println("gg"); } } the if statement is included in the compiled class file. Does this mean there are two different "types" of static final in java, or is this just a compiler optimization? In the first case, the compiler does an optimization. It knows Foo will always be