How to implement an eclipse VM argument in code

9.6k views Asked by At

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.

2

There are 2 answers

0
Louis Wasserman On BEST ANSWER

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().

3
Jack On

You can't set JVM arguments at runtime, if you are going to export your project you'll have to find another way to do it: this is done by wrapping the execution of your program within a script file, let it be a .bat or .sh so that you can invoke the java executable with your paramters set.

I'm assuming you are talking about executing the program outside Eclipse.