0

I'm trying to cross-compile a simple java example for ARMv7 target from command line.

What javac options I need to add for cross-compiling?

This is a standard javac command to compile on host machine:

javac -d bin -sourcepath src src/TextPanel.java
aldo85ita
  • 496
  • 2
  • 8
  • 19

2 Answers2

8

javac compiles your code to bytecode which can then be run on a JVM. The bytecode itself is cross-platform: Only the JVM (which interprets that bytecode) is platform dependent. What you need is a JVM that runs on the ARMv7 target.

laobeylu
  • 283
  • 3
  • 14
2

None.

Most Java compilers generate Java byte code which targets a particular JVM spec. The generated code will run on any such VM and you do not need to care about machine architectures beyond "is there a JVM implementation that runs on it?".

Of course there are compilers which generate something else (e.g. gjc) but again, the javac frontend should be fairly standard javac. Compare: when you cross compile C code using the GCC toolchain the only difference in the command line is in chosing which compiler binary to invoke. The flags and parameters to the compiler remain the same, only the name changes (e.g. from gcc to i686-w64-mingw32-gcc).

user268396
  • 11,576
  • 2
  • 31
  • 26