How to implement an eclipse VM argument in code

jazibobs picture jazibobs · May 27, 2012 · Viewed 7k times · Source

This is probably a simple question but I'm currently working with vlcj to make a video player for a project. I have a basic player working but only when I have the VM arguement

-Djna.library.path="C:\Program Files\VideoLAN\VLC"

defined in the debug configurations window. My question is if I need to create a version of this project to run outside of Eclipse do I need to define this argument in my code or will my program run in this way without problems indefinitely?

Thanks to anyone who answers,

Jared.

Answer

Louis Wasserman picture Louis Wasserman · May 27, 2012

I think

System.getProperties().setProperty("jna.library.path",
  "C:\\Program Files\\VideoLAN\\VLC");

should do the job in code for this particular case. -D arguments to java set system properties, which end up in System.getProperties().