Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Eclipse Projects » Standard Widget Toolkit (SWT) » Running an SWT Application With gcj
Running an SWT Application With gcj [message #464642] Fri, 25 November 2005 18:29 Go to next message
Eclipse UserFriend
Originally posted by: cabhan.gmail.com

Greetings. I have written an application using SWT, but in order to
make it more available, I am hoping to get it working using gcj as well.
It should be noted that I am using Linux, and that the audience is
Linux as well.

My first error, I found a workaround for on this group that I should use
Sun's Java compiler to create the jar, and run gcj on THAT. I am
executing gcj as such:

gcj --classpath=$CLASSPATH:/usr/share/swt-3/lib/swt.jar
--main=org.cabhan.lineakconfig.Driver lineakconfig.jar

When I do this, I get errors of the following sort:

/tmp/cceuFPMI.o(.text+0x24): In function
`org::cabhan::lineakconfig::CodeWindow:
:CodeWindow(org::eclipse::swt::widgets::Display*,
org::cabhan::lineakconfig::Typ
eWindow*)':
: undefined reference to `org::eclipse::swt::widgets::Shell::class$'
/tmp/cceuFPMI.o(.text+0x4b): In function
`org::cabhan::lineakconfig::CodeWindow:
:CodeWindow(org::eclipse::swt::widgets::Display*,
org::cabhan::lineakconfig::Typ
eWindow*)':
: undefined reference to
`org::eclipse::swt::widgets::Shell::Shell(org::eclipse:
:swt::widgets::Display*)'
/tmp/cceuFPMI.o(.text+0x89): In function
`org::cabhan::lineakconfig::CodeWindow:
:CodeWindow(org::eclipse::swt::widgets::Display*,
org::cabhan::lineakconfig::Typ
eWindow*)':

I do not know how to fix these, and I cannot seem to find anyone who
can. Might anyone know?

Thank you.


- Alex
Re: Running an SWT Application With gcj [message #464650 is a reply to message #464642] Sun, 27 November 2005 02:05 Go to previous messageGo to next message
Daniel Spiewak is currently offline Daniel SpiewakFriend
Messages: 263
Registered: July 2009
Senior Member
Random guess based on nothing would be that gcj is having trouble loading the SWT classes for cross-compilation.

I would bet that you would have better luck with a copy of SWT that's already cross-compiled into a shared object file. Also, there are litterally dozens of gcj-and-swt tutorials on the internet (including a few on eclipse.org). I would check out a few of those and see what they use.
Re: Running an SWT Application With gcj [message #464655 is a reply to message #464642] Mon, 28 November 2005 07:33 Go to previous messageGo to next message
ted@ted.net is currently offline ted@ted.netFriend
Messages: 3
Registered: July 2009
Junior Member
hi Alex,

The following sequence works under Windows (and I believe under Linux, by
changing dll to so, but I cannot verify this at the moment).

gcj -fjni -c swt.jar
ar rc libswt.a swt.o
ranlib libswt.a (or "ar -s")
gcj -shared -fPIC -fjni -o libswt.dll swt.jar
gcj --classpath=/src -c net/ted/Test.java -o Test.o
gcj --main=Test --classpath=/src:`pwd`/swt.jar -o Test.exe Test.o
-L/`pwd` -lswt

ted@ted.net - ted.williams@windriver.com

On Fri, 25 Nov 2005 10:29:16 -0800, Alex Brick <cabhan@gmail.com> wrote:
> Greetings. I have written an application using SWT, but in order to
> make it more available, I am hoping to get it working using gcj as well.
> It should be noted that I am using Linux, and that the audience is
> Linux as well.
>
> My first error, I found a workaround for on this group that I should use
> Sun's Java compiler to create the jar, and run gcj on THAT. I am
> executing gcj as such:
>
> gcj --classpath=$CLASSPATH:/usr/share/swt-3/lib/swt.jar
> --main=org.cabhan.lineakconfig.Driver lineakconfig.jar
>
> When I do this, I get errors of the following sort:
>
> /tmp/cceuFPMI.o(.text+0x24): In function
[snip]
Re: Running an SWT Application With gcj [message #464711 is a reply to message #464655] Tue, 29 November 2005 02:20 Go to previous message
Eclipse UserFriend
Originally posted by: cabhan.gmail.com

Ted R Williams wrote:
>
> hi Alex,
>
> The following sequence works under Windows (and I believe under Linux,
> by changing dll to so, but I cannot verify this at the moment).
>
> gcj -fjni -c swt.jar
> ar rc libswt.a swt.o
> ranlib libswt.a (or "ar -s")
> gcj -shared -fPIC -fjni -o libswt.dll swt.jar
> gcj --classpath=/src -c net/ted/Test.java -o Test.o
> gcj --main=Test --classpath=/src:`pwd`/swt.jar -o Test.exe Test.o
> -L/`pwd` -lswt
>
> ted@ted.net - ted.williams@windriver.com
>

Here is the exact process I followed. I am operating in
~/test/swt_and_gcj, and I am beginning with .java files:

gcj -fjni -c /usr/share/swt-3/lib/swt.jar <-- Gives many warnings
about a protected handler, but otherwise works

ar rc libswt.a swt.o

ranlib libswt.a

gcj -shared -fPIC -fjni -o libswt.so /usr/share/swt-3/lib/swt.jar <--
Again, warnings, but does work

gcj --classpath=. -C *.java

^ this last step will not run, giving me errors about the SWT code.
However, I do have the libswt.so file in the current directory (as
indicated by the classpath), but it still doesn't work.

Thanks though. I also took a look at:
http://www-128.ibm.com/developerworks/java/library/j-nativeg ui2/

But that does not work either.

If you have any more ideas, let me know please. Thanks!


- Alex
Previous Topic:Erasing a Canvas
Next Topic:ControlContribution.dispose()
Goto Forum:
  


Current Time: Fri Apr 19 20:33:38 GMT 2024

Powered by FUDForum. Page generated in 0.03690 seconds
.:: Contact :: Home ::.

Powered by: FUDforum 3.0.2.
Copyright ©2001-2010 FUDforum Bulletin Board Software

Back to the top