1

I need to start jperf on virtual server. I configured X11 forwarding via ssh. xclock - is working. But if I start jperf I get:

    user@client-32:~/sandbox/jperf-2.0.2$ sh jperf.sh
    Exception in thread "main" java.lang.ExceptionInInitializerError
    Caused by: java.awt.HeadlessException
            at sun.java2d.HeadlessGraphicsEnvironment.getDefaultScreenDevice(HeadlessGraphicsEnvironment.java:77)
            at net.nlanr.jperf.JPerf.(Unknown Source)

java version:

    java version "1.7.0_03"
    OpenJDK Runtime Environment (IcedTea7 2.1.1pre) (7~u3-2.1.1~pre1-1ubuntu3)
    OpenJDK Client VM (build 22.0-b10, mixed mode, sharing)

uname -a :

`Linux client-32 3.2.0-29-generic-pae #46-Ubuntu SMP Fri Jul 27 17:25:43 UTC 2012 i686 i686 i386 GNU/Linux

Problem solved

Need to add -Djava.awt.headless=true into jperf.sh should be like this:

#!/bin/sh

java -classpath jperf.jar:lib/forms-1.1.0.jar:lib/jcommon-1.0.10.jar:lib/jfreechart-1.0.6.jar:lib/swingx-0.9.6.jar net.nlanr.jperf.JPerf -Djava.awt.headless=true
6
  • what is DISPLAY variable set to? Commented Sep 11, 2012 at 12:14
  • $ echo $DISPLAY localhost:10.0 and xclock is working I said it.
    – andreykyz
    Commented Sep 13, 2012 at 8:09
  • can you try setnev DISPLAY HOSTNAME:0.0 instead of localhost. Commented Sep 13, 2012 at 8:18
  • $ xclock Error: Can't open display: 192.168.77.120:0.0
    – andreykyz
    Commented Sep 13, 2012 at 8:42
  • 1
    I used to use host name for DISPLAY variable and it works for me. do not give ip of that host please try with host name the value return by hostname command. Commented Sep 13, 2012 at 9:05

1 Answer 1

0

You should run jperf in headless mode, for that you may need to edit jperf.sh, see: http://javatechniques.com/blog/linux-x11-libraries-for-headless-mode/

if it's still not working, try with oracle jvm instead of openjdk one.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.