1

I edited this question, because I have used a different approach.

When running my JavaFX Application on my RasperryPi (with JDK8) with the following command: sudo java -Djavafx.platform=eglfb -cp ch.seerow.fotomat.app-1.0-SNAPSHOT-jfx.jar com.javafx.main.Main

I get the following error:

Exception in thread "AWT-EventQueue-0" java.awt.HeadlessException:
No X11 DISPLAY variable was set, but this program performed an operation which requires it.

    at java.awt.GraphicsEnvironment.checkHeadless(GraphicsEnvironment.java:207)
    at java.awt.Window.<init>(Window.java:535)
    at java.awt.Frame.<init>(Frame.java:420)
    at javax.swing.JFrame.<init>(JFrame.java:224)
    at com.javafx.main.Main$1.run(Main.java:893)
    at java.awt.event.InvocationEvent.dispatch(InvocationEvent.java:251)
    at java.awt.EventQueue.dispatchEventImpl(EventQueue.java:741)
    at java.awt.EventQueue.access$400(EventQueue.java:97)
    at java.awt.EventQueue$3.run(EventQueue.java:694)
    at java.awt.EventQueue$3.run(EventQueue.java:691)
    at java.security.AccessController.doPrivileged(Native Method)
    at java.security.ProtectionDomain$1.doIntersectionPrivilege(ProtectionDomain.java:75)
    at java.awt.EventQueue.dispatchEvent(EventQueue.java:711)
    at java.awt.EventDispatchThread.pumpOneEventForFilters(EventDispatchThread.java:220)
    at java.awt.EventDispatchThread.pumpEventsForFilter(EventDispatchThread.java:135)
    at java.awt.EventDispatchThread.pumpEventsForHierarchy(EventDispatchThread.java:123)
    at java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:119)
    at java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:111)
    at java.awt.EventDispatchThread.run(EventDispatchThread.java:97)

I don't think that I'm using any AWT or Swing stuff, so I have no idea where this is comming from.

I'm using Maven to build my project, I use the following dependecies:

<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
  xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
    <modelVersion>4.0.0</modelVersion>

    <groupId>ch.seerow.fotomat</groupId>
    <artifactId>ch.seerow.fotomat.parent</artifactId>
    <packaging>pom</packaging>
    <version>1.0-SNAPSHOT</version>

    <properties>
        <buildtools.version>0.3</buildtools.version>
    </properties>

    <organization>
        <name>Seerow</name>
    </organization>

    <dependencyManagement>
      <dependencies>
          <!-- Test Dependencies -->
          <dependency>
              <groupId>junit</groupId>
              <artifactId>junit</artifactId>
              <version>4.8.2</version>
              <scope>test</scope>
          </dependency>
          <dependency>
              <groupId>commons-io</groupId>
              <artifactId>commons-io</artifactId>
              <version>1.4</version>
              <scope>test</scope>
          </dependency>
          <dependency>
              <groupId>org.mockito</groupId>
              <artifactId>mockito-all</artifactId>
              <version>1.9.5</version>
              <scope>test</scope>
          </dependency>

          <!-- imageJ headless -->
          <dependency>
              <groupId>ch.seerow.common</groupId>
              <artifactId>ch.seerow.common.ijheadless</artifactId>
              <version>1.0</version>
              <type>jar</type>
          </dependency>

          <!-- Image Processing Library -->
          <dependency>
              <groupId>gov.nih.imagej</groupId>
              <artifactId>imagej</artifactId>
              <version>1.46</version>
          </dependency>

          <!-- Amazon Upload Library -->
          <dependency>
              <groupId>com.amazonaws</groupId>
              <artifactId>aws-java-sdk</artifactId>
              <version>1.0.002</version>
          </dependency>

          <!-- log4j Libraries -->
          <dependency>
              <groupId>org.apache.logging.log4j</groupId>
              <artifactId>log4j-api</artifactId>
              <version>2.0-beta8</version>
          </dependency>
          <dependency>
              <groupId>org.apache.logging.log4j</groupId>
              <artifactId>log4j-core</artifactId>
              <version>2.0-beta8</version>
          </dependency>

          <!-- seerow libraries -->
          <dependency>
              <groupId>ch.seerow.common</groupId>
              <artifactId>ch.seerow.common.buildtools</artifactId>
              <version>${buildtools.version}</version>
              <type>jar</type>
          </dependency>
      </dependencies>
    </dependencyManagement>

    <build>
        <pluginManagement>
            <plugins>
                <plugin>
                    <groupId>org.apache.maven.plugins</groupId>
                    <artifactId>maven-depenency-plugin</artifactId>
                    <version>2.0</version>
                </plugin>
                <plugin>
                    <groupId>org.apache.maven.plugins</groupId>
                    <artifactId>maven-checkstyle-plugin</artifactId>
                    <version>2.10</version>
                    <configuration>
                        <failOnViolation>false</failOnViolation>
                        <logViolationsToConsole>true</logViolationsToConsole>
                        <configLocation>seerow_checkstyle.xml</configLocation>
                    </configuration>
                    <dependencies>
                        <dependency>
                            <groupId>ch.seerow.common</groupId>
                            <artifactId>ch.seerow.common.buildtools</artifactId>
                            <version>${buildtools.version}</version>
                        </dependency>
                    </dependencies>
                    <executions>
                        <execution>
                            <phase>compile</phase>
                            <goals>
                                <goal>check</goal>
                            </goals>
                        </execution>
                    </executions>
                </plugin>
                <plugin>
                    <groupId>com.zenjava</groupId>
                    <artifactId>javafx-maven-plugin</artifactId>
                    <version>2.0</version>
                </plugin>
                <plugin>
                    <artifactId>maven-assembly-plugin</artifactId>
                    <version>2.4</version>
                </plugin>
                <plugin>
                    <artifactId>maven-resources-plugin</artifactId>
                    <version>2.6</version>
                </plugin>
            </plugins>
        </pluginManagement>
        <plugins>
            <plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-checkstyle-plugin</artifactId>
            </plugin>
            <plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-compiler-plugin</artifactId>
                <version>3.1</version>
                <configuration>
                    <source>1.8</source>
                    <target>1.8</target>
                </configuration>
            </plugin>
        </plugins>
    </build>
</project>

For the ImageJ dependency I used the following solution to get rid of the AWT and Swing stuff (http://imagej.1557.x6.nabble.com/Headless-ImageJ-td3699125.html). But I'm not sure if any other of my dependencies use AWT or SWING.

Thanks for any suggestions.

1

before running your app java fx :

export DISPLAY=:0.0

or in ssh :

setenv DISPLAY :0.0
0

I don't know what would be causing this since I don't work with JavaFX, but I found a simple tutorial on how to get it running on the Pi.

Besides, why do you use JDK8 instead of using 7? Many devices don't support the latest version yet.

  • I use JDk1.8 because this is the only one that supports JavaFX on the raspberry Pi. – user1949422 Aug 16 '13 at 10:45

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.