javac

How do I pass javac multiple command-line arguments, some of which include colon, without breaking Maven release plugin?

人盡茶涼 提交于 2019-12-30 09:44:24
问题 I want to make my Maven build fail when I forget to declare serialVersionUIDs in a Serializable class. With javac , that's easy: $ javac -Xlint:serial -Werror Source.java Directly translating that to Maven doesn't work: <plugin> <groupId>org.apache.maven.plugins</groupId> <artifactId>maven-compiler-plugin</artifactId> <version>2.5.1</version> <configuration> <compilerArgument>-Xlint:serial -Werror</compilerArgument> </configuration> </plugin> The compilerArgument is quoted, so javac receives

Passing arguments to compiler and javadoc in gradle

时光毁灭记忆、已成空白 提交于 2019-12-30 08:32:39
问题 I am trying to provide Gradle as an alternative build system on an existing project. That project makes use of sun.misc.Unsafe which leads to warnings like this one: warning: Unsafe is internal proprietary API and may be removed in a future release import sun.misc.Unsafe; To suppress this warning -XDignore.symbol.file is passed as an argument to javac and javadoc in the current ant script. In order to suppress these warnings in Gradle I had to resort to what I feel are 'dirty' hacks that I am

How does javac automatically compile dependencies of a class

廉价感情. 提交于 2019-12-30 01:00:09
问题 Given the following directory structure: /top |--- wrk |--- pkg |--- A.java |--- B.java Assume that the two files A.java and B.java contain the following code, respectively: // Filename: A.java package pkg; class A { B b; } // Filename: B.java package pkg; class B {...} Assuming that the current directory is /top/wrk Why does the command javac -cp . pkg/A.java work successfully even though we have not yet compiled B.java ? Also if the current directory is /top/wrk/pkg then the command javac A

importing external jar files

谁说胖子不能爱 提交于 2019-12-30 00:41:31
问题 I have written a Java code which imports an external jar file. How can I compile and run it on the command-line? Thanks in advance! 回答1: Compiling from the command-line: javac -cp path_to_jar1.jar:path_to_jar2.jar Example.java Running: java -cp .:path_to_jar1.jar:path_to_jar2.jar Example For Windows, use ; as a path-separator (instead of : ). 来源: https://stackoverflow.com/questions/4421730/importing-external-jar-files

Compilation hangs for a class with field double d = 2.2250738585072012e-308

一个人想着一个人 提交于 2019-12-29 08:35:13
问题 I have come across an interesting situation. A coworker committed some changes, which would not compile on my machine neither from the IDE (Eclipse) nor from a command line (Maven). The problem manifested in the compilation process taking 100% CPU and only killing the process would help to stop it. After some analysis the cause of the problem was located and resolved. It turned out be a line "double d = 2.2250738585072012e-308" (without semicolon at the end) in one of the interfaces. The

Creating a PHP Online Grading System on Linux: exec Behavior, Process IDs, and grep

丶灬走出姿态 提交于 2019-12-29 07:14:22
问题 Background I am writing a simple online judge (a code grading system) using PHP and MySQL. It takes submitted codes in C++ and Java, compiles them, and tests them. This is Apache running PHP 5.2 on an old version of Ubuntu. What I am currently doing I have a php program that loops infinitely, calling another php program by //for(infinity) exec("php -f grade.php"); //... every tenth of a second. Let's call the first one looper.php and the second one grade.php . (Checkpoint: grade.php should

Discover the class of a methodinvocation in the Annotation Processor for java

时光毁灭记忆、已成空白 提交于 2019-12-29 04:24:13
问题 I am writing some tools for our build system to enforce some strict calling conventions on methods belonging to classes containing certain annotations. I'm using the Compiler Tree API... What i'm wondering is when traversing the 'tree', how can you tell the type of class/interface for a MethodInvocation. I'm subclassing TreePathScanner with : @Override public Object visitMethodInvocation(MethodInvocationTree node, Trees trees) { } I'm hoping theres a way to tell the type of the class(or

Unable to locate an executable at “/usr/bin/java/bin/java” (-1)

百般思念 提交于 2019-12-29 03:32:06
问题 I am having a pathetic issue with Java in my mac osx 10.7.3 . Previously I installed it and it was working fine. After some changes in the .bash_profile and .profile file in the course of time, I am having an error like Unable to locate an executable at "/usr/bin/java/bin/java" whenever I try to run "javac" or "java" in my terminal . echo $PATH gives an output like : /usr/bin:/bin:/usr/sbin:/sbin:/usr/local/bin:/Users/sabya/Documents/Play_Framework/play-2.0:/usr/X11/bin:/usr/local/git/bin:

how to compile multiple java files when there are java files in other packages

元气小坏坏 提交于 2019-12-28 10:06:23
问题 I am compiling multiple files in a directory (javac *.java) but I have a problem when I try to do this: I get compile errors saying that say javac cannot find a symbol of an object. I have multiple packages that contain java files that are needed to run the main program. But it seems that trying to compile these one by one won't work. It runs fine in my IDE but I'm interested in learning how it's done via Command Prompt. The main program is in the drivers folder. I have tried compiling the

How to set a java compiler in Netbeans

人走茶凉 提交于 2019-12-28 03:04:37
问题 I'm getting into Java7 development and I've added JDK7 into Java Platforms and have selected it in the project properties. But when I'm compiling, I get messages like: warning: java/lang/Boolean.class(java/lang:Boolean.class): major version 51 is newer than 50, the highest major version supported by this compiler. It is recommended that the compiler be upgraded. and javac: invalid target release: 1.7 /Applications/NetBeans/NetBeans 7.1.app/Contents/Resources/NetBeans/harness/suite.xml:184: