How to run build using graphics drivers by using optirun (Bumblebee) from IDE (Netbeans, Eclipse)?

前端 未结 4 1516
暗喜
暗喜 2021-01-16 08:00

Does anyone know how to make eclipse or netbeans use the graphics card in optimus laptops by invoking optirun (bumblebee) inside the IDE so that one can just use the run but

4条回答
  •  北恋
    北恋 (楼主)
    2021-01-16 08:46

    You can also rename java to java_real and use this portion of code as your java command :

    #!/bin/bash
    
    path=$(dirname $(readlink -f $0))
    args=""
    runner="$path/java_real"
    for var in "$@"
    do
        if [ "$var" = "-3d" ]; then
        runner="primusrun $runner"
      else
        args="$args $var"
      fi
    done
    
    $runner $args
    

    NOTE : I had to do this in /usr/lib/jvm/java-7-openjdk-amd64/jre/bin, not in /usr/bin to make it work with Eclipse.

    In Eclipse, just add "-3d" in your program arguments and you're good to go !

提交回复
热议问题