Executing windows batch script on Jenkins - java

I am building a project using Maven and using Jenkins for continuos integration. After the maven build i am getting an executable jar in my target folder which i am trying to run using a windows batch command as build step. But when i put the command in the box under execute windows batch command i get the following error
"cmd /c call /tmp/hudson2033384960131825453.bat FATAL: command
execution failed java.io.IOException: Cannot run program "cmd" (in
directory "/hosting/workspace/myProject"): error=2, No such file or
directory""
I am using mac OSX 10.9.3. The jenkins is deployed in a remote server which i don't have access to.
I want to execute this jar file as a build process. How can i do it?

You should not be expecting a windows batch command to be able to run on a mac. Jenkins is pretty cool, I agree, but it isn't magical.
Also, yes, it is a little confusing that the option is available to you even though you are on a Mac, but its there incase you have a linux / mac master with windows slave: https://issues.jenkins-ci.org/browse/JENKINS-17010?page=com.atlassian.streams.streams-jira-plugin:activity-stream-issue-tab
You cannot execute a windows batch command on mac or linux, end of story.

You are trying to launch windows command through jenkins on another operating system which is not going to work

Related

"adb shell date > date.txt" command execution not working in Mac using Process exec

I have an automation script written in java. Here is the code sample.
String command = "adb shell date > date.txt";
Process process = Runtime.getRuntime().exec(command);
When executing the code in windows its working fine but when I am running it in mac its not working properly.
Later I found that, in windows this command execution is creating file in my local PC project directory. But in case of Mac its failed when trying to create the file in device directory and error showing. While from Mac terminal its working fine.
My question is why is not working in my mac machine and why file is not creating in my local PC?
The Java Runtime environment doesn't necessarily pick up the same environment variables, command path, and aliases that are at work when you use a macOS Terminal.
You might try entering which adb into the Terminal and see what path you get back, if any. If you do get a definite path, try executing that full path, not just adb, from Java.

run a jarfile in a different machine from an sqlserver/issue a terminal command from an sqlserver to another windows machine

I have a series of stored procedures(say, SP1, SP2, SP3) consecutively running on an sqlserver(say, serverA).
After SP3 finishes execution, I want to run a jar file in some machine (say, computerA). Is there a way for me to trigger the run of my jar file in computerA after SP3 finishes executing in serverA?
Note: I can only run my jar file in computerA because my jar file actually retrieves data from Bloomberg API. So, this jar file needs to run in a machine that has Bloomberg terminal on it. Only computerA has a Bloomberg terminal.
I think another way of saying this is how to issue a terminal command from an sqlserver to another windows machine. Because I can just issue the following command to computerA but I really don't know how to make that possible.
java -jar D:\Runnables\myJavaApp.jar

How can I run gradle startscript created using installDist task from a batch file in windows OS?

I have Executed the gradle installDist task for my project. After that two start scripts were created one for running in unix like system and another for windows.
I am able to successfully execute the script created for unix systems. But when I tried to run the windows .bat file in my windows system. It is giving below error in command line.
Even if I am trying to run the batch file directly from cmd. It is giving the below error
The input line is too long.
The syntax of the command is incorrect.

Jenkins server freezes while running jar

Basically in the file system that I used as source control for Jenkins only has an executable .jar with all of the necessary libraries packaged into it. The only other configuration I have on the job itself is a Windows command build step, java -jar name.jar. I am able to run this on Windows Command Prompt, but every time I try to build it on the master computer, the build does not complete and the .jar file does not execute.
I am running this build logged in as the admin of the server.

Running Android emulator from Jenkins to run Junit test with Robotium

How can I run Android emulator from Jenkins to run my tests?
When I write in Execiute Windows bath comand, command to run emulator:
emulator -avd Tester
and run my tests I have this errors:
..>emulator -avd Tester 'emulator' is not recognized as an internal
or external command, operable program or batch file.
..>exit 9009 Build step 'Execute Windows batch command' marked build
as failure
I set path for Android_SDK, java in Windows path and it works from cmd.
What should I do to run emulator?
You can automate the process with the Android Emulator Plugin for Jenkins.
You just need to find where the file "emulator.exe" is located, and then run the command in that location. For example, the most probably is that it is located in C:...android-sdk\tools
so, go to the command promt, type cd C:\android-sdk\tools. Then type the command, and it will work just fine. I hope this is the answer even though it´s late. So, accept the answer.

Categories

Resources