RE: Fwd: gcj can not import packages

"Bill Chatfield via java" <[email protected]> Mon, 16 Jan 2017 12:40:55 -0500
Newsgroups gmane.comp.gcc.java.devel
Message-ID <[email protected]>
I understand that OpenJDK is available as open source now, to "replace" gcj=
. But, gcj still has certain advantages that OpenJDK does not have:

1. gcj can compile to a native executable. OpenJDK cannot do this. It is a =
great feature for distributing programs that don't require a JRE to also ex=
ist on all the target machines. As a Java developer this is often a hurdle =
that cannot be overcome as there are users that absolutely refuse to instal=
l Java. It also makes it easier to invoke the application because running a=
n executable is many times easier than running a Java program that requires=
 a CLASSPATH setup and possibly other complex command line arguments to run=
 properly. That kind of setup is beyond the ability of end-users. But runni=
ng a single executable is not.

Compiling to a native executable may violate the intent of Java, but I don'=
t really care. There are times when this is necessary. As a Java developer,=
 most of the time you want to create .class files, but sometimes you really=
 need a native executable.

2 gij is more memory efficient than OpenJDK at runtime. Gij may not execute=
 programs as fast and the native executables generated by gcj might not be =
as fast as OpenJDK. But they're still faster than Python programs :-) and t=
hey use less memory than the standard OpenJDK JVM. This is again a great th=
ing when you're targeting end users where memory usage is important, rather=
 than corporate servers where it doesn't matter how much RAM you waste.

3. OpenJDK only supports a few platforms. It is very hard to get it to work=
 on platforms besides the officially supported ones. But, gcj, being based =
on gcc is a lot more portable, allowing Java programs (if they're written t=
o work with gcj) to run on a wider range of platforms. Case in point: my Ma=
c PowerBook G4 with OSX 10.4.11. It has a good version of Java 1.5 from App=
le, but if gcj were updated I wouldn't be stuck on an old version of Java. =
I understand my PowerBook is not much more than a toy at this point, but it=
 does show the types of problems that gcj could solve on platforms that cou=
ld be more important, like small devices for the "Internet of Things". Open=
JDK really isn't even available on Windows as production product. But gcj c=
ould be.

Also, I feel that gcj was a great achievement on the part of the FSF and th=
e open source community. It's nothing to be ashamed of. It shows the resour=
cefulness and ingenuity of the community.


-----Original Message-----
From: [email protected] [mailto:[email protected]] On Behalf Of A=
ndrew Haley
Sent: Wednesday, November 09, 2016 8:30 AM
To: mohan NMH <[email protected]>
Cc: [email protected]
Subject: Re: Fwd: gcj can not import packages

On 09/11/16 12:49, mohan NMH wrote:
> On Wed, Nov 9, 2016 at 5:55 PM, Andrew Haley <[email protected]> wrote:
>> On 09/11/16 11:29, mohan NMH wrote:
>>> Can someone help me to understand why gcj can not import packages=20
>>> while javac can? Any CLASSPATH setting required?
>>
>> java.util.Objects is Java 1.7.  gcj is at the level of 1.4 - 1.5.
>=20
> Thanks Andrew. Could you please let me know what makes gcj at level of
> 1.4 - 1.5? Is it /usr/share/java/eclipse-ecj.jar?

It's the GCJ runtime library.

> Before this installation I tried with
> --with-ecj-jar=3D/usr/share/java/ecj4.4.jar. But the gcj failed to load=
=20
> org.eclipse.jdt.internal.compiler.batch.GCCMain.class. The ecj4.4.jar=20
> contains org.eclipse.jdt.internal.compiler.batch.Main.class while=20
> eclipse-ecj.jar contains=20
> org.eclipse.jdt.internal.compiler.batch.GCCMain.class. Therefore I=20
> chose eclipse-ecj.jar
>=20
> Please advise how to upgrade gcj to Java 1.8

It'd take a few programmer-years of work, I suspect.  Maybe one programmer =
could do it in a year, but that programmer would have to be very expert.

GCJ is obsolete and its sources have been deleted from GCC.

Andrew.