How to implement an eclipse VM argument in code

独自空忆成欢 提交于 2021-02-19 07:56:33

问题


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.


回答1:


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




回答2:


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.



来源:https://stackoverflow.com/questions/10774308/how-to-implement-an-eclipse-vm-argument-in-code

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!