WalkingThrough
Posts: 3
Joined: Sat Aug 23, 2014 11:47 pm

Java, Eclipse, SWT on Jessie?

Wed Nov 16, 2016 2:18 am

Hello -

Installing Jessie went smoothly, no glitches. Following instructions, an external USB-connected hard drive was partitioned, rsync used to copy everything to the HD, /boot/config.txt fixed to point to /dev/sda2 as the root partition, and it all just works.

Java 7 is supplied... but Java 8 from Oracle is available. After some reading, managed to install Eclipse 8 and now things are a bit zippier.

Now I'm trying to write code that uses SWT. The system comes with /usr/share/java/swt.jar; it's a soft link to /lib/java/swt-gtk-3.8.2.jar .

Launch Eclipse, create a new Java project, type in a 'Hello world' (yes, it worked) then went to the top bar.

Project --> Properties --> Java Build Path --> Add External Jars. Navigate to /usr/share/java, select swt.jar, and left-click "Ok".

Eclipse shows swt-gtk-3.8.2 - /usr/lib/java and I think, "That seemed straightforward." The first hint of problems was left-clicking to expand the jar file and not finding anything in it.

In the class containing main(), I create a class variable:

DISPLAY display = null;

There's a red blit at the left. "DISPLAY cannot be resolved to a type".

CTRL-SHIFT O to Organize Imports. If this were done under Slackware Linux or Windows, Eclipse would happily populate the source window with import statements. Like: import org.eclipse.swt.widgets.Display;

What step(s) am I missing? It would be nice to have the same functionality under Jessie that is available under other platforms... but those platforms (both x86-based) offer a complete importable project.

Is that available under Jessie for the Raspberry Pi ?

Your time is appreciated.

WalkingThrough
Posts: 3
Joined: Sat Aug 23, 2014 11:47 pm

Re: Java, Eclipse, SWT on Jessie?

Sun Dec 11, 2016 5:45 am

I stared for a few weeks at this problem before it finally sank in that I was doing it all wrong.

Have finally gotten the online SWT documentation to pop up under a hovering cursor and everything works. Well mostly.. but for what I use, it works.

Now I'm trying to get WindowBuilder working. Oh, it installs fine. But invoking it causes a complaint about the wrong operating environment. Now I'm looking around for Mars or Neon Eclipse for the Pi.

Ya3ny
Posts: 1
Joined: Thu Jan 04, 2018 8:59 pm

Re: Java, Eclipse, SWT on Jessie?

Thu Jan 04, 2018 9:00 pm

Did you get WindowBuilder to work on the Pi using any OS?

Return to “Java”

Who is online

Users browsing this forum: No registered users and 3 guests