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 specifi...
here is my directory structure.
/user/a
/user/b
/user/b
inside folder a,b,c there is a file person.java (it is the Same file, just a one line modification.
now, on my shell, im on my /user/ directory and i try to do
javac */person.java
the shell returns the following error,
person.java:14: duplicate class: person
Is there any...
Is it possible to access the Abstract Syntax Tree(AST) inside the javac.exe programmatically? Could you provide an example?
...
Say I have my sources in my src/ tree (and possibly in my test/ tree). Say I would like to compile only part of that tree. The reasons why I might want to do that are various. Just as an example, I might want to create the smallest possible jar (without including certain classes), or I might want the fastest compile time for what I am co...
If I switch on the generating of debug info with Javac then the class files are 20-25% larger. Has this any performance effects on running the Java program? If yes on which conditions and how many. I expect a little impact on loading the classes because the files are larger but this should be minimal.
...
The code at the end produces a compile error:
NotApplicable.java:7: run() in cannot be applied to (int)
run(42);
^
1 error
The question is why? Why does javac think I am calling run(), and does not find run(int bar)? It correctly called foo(int bar). Why do I have to use NotApplicable.this.run(42);?...
This question is a follow up to:
Why can’t I call a method outside of an anonymous class of the same name
This previous question answer why, but now I want to know if javac should find run(int bar)? (See previous question to see why run(42) fails)
If it shouldn't, is it due to a spec? Does it produce ambiguous code? My point is, I t...
My usage case is compiling generated source files from a java program using the ToolProvider and JavaCompiler classes provided in JDK 6. The source files contain references to classes in the context classloader (it runs in a J2EE container), but not in the system classloader. My understanding is that by default the ToolProvider will cre...
I'm trying to redirect the java compiler output to a file.
I thought it's supposed to be:
javac file.java > log.txt
or something. Instead, I see all the output on the terminal and nothing in log.txt!
Also, if I want to log errors too, do I do
javac file.java 2>&1 > log.txt
?
...
My coworker noticed that when javac is compiling it only utilizes a single core. Is there anything like the -j command with the gcc for Java that will allow us to distribute the compiler workload across cores or processors? If not, do you think that this will ever be possible or is there some sort of fundamental restriction as a result o...
The syntax sugar provided by Java's enum facility can sometimes be a little confusing. Consider this example, which does not compile:
public enum TestEnum {
FOO("foo") {
public void foo() {
helper(); // <- compiler error
}
};
String name;
TestEnum(String name) {
this.name = name;
...
I have an app that was compiled with the built-in Eclipse "Compile" task. Then I decided to move the build procedure into Ant's javac, and the result ended being smaller files.
Later I discovered that adjusting the debuglevel to "vars,lines,source" I could embed the same debug information that Eclipse did, and in a lot of cases files st...
The reason is long and boring, but I need to run an Ant script to compile Java 1.5 code from a Java 1.4 app. I keep getting this error, though:
BUILD FAILED
build.xml:16: Unable to find a javac compiler;
com.sun.tools.javac.Main is not on the classpath.
Perhaps JAVA_HOME does not point to the JDK.
It is currently set to "C:\j2sdk1.4.2...
I have a Java Maven project with about 800 source files (some generated by javacc/JTB) which is taking a good 25 minutes to compile with javac.
When I changed my pom.xml over to use the Eclipse compiler, it takes about 30 seconds to compile.
Any suggestions as to why javac (1.5) is running so slowly? (I don't want to switch over to the...
Is there any Java compiler flag that one can pass to tell the compiler to disallow the use of raw types? That is, for any generic class, let the compiler force that the parameterized version be used, and throw a compilation error otherwise?
...
The question tells it all.
For the experts, is there a reason the SUN java 5 compiler accepts recursive annotations (contrary to the langspec), while the later compilers do not? I mean, what could be an argument against recursive annotations.
Edit: a recursive annotation is something like:
@Panel(layout=BorderLayout.class,
nested=...
Who is right? Eclipse or javac?
--------------- c/v/A.java ---------------
package c.v;
public class A<T> {
}
--------------- c/v/B.java ---------------
package c.v;
public class B extends A<B.Secret> {
private class Secret {};
}
Eclipse compiles B.java just fine.
Javac has a problem.
$ javac c/v/B.java
c/v/B.java:3: c.v.B.Sec...
I find java starts up and runs practically instantly for me - but javac takes a few seconds, and ant makes it slower again. It's only a few seconds, but my edit-compile-test loop would be smoother without it. :-)
BTW: I've already used vim's ":make" with ant.
Is there a way to speed up javac and/or ant? I'm thinking of special switc...
I'm working on a very large project that has associated class files in multiple directories, all stemming from the root dir \src.
I'm trying to compile a file in src\solution\ (called Console.java) that uses imports from other directories in the src, which are still uncompiled.
So if I want to compile Console.java outside of an IDE, ho...
Hi, I'm working on an automation project for my employer. We have a pool for each revision of our source code. When you download a revision, you need to create a directory structure with a bunch of third party includes to eventually build the project. I've automated this entire process up to the point of having my script (.bat) compile e...