javac

Correctly Importing Apache Commons Math Package

 ̄綄美尐妖づ 提交于 2019-12-12 21:30:06
问题 I am trying to use the SimplexSolver class in the Apache Commons Math package, but I can't seem to import the package correctly; all of the following is happening in a fixed directory called 'Java'. I downloaded commons-math3-3.1.1 and put the unzipped folder into the 'Java' directory. Here is some example code, HelloWorld.java, saved in the 'Java' directory: import org.apache.commons.math; public class HelloWorld { public static void main (String[] args) { System.out.println("Hello World!");

Compiling Java Server Pages (JSP) in a WAR file to Class files

人走茶凉 提交于 2019-12-12 21:26:33
问题 I have a test WAR file that I generated from source. When I unzip the WAR file I see that the Java classes were compiled to .class files, but the .jsp files were not compiled. I understand this is done at runtime and the .jsp files are eventually converted to .class files. I developed my WAR file in Tomcat7. I realize this is an odd question. The end goal is to develop a static analysis tool which runs on class files (I cannot read jsp files). I've read that I can optimize the WAR file and

Java compiler under Eclipse/Ant defaults to %JAVA_HOME%?

社会主义新天地 提交于 2019-12-12 21:04:49
问题 I recently encountered a build environment behavior that I need to better understand: Overview of my freshly installed workstation: Installed jdk1. 6 .0_45, then jdk1. 7 .0_80, then jdk1. 8 .0_131. %JAVA_HOME% is set to C:\Program Files\Java\jdk1.8.0_131\ Installed Eclipse Kepler (4.3.2) I then manually (by way of unzipping) added to C:\Program Files\Java the following: jdk1. 7 .0_45, jre1. 7 .0_76, jre1. 7 .0_79. Checked out a legacy Ant-based project, designed to run under JRE7 only. My

How do you increase the maximum heap size for the javac process in Borland JBuilder 2005/2006

﹥>﹥吖頭↗ 提交于 2019-12-12 18:34:08
问题 In most modern IDEs there is a parameter that you can set to ensure javac gets enough heap memory to do its compilation. For reasons that are not worth going into here, we are tied for the time being to JBuilder 2005/2006, and it appears the amount of source code has exceeded what can be handled by javac. Please keep the answer specific to JBuilder 2005/2006 javac (we cannot migrate away right now, and the Borland Make compiler does not correctly support Java 1.6) I realize how and what

Eclipse gives dead code warning for reachable code

℡╲_俬逩灬. 提交于 2019-12-12 18:27:22
问题 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 class DeadCodeDemo { public static class SomeClosable implements AutoCloseable { @Override public void close() throws Exception { } } public static ArrayList<String> throwRuntime() { throw new RuntimeException(); } public static void main(String[] args) { ArrayList<String> list = null; try { try

Disable StringBuilder optimisation in javac

非 Y 不嫁゛ 提交于 2019-12-12 15:16:03
问题 When using normal string concatenation in Java, javac will optimise this where it can to use StringBuilder instead (or StringBuffer before Java 5.) In my case, it'd be incredibly helpful to switch all this off, and just have string concatenation use the bog standard "append" method on String instead. Is this optimisation fully "baked in" to javac, or is there a way to disable it at all? 回答1: I'm not a javac expert but it seems to be hardcoded in javac in the Gen.java file from line 1793. 回答2:

Why does this program compile with Java 7 but not Java 8? [duplicate]

孤人 提交于 2019-12-12 10:57:02
问题 This question already has answers here : Generics compilation error with ternary operator in Java 8, but not in Java 7 (3 answers) Closed 4 years ago . Consider this program: public class xx<T> { <T> Iterable<T> createIterable(Class<T> cls) { return null; } Iterable<? extends Number> createNumberIterable(boolean floatingPoint) { return this.createIterable(floatingPoint ? Integer.class : Float.class); } } Under Java 7 it compiles: $ java -version java version "1.7.0_45" Java(TM) SE Runtime

Error when using javac: “javac: invalid flag: -s”

妖精的绣舞 提交于 2019-12-12 10:43:45
问题 I am trying to specify another version of JDK in maven-compiler-plugin . When -target and -source parameters are set to 1.5, everything is ok. But when i try to use 1.6 JDK, maven reports an error. Has anyone faced this problem? Error: Failure executing javac, but could not parse the error: javac: invalid flag: -s Usage: javac where possible options include: -g Generate all debugging info -g:none Generate no debugging info Thanks. 回答1: If you use 1.6 flag your JAVA_HOME should point to JDK 1

Running a java program with multiple jar files and classes [duplicate]

旧巷老猫 提交于 2019-12-12 10:18:42
问题 This question already has answers here : What does “Could not find or load main class” mean? (46 answers) Closed last year . I am compiling a program with multiple jar files (inside the lib folder) and classes (inside the src/com folder) with: javac -classpath lib/\* src/com/*.java I typed this to run the program: java -cp lib/\* src/com/okc But it doesn't work. Instead, I get this: Error: Could not find or load main class src.com.okc okc.java is the class containing the main method. How can

Why this code compiles with jdk8u45 and above but not with jdk8u25?

不羁岁月 提交于 2019-12-12 09:29:31
问题 Please, could someone help me to figure out why the following code compiles with jdk8u45 and above but fails with jdk8u25? I looked through the JDK release notes but didn't find anything related to the issue or maybe missed it. The code public class Main { static class Param { final int id; Param(int id) { this.id = id; } } static class Subtask { final Param param; Subtask(Param param) { this.param = param; } } public static void main(String[] args) { List<? extends Param> params = IntStream