Skip to content

adb: error: cannot stat 'scrcpy-server.jar': No such file or directory  #567

Closed

Description

@H1-N1

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

Activity

  1. npes87184 commented on May 31, 2019

    @npes87184
    Contributor

    Hi, @H1-N1

    What's your operating system?

    Thanks.

  2. rom1v commented on May 31, 2019

    @rom1v
    Collaborator

    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: #278 (comment)

    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

  3. H1-N1 commented on May 31, 2019

    @H1-N1
    Author

    Windows @npes87184

  4. H1-N1 commented on May 31, 2019

    @H1-N1
    Author

    @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

  5. rom1v commented on May 31, 2019

    @rom1v
    Collaborator

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

  6. H1-N1 commented on Jun 1, 2019

    @H1-N1
    Author

    @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...

  7. rom1v commented on Jun 1, 2019

    @rom1v
    Collaborator

    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)?

  8. iw0nderhow commented on Jun 12, 2019

    @iw0nderhow

    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.

  9. rom1v commented on Jun 12, 2019

    @rom1v
    Collaborator

    @Karottenbaum If you git clone/git pull this morning, please update to current master.

    There was an issue: 53310a9.

  10. iw0nderhow commented on Jun 12, 2019

    @iw0nderhow

    Thanks, it's working with that commit. Sorry for the trouble!

  11. hrk commented on Jun 24, 2019

    @hrk

    @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?

  12. rom1v commented on Jun 24, 2019

    @rom1v
    Collaborator

    @hrk You also need the commit before: bcd0a87.

    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.

  13. hrk commented on Jun 24, 2019

    @hrk

    Wow, didn't know about that. And didn't notice the spelling mistake. :) Thank you, it's working now.

  14. rom1v commented on Jun 24, 2019

    @rom1v
    Collaborator

    v1.9 fixes the problem by searching in the same directory as the binary on Windows, so I'm closing.

  15. added a commit that references this issue on May 5, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions