Compiles in Eclipse, but not with Javac from the command line: StackOverFlow

I have a Java project containing many very large source files and it compiles fine in Eclipse, however it will not compile with javac from the command line or inside Ant.

When I try to compile it from a command using javac (or using Ant), I get a StackOverflow exception:

   [javac] java.lang.StackOverflowError
   [javac]  at com.sun.tools.javac.jvm.Gen.genCond(Gen.java:786)
   [javac]  at com.sun.tools.javac.jvm.Gen.genCond(Gen.java:739)
   [javac]  at com.sun.tools.javac.jvm.Gen.visitBinary(Gen.java:1841)
   [javac]  at com.sun.tools.javac.tree.Tree$Binary.accept(Tree.java:926)
   [javac]  at com.sun.tools.javac.jvm.Gen.genExpr(Gen.java:806)
   [javac]  at com.sun.tools.javac.jvm.Gen.genCond(Gen.java:786)
   ...
   ...
   ...

I tried passing a few JVM arguments, such as -Xss, -Xmx, -Xoss, etc. both on the command line and in the Ant javac task, but always get the same error.

From what I read, it seems that the Eclipse IDE has a compiler different from the Sun JDK. Is there a way to get the JDK to compile similarly to Eclipse?

Thanks Stef


This is strange, but I found that I could compile code with JDK 1.6.

, lib , , JDK 1.5 ( ).

- , 1.6, 1.5 ?

+3
3

"javac" , JVM "-J". ; -J-Xms48m .

javac (1).

StackOverflowError s, , , - ; -J-Xss5m.

, , JDK 1.6.

, :

  • javac, ​​ JDK 1.6 JDK 1.5,
  • javac JDK 1.6 ,
  • javac.

: http://bugs.sun.com/bugdatabase/view_bug.do?bug_id=6273455

... 1.5 ?

, , , , , . , , , JDK 1.5 . :

  • , , . , , , .

  • , Sun JDK 1.6 -source 1.5 -target 1.5.

+3

, , ( , , , ). , javac , .

+1

You should be able to tell Eclipse to use the same JDK as your shell.

I believe that the Eclipse JDK is owned by IBM, so that might explain the difference.

0
source

Source: https://habr.com/ru/post/1751533/


All Articles