This is the mail archive of the java@gcc.gnu.org mailing list for the Java project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: Release of javaCompiler 0.4 (has a gcj 4.1.1 core)


Hi.

Thanks a lot for your enlightenment. I was thinking that this analysis
may be useful for other beginners like me so I posted this to this
mailing list instead. :)

Here is the result of my further tests.

1. Using the JavaCompiler, I managed to compile the SwingMinimal.class
(and SwingMinimal$Hello.class in the "3_swing_minimal_class" folder)
into the native executable. My manual way of typing in the command
line to compile the SwingMinimal.class using GCJ failed as expected
because I did not do any mapping of AWT and Swing into SwingWT.

2. Both the JavaCompiler and my manual way of compiling the
SwingMinimal.java (in "2_swing_minimal" folder) from the command line
failed due to the usage of generics. I tried using Sun's javac and it
was successful.

3. (2) was repeated using a "modified-into-importing-SwingWT-package"
SwingMinimal.java and the results are the same.

4. Executing the bytecode produced from (2) and (3) were successful
using Sun's java.exe as expected. For (2), it was the usual window
that has a Java-look. For (3), it was a window that has a
Windows-look. Repeating this step with gij.exe (for bytecode produced
in (3) only) gave this output:

	hallo -> java.lang.String
	5 -> java.lang.Integer
	2
	4
	Exception in thread "Thread-2" java.lang.ExceptionInInitializerError
		at <some address> (Unknown source)
		at <some address> (Unknown source)
		...
		at <some address> (Unknown source)
	Caused by: java.lang.NullPointerException
		at <some address> (Unknown source)
		at <some address> (Unknown source)
		...
		at <some address> (Unknown source)

With regards to (2) and (3), I wonder if the .class files in (1)
produced from the .java file in (2) are compiled using javac or GCJ?
If GCJ was used, how did you solve the problems in (2) and (3)? I read
somewhere that GCJ doesn't support generics but GCJX does? Anyway, I
removed the part of the code where generics was used, and compiling
using the GCJ was fine. Executing it gave the exact the same results
mentioned in (4).

I wonder how should the problem in (4) be solved?


On 6/14/06, Marco Trudel <mtrudel@gmx.ch> wrote:
Hello dezumondo

GCJ doesn't support swing (thus gij doesn't support it too). To use
swingWT, you've to change the imports:
       java.awt -> swingwt.awt
       javax.swing -> swingwtx.swing

If you compile the .class or .java swing tests with javaCompiler, this
will be done automatically (if managed AWT/Swing project choosen)...

If you want to use gij, it's probably the easiest to change the imports
in the source and compile it with javac or gcj to bytecode.
Additionally you could use BCEL to change the imports in the bytecode
file, but there are some problems with that, because swingWT doesn't
follow the "Constant Field Values" as defined by java.

regards
Marco


dezumondo wrote: > Hi. > > I thought you are only releasing the GCJ core, but you really > surprised me with the release of JavaCompiler that not only has the > GCJ core, but also compatible with other libraries such as the > SwingWT. You really did a wonderful job! > > Just wondering, how do I execute the SwingMinimal.class in the "tests" > folder using gij.exe? With the Sun's Java Runtime Engine in my system > path, I typed "java SwingMinimal" in the "3_swing_minimal_class" > folder and the new window with the "click on me" button appears > correctly. But if I typed "gij SwingMinimal" instead, the following > exception appears. I have tried looking up for answers in the mailing > list and in Google but to no avail. > > Exception in thread "main" java.lang.NoClassDefFoundError: SwingMinimal > at <some address> (unknown source) > at <some address> (unknown source) > ... > at <some address> (unknown source) > Caused by: java.lang.ClassNotFoundException: javax.swing.JFrame not > found in gnu.gcj.runtime.SystemClassLoader{urls=[file:.\], > parent=gnu.gcj.runtime.ExtensionClassLoader{urls=[], parent=null}} > at <some address> (unknown source) > at <some address> (unknown source) > ... > at <some address> (unknown source) > ...6 more > > > > On 6/13/06, Marco Trudel <mtrudel@gmx.ch> wrote: >> Hello list >> >> Because I got some requests for my successful windows gcj 4.1.1 build, I >> release my javaCompiler a couple of weeks earlier than I initially >> intended. >> JavaCompiler combines several programs and utilties with the goal, to be >> a powerful and easy to use tool for java to native compilation. >> >> It allows >> - to use most of the java 1.5 language features >> - easy compilation of SWT, JFace, AWT and Swing GUI programs >> - to create executables with fair size: >> a simple System.out.println() creates a 1.55mb file (with gcc >> 3.4.5, it was 1.21mb) >> a simple SWT program creates a 2.78mb file >> >> Currently only windows is supported as output format. The next step will >> be to add support for linux. >> JavaCompiler can be found here: http://javacompiler.mtsystems.ch >> >> The homepage is still pretty empty (as I said, I make it available >> earlier than intended). I hope to update it pretty frequent during the >> next couple of weeks... >> >> >> I'd be glad to get some feedback... >> >> regards >> Marco >> > >



Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]