hi
when i start scrcpy from a process with administrator privileges i get this error
adb: error: cannot stat 'scrcpy-server.jar': No such file or directory
i dont now how to add full path in the env variable SCRCPY_SERVER_PATH !!!
thanks
Hi, @H1-N1
What's your operating system?
Thanks.
Many people are annoyed on Windows with this problem.
The cause is that it looks for scrcpy-server.jar in the current directory (.), not the same directory as scrcpy.exe: https://github.com/Genymobile/scrcpy/issues/278#issuecomment-429330345
We should change that for Windows: if SCRCPY_SERVER_PATH is not set, then we need to use the directory of scrcpy, then append scrcpy-server.jar. Ref: https://stackoverflow.com/questions/2647429/c-windows-path-to-the-folder-where-the-executable-is-located/2647446#2647446
Windows @npes87184
@rom1v or just add args that take care of server path
Becose i allready set SCRCPY_SERVER_PATH but I get the same error
Thanks for you replay guys
@H1-N1 What did you do exactly?
Here is how it works.
If you launch scrcpy from its own directory (either by typing scrcpy from that directory in a terminal, or by double-clicking on scrcpy.exe from your file browser), it should work as is (unless you set SCRCPY_SERVER_PATH to a wrong value). To make it work, just unset that environment variable, and retry (start a new terminal after you unset it).
If instead you added the scrcpy directory in your PATH, and try to launch scrcpy from another directory, then you need to set SCRCPY_SERVER_PATH to the full path of the jar file (e.g. C:\Users\h1n1\scrcpy\scrcpy-server.jar).
@rom1v
im lunching scrcpy from a process with administrator privileges
this is way he well not see service.jar this is why i sugest to add a agrs to scrcpy newer version
set path well not resolve the problem at all...
From which directory do you start scrcpy? (which is your current directory and what command do you enter?)
What is the exact value assigned to your SCRCPY_SERVER_PATH? Is it defined for your system (not only your user)?
I also get this error on Ubuntu, where scrcpy looks in /usr/local/bin/scrcpy-server.jar (scrcpy's install directory) instead of /usr/local/share/scrcpy/scrcpy-server.jar.
@karottenbaum If you git clone/git pull this morning, please update to current master.
There was an issue: https://github.com/Genymobile/scrcpy/commit/53310a925a495f61d42dd90faa0a0748074d63c5.
Thanks, it's working with that commit. Sorry for the trouble!
@rom1v using the official v1.9 tag, both if manually passing -Dportable=false or applying the fix in 53310a9 I still get a failure during build with the following message.
In file included from ../scrcpy-1.9/app/src/server.c:12:
../scrcpy-1.9/app/src/server.c: In function ‘get_server_path’:
../scrcpy-1.9/app/src/server.c:18:53: error: expected ‘)’ before ‘SERVER_FLENAME’
#define DEFAULT_SERVER_PATH PREFIX "/share/scrcpy/" SERVER_FLENAME
^~~~~~~~~~~~~~
../scrcpy-1.9/app/src/log.h:7:62: note: in definition of macro ‘LOGD’
#define LOGD(...) SDL_LogDebug(SDL_LOG_CATEGORY_APPLICATION, __VA_ARGS__)
^~~~~~~~~~~
../scrcpy-1.9/app/src/server.c:31:27: note: in expansion of macro ‘DEFAULT_SERVER_PATH’
LOGD("Using server: " DEFAULT_SERVER_PATH);
^~~~~~~~~~~~~~~~~~~
../scrcpy-1.9/app/src/server.c:18:53: error: expected ‘;’ before ‘SERVER_FLENAME’
#define DEFAULT_SERVER_PATH PREFIX "/share/scrcpy/" SERVER_FLENAME
^~~~~~~~~~~~~~
../scrcpy-1.9/app/src/server.c:33:12: note: in expansion of macro ‘DEFAULT_SERVER_PATH’
return DEFAULT_SERVER_PATH;
^~~~~~~~~~~~~~~~~~~
I'm a bit rusty with C, but from what I remember, using #define to declare a macro, accepts only 1 parameter, so server.c at lines 18 and 19 look wrong to me:
#define DEFAULT_SERVER_PATH PREFIX "/share/scrcpy/" SERVER_FLENAME
#define DEVICE_SERVER_PATH "/data/local/tmp/" SERVER_FILENAME
and the ninja build fails due to this. Am I missing something?
@hrk You also need the commit before: bcd0a876f7bf52642330410812a6b7100cdeda91.
I'm a bit rusty with C, but from what I remember, using #define to declare a macro, accepts only 1 parameter, so server.c at lines 18 and 19 look wrong to me
In C, you can concatenate string literals by just writing them one after the other:
const char *s = "hello" " world" "!";
This is what the macro does.
Wow, didn't know about that. And didn't notice the spelling mistake. :) Thank you, it's working now.
v1.9 fixes the problem by searching in the same directory as the binary on Windows, so I'm closing.
Most helpful comment
v1.9 fixes the problem by searching in the same directory as the binary on Windows, so I'm closing.