Running Blynk Local Server on Windows 10

I attempted to follow the guide at

and even downloaded the server jar from

, thinking it would be useful, but still managed to get stuck on the instructions.

After punching in the java -version in the command prompt on my Win10, it spit out ‘java version 1.8.0_102’. That was downloaded from the link provided on the ‘how to’ page linked above. I’m not sure if it’s outdated or not. Then I proceeded with the ‘java -jar server-0.16.4.jar -dataFolder /path’ command, with an error popping up saying:

Error: Unable to access jarfile server-0.16.4.jar.

I don’t know if this part of the Blynk package was intended to picked up and implemented by server noobs but the instructions look a little barren compared to what I youtubed:

I’m not sure if the above works, as I didn’t want to jack with stuff I knew little about but I did watch the video and the steps seem more numerous than those outlined in the quick setup guide.

Anyways, I just want to be able to set up my own server and see if it’s something I want in the long term or if it’s optional. Any insight on this matter would be nice.

Are you running this command from folder where jar file is?

1 Like

I’m trying to

The java server file is within the C:\Users\Jacob\Documents\Blynk Server directory.
Stir me straight, @Dmitriy. Examples work best.

@aop you need to either specify full path to jar file or go to dir with jar and run from there. Also dataPath should be without space or escaped properly.

1 Like

@Dmitriy

I just went to the directory file and double-clicked the server-0.16.4.jar file/icon. Afterwards, a set of Static and Logs folders appeared within that folder, so I’m assuming that’s the quick setup. If not, tell me so. If it is, what’s next?

:seedling:

I mean from command line cd dorectory_where_your_jar_is

Yeah I didn’t know to include cd C:\Users\Jacob\Documents\Blynk Server before entering the java -jar server-0.16.4.jar -dataFolder /path command. Thanks for the heads up! Wouldn’t it just be easier for others when reading the Windows instructions to just have them find the Java Server file through the search tab and double click it?

:lollipop:

^I love the stacked library of various emoji’s. Whoever thought of including that, here in the community section, at Blynk, bravo!

Place your jar file in any folder. Open Notepad and place these lines of code:

@echo off
echo Starting Blynk Server...
echo Your working directory is=%~dp0
cd /D %~dp0
java -jar server-0.16.4.jar -dataFolder /path
IF /I "%ERRORLEVEL%" NEQ "0" (
    ECHO Server failed to started
)
echo Server started successfully.....

Save as AnyName.cmd (in the same folder of your server jar file). Modify the server file version if needed.

Whenever you want to start the server , right click on AnyName.cmd and Run as administrator

Have a nice day :wink:

3 Likes

Don’t use the batch file above without editing the following line:

java -jar server-0.16.4.jar -dataFolder /path

You need to change /path to your actual path in unix style format even though you are using Windows.

Also you need to keep revising the server version, so -0.16.4 went to -0.17.0 to 0.17.2 etc. One fix for this would be to simply ensure the latest jar file is just called server.jar when you copy it into the directory from Github.

So if you want to store your data in C:\BlynkStuff\2016\data and you are using a fixed name for all versions of the server the batch file line would become:

java -jar server.jar -dataFolder /BlynkStuff/2016/data

1 Like

Hi all… if I may just jump in here. I am also running the local server 0.17.2 on a windows machine and I’m having an unusual (to me) problem when I use @wbadry batch loader.

When I run the .cmd file the Windows Command Window opens and the batch executes. When it is finished the cmd window remains open and the Server runs fine and is shown in the “Task Manager” processes.

Communication and logon is normal with my mobile device BUT… If I close the cmd window the server process terminates or if I terminate the process the cmd window closes.

I am using the above batch file with the following command java -jar server-0.16.4.jar -dataFolder \Blynk\Server\Data

Notice @Costas that I used the windows backslash for folder delineation… could that be a problem?

The solution is probably a butt-kicker but I’m afraid it’s outside my area of expertise.

Does anyone have any ideas??

@modicon1 with the tests I did it needs to be Unix style not Windows style for directory structure. If it was Windows style you would probably need the drive letter.

I tried the batch both ways and the server still terminates when I close the Command Window.

The fix is “leave the window open”.

Did some googling and there are ways to run the batch with the cmd window hidden but it seemed quite convoluted and not a universal solution.

Having the command window remain open when running JAVA processes seems to be normal although I don’t recall it being there for previous server versions.

The best work-around I found was to create a shortcut to the batch and modify the shortcut properties to run minimised as administrator.

@modicon1 yes I minimize the command windows not closing it. Command window acts like the host for java app. If you terminate the shell, the server process will be automatically terminated.

@modicon1 Edit the following line:
javaw -jar server-0.17.0.jar -dataFolder /path

replacing java with javaw will make process alive after killing command window. However, you have to kill the server once done from the task manager.

You can also create a batch file to kill java processes:

taskkill /f /im jqs.exe
taskkill /f /im javaw.exe
taskkill /f /im java.exe
1 Like

There is also software for Windows which is able to turn a program into a service. That way you can run the Batch file as service, like on Unix :slight_smile:

1 Like

@Lichtsignaal I guess you mean something like this:

How to run any program as a service

Also turning Java app into windows service

OK… I’m using the cdm file but what happens is that the command opens and closes very fast with something written that is impossible to read, someone knows what is wrong?

Open a cmd prompt via the start menu, go to the folder and then start the cmd file by hand. That way it won’t close.