22

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 of Java's design?

The environment is Linux with the Sun J2SE 1.6.0.11 jdk.

Elijah
  • 13,368
  • 10
  • 57
  • 89

1 Answers1

6

Although not exactly an answer to your question, some build environments like ant also support parallelization of builds, so if your dependency graph permits you can have multiple javac's running at the same time.

martin clayton
  • 76,436
  • 32
  • 213
  • 198
krosenvold
  • 75,535
  • 32
  • 152
  • 208
  • 1
    Regarding ant's parallel task: "It should be considered an advanced task which should be used in certain batch-processing or testing situations, rather than an easy trick to speed up build times on a multiway CPU" - http://ant.apache.org/manual/CoreTasks/parallel.html – Alex B Apr 27 '09 at 15:12
  • I think this is the new URL for that page http://ant.apache.org/manual/Tasks/parallel.html – Michael Feb 16 '16 at 19:56