javac

Ant : Compile failed; see the compiler error output for details

妖精的绣舞 提交于 2019-12-01 20:53:32
问题 I want to run "ant build-project" a project build.xml. <javac deprecation="true" includeantruntime="false" debug="true" debuglevel="${debuglevel}" destdir="${project.build.outputpath}" verbose="true" encoding="UTF-8"> <src path="${project.src.classes}" /> <compilerarg value="-Xlint" /> <classpath refid="core.classpath" /> </javac> <path id="core.classpath"> <pathelement location="${project.build.outputpath}" /> <pathelement location="${test.dir}" /> <fileset dir="${project.build.libpath}">

Which javac.exe is used by ant javac task?

只谈情不闲聊 提交于 2019-12-01 20:49:14
I am facing one problem. I renamed javac.exe on my machine and noticed that ant javac task still works fine. Does anybody know from where its getting javac.exe? Actually, I believe, that by default Ant tries to execute the java compiler class directly with this code: try { Class c = Class.forName ("com.sun.tools.javac.Main"); Object compiler = c.newInstance (); Method compile = c.getMethod ("compile", new Class [] {(new String [] {}).getClass ()}); int result = ((Integer) compile.invoke (compiler, new Object[] {cmd.getArguments()})) .intValue (); return (result == MODERN_COMPILER_SUCCESS); }

Setting javac options for SBT dependencies

早过忘川 提交于 2019-12-01 19:52:48
I am having problems compiling a Java dependency loaded via GIT: object ApplicationBuild extends Build { lazy val project = Project("root", file(".")).dependsOn(RootProject(riakJavaClient)) lazy val riakJavaClient = uri("git://github.com/basho/riak-java-client") } The error I am receiving from sbt compile is: [info] Compiling 134 Java sources to /Users/lawrencewagerfield/.sbt/0.13/staging/da0e66c4764a467c8977/riak-java-client/target/scala-2.10/classes... [error] /Users/lawrencewagerfield/.sbt/0.13/staging/da0e66c4764a467c8977/riak-java-client/src/main/java/com/basho/riak/client/cap/Quorum.java

Can I tell javac to ignore the lack of `import foo.Bar`?

百般思念 提交于 2019-12-01 19:30:12
I'm using reflection to load MyClass.class (an external file) at runtime. MyClass.class uses the library Bar , which would mean that I need to place import foo.Bar; at the top of the file. However, the Bar library is already loaded in the main class loading MyClass . Is there a way for me to tell javac to ignore that Bar doesn't exist and just compile without it? No this is not possible. When compiling a class, the compiler has no "memory" of which classes were already "loaded" (don't confuse this with the concept related to classloading -- that's a completely different story). Whenever a

Exception in thread “main” java.lang.UnsatisfiedLinkError: no lwjgl in java.library.path

馋奶兔 提交于 2019-12-01 17:16:50
I'm building the basic Slick game example explained here: http://slick.cokeandcode.com/wiki/doku.php?id=01_-_a_basic_slick_game , and I'm running into some problems. Specifically, the game compiles just fine, but when I try to run it, Java complains: Exception in thread "main" java.lang.UnsatisfiedLinkError: no lwjgl in java.library.path at java.lang.ClassLoader.loadLibrary(ClassLoader.java:1856) at java.lang.Runtime.loadLibrary0(Runtime.java:845) at java.lang.System.loadLibrary(System.java:1084) at org.lwjgl.Sys$1.run(Sys.java:75) at java.security.AccessController.doPrivileged(Native Method)

Why javac does not optimize even simple code?

一笑奈何 提交于 2019-12-01 16:58:56
Given the following code: public class MainClass { public static int f(){ int i=0; i++; return i; } } the compiler javac produces the following code: Compiled from "MainClass.java" public class latte_jvm.MainClass { public static int f(); Code: 0: iconst_0 1: istore_0 2: iinc 0, 1 5: iload_0 6: ireturn } Function f does really simple thing - it just returns 1. It's so directly translated that it makes me hard to believe that java compiler does any optimizations at all. Why java compiler creators decided to not do such optimizations in the compilation phase? Is so directly translated that it

Error compiling Java file with special characters in class name

…衆ロ難τιáo~ 提交于 2019-12-01 16:57:10
I am encountering an issue compiling a source file with a special character in the class name. The class file compiles fine in the Eclipse IDE, but not from javac. I believe I need to leverage the -encoding flag, but haven't hit the right setting yet. I would appreciate any pointers: File Name: DeptView和SDO.java Java Source: public interface DeptView\u548cSDO { public int getDeptno(); public void setDeptno(int value); } Error Message: Running javac *.java results in the following error message: javac: file not found: DeptView?SDO.java UPDATE I am currently trying the compile at a Windows XP

Error compiling Java file with special characters in class name

我的梦境 提交于 2019-12-01 16:52:49
问题 I am encountering an issue compiling a source file with a special character in the class name. The class file compiles fine in the Eclipse IDE, but not from javac. I believe I need to leverage the -encoding flag, but haven't hit the right setting yet. I would appreciate any pointers: File Name: DeptView和SDO.java Java Source: public interface DeptView\u548cSDO { public int getDeptno(); public void setDeptno(int value); } Error Message: Running javac *.java results in the following error

Java 1.7 varargs function reported as unchecked warning

喜夏-厌秋 提交于 2019-12-01 15:03:33
We use some varargs functions and as we move to java 1.7 we are getting a strange unchecked warning. Function add in interface ICache public interface ICache<O> { void add(Object source, O... objects); } in an interface reports the error. ICache.java:18: warning: [unchecked] Possible heap pollution from parameterized vararg type O void add(Object source, O... objects); where O is a type-variable: O extends Object declared in interface ICache 1 warning O extends Object, as its generic cache class. I read the xlint warnings and we do compile with unchecked on, but http://docs.oracle.com/javase/7

Why does this code compile in Java 1.6 but not in Java 1.7?

痴心易碎 提交于 2019-12-01 15:02:22
The following code compiles fine in Java 1.6 but fails to compile in Java 1.7. Why? The relevant part of the code is the reference to the private 'data' field. The reference is from within the same class in which the field is defined, and so seems legal. But it is happening via a generically-typed variable. This code - a stripped down example based on a class from an in-house library - worked in Java 1.6 but doesn't now in Java 1.7. I'm not asking how to work around this. I've already done that. I'm trying to find an explanation of why this doesn't work any more. Three possibilities come to