0

I'm using Eclipse 2018-12 with JDK 11.

If I use .class files automatically built by Eclipse to build my jar file, things works fine (the goal is an aar file, for a very simple web service).

But if I use an Ant build, my jar isn't working.

To be clearer: I created a simple Java project, with a package named ws and Serv.java in it; Eclipse automatically created a directory named modules.hello.jigsaw with ws/Serv.class inside.

If I use this class file (and services.xml, of course) to make Serv.jar, all is good.

But if I compile with an Ant build, generating my Serv.class, the aar file is unloadable, it isn't correct.

Probably I'm not using the right javac command.

So, my real question is: is there any way to know "how" Eclipse compiles ? which options it uses when making a javac command ?

Thanks in advance

  • Possibly, you're right. – Virgilio Ravagli Apr 13 '19 at 12:47
  • 1
    In a launch (Run/Debug) configuration there is a _Show Command Line_ button to get the `java` command whose arguments are not the same but similar to the `javac` command. Maybe you can use that as a starting point since there is no such button for `javac`. – howlger Apr 13 '19 at 13:20

1 Answers1

1

Eclipse has implemented its own compiler called as ECJ (Eclipse Java Compiler)

Shashwat
  • 2,342
  • 1
  • 17
  • 33
  • Ok, thank you all. So I have to understand ECJ and then try to "translate" into javac commands – Virgilio Ravagli Apr 13 '19 at 12:46
  • 1
    @VirgilioRavagli You shouldn't need to understand ECJ, it doesn't do anything particularly special. Most likely there is something wrong with your ant build.xml. – greg-449 Apr 13 '19 at 12:53
  • 1
    The same code and the same ant build work fine if I add source and target =1.8 in the tag. I guess it's related to modularity, even if I'm not using modules – Virgilio Ravagli Apr 14 '19 at 19:59