Folks, I hope this is not stupid question for this mailing list.
A year ago I wrote, purely for amusement and self teaching after I
retired, a program in Java which was intended to be cross-platform, and
accessible both as a straight jar archive, and also as an applet in a
web-page. In addition, it can be run without any graphical interface
(controlled by a command line switch), so it can be used to generate
things offline in a script. I surprised myself and got it working
precisely as I expected. (It remains the only java program I've
written.)
I was using Sun Java JDK 1.4 initially, but the system I was using has
had its Linux (Suse) upgraded and it now has Sun's 1.5, but the builds
still worked and the results are fine. There is only simple use of
swing as I was learning as I went.
I've put Kubuntu on a laptop, and before messing around with Sun's
Java, I thought I'd give gcj a try as it comes with the installation.
However, I've immediately hit serious problems.
1. I first tried using gij on the existing (Sun generated) jar files. It
starts, but the initial display is wrong (two of the text panes contain
only the first line of text, and not the rest). It responds very slowly
- we're talking an order of magnitude or more slower than Sun's java.
And the display does not always get updated after an action, but only
after something else triggers a rewrite, but I can't figure out what
triggers it. There are other problems with the text pane, too as it
seems to produce multiple copies of the text put into it. But on the
whole it seems to work, although it is not usable in practice.
2. When I added the no-display parameter to the invocation the output
came out rapidly and correctly, so it looks like it is swing that is
far too slow. I also noticed that it threw up the following at the
beginning, even though it should not have even tried to display
anything at all.
[quote]
X Error: BadDevice, invalid or uninitialized input device 166
Major opcode: 145
Minor opcode: 3
Resource id: 0x0
Failed to open device
X Error: BadDevice, invalid or uninitialized input device 166
Major opcode: 145
Minor opcode: 3
Resource id: 0x0
Failed to open device
[/quote]
3. I then tried to run the make using gcj and fastjar. It compiled
and created the jar archives without any failures being reported, but an
attempt to run the resulting file got this:
[quote]
andrew@laptop:~/Dev/Products/Sokuku/1.0-3$ gij -jar Sokuku-en-1.0-3.jar
Failed to load Main-Class manifest attribute from Sokuku-en-1.0-3.jar
[/quote]
I'd like to know whether it is worthwhile trying to do any more, or
should I wait until a later version of gcj? - bearing in mind I do not
have much time to tinker with things these days. Or should I wait until
Sun's java appears as a regular Ubuntu package probably later this year?
I found Dan Bolser's howto from 2004 but he seems to be generating
native code which I'm not interested in because I want cross-platform
use. Is there a howto for a simple java "Hello world" from a jar file
anywhere?
Version information:
[quote]
andrew@laptop:~$ gij --version
java version "1.4.2"
gij (GNU libgcj) version 4.1.0 (Ubuntu 4.1.0-1ubuntu8)
Copyright (C) 2006 Free Software Foundation, Inc.
This is free software; see the source for copying conditions. There is
NO
warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR
PURPOSE.
andrew@laptop:~$ gcj --version
gcj (GCC) 4.1.0 (Ubuntu 4.1.0-1ubuntu8)
Copyright (C) 2006 Free Software Foundation, Inc.
This is free software; see the source for copying conditions. There is
NO
warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR
PURPOSE.
andrew@laptop:~$ jar --version
jar (fastjar) 0.92-gcc-4.0
Copyright 1999, 2000, 2001 Bryan Burns
Copyright 2006 Free Software Foundation
This is free software; see the source for copying conditions. There is
NO
warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR
PURPOSE.
andrew@laptop:~$
[/quote]
Could it be useful as a test case? A description of the program is to
be found at
http://www.pepperdine.eclipse.co.uk/Sudoku/Description.htmlwhich links to both a README text file giving details of the parameters
that can be passed, as well as an html page that contains the applet.
The jar file to be executed is found at:
http://www.pepperdine.eclipse.co.uk/Sudoku/en/Sokuku-en-1.0-2.jarThere is another executable jar file at
http://www.pepperdine.eclipse.co.uk/Sudoku/en/Sokuku-en-1.0-2-all.jarwhich contains the source as well. Unzipping this file in a new
directory, and then untar'ing the file src.tgz will create the src
directory. Issuing make for the outer level Makefile should create all
the target jar files.
Andy.