linux - gcc -x java on debian stretch -
the using gnu compiler collection manual gcc version 6.3.0 indicates support language option -x java on page 28 (page 42 of pdf). attempting on debian stretch:
$ gcc -x java helloworld.java gcc: error trying exec 'ecj1': execvp: no such file or directory installing seems required package:
$ sudo apt-get install ecj1 reading package lists... done ... unpacking ecj1 (3.11.1-1) ... setting ecj1 (3.11.1-1) ... .... reading state information... done however, same error message when running gcc after this. in fact looking /usr/bin, no executable ecj1 has been installed, , running apt-cache search ecj1 not suggest other package 1 have installed.
$ gcc --version gcc (debian 6.3.0-11) 6.3.0 20170321 $ uname -a linux right 4.8.0-1-amd64 #1 smp debian 4.8.5-1 (2016-10-28) x86_64 gnu/linux any suggestion else try running?
the gnu compiler java has installed:
$ apt-get install gcj-4.9 gcj-4-9-jdk use apt-file search packages containing ecj1 file. note apt-cache searches package names/descriptions matching search.
after installation able run using
$ gcj-4-9 helloworld.java instead of gcc.
even though gcj front-end gcc, gcc didn't work me , complaining classpath not being set. gcc working, require different, more complex command.
if you're compiling class contains main method, use --main option.
$ gcj-4-9 --main=helloworld helloworld.java
Comments
Post a Comment