简体   繁体   中英

java.lang.UnsatisfiedLinkError when running java command as sudo

在此处输入图片说明

As you can see, it works when running as non sudo. I however need to run it as sudo.

I have faced this error this comes when there is classpath issue. Set classpath from command prompt, do via terminal, like java -Djava.library.path=blahblahblah...
liked helping you.

Try either using sudo -E (which will pass your environment variables to the sudo environment), or pass the specific environment variables that you wish:

sudo LD_LIBRARY_PATH="$LD_LIBRARY_PATH" CLASSPATH="$CLASSPATH" java ...

(You may not need to pass the CLASSPATH , you can try with or without it).

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM