Running exe files with Hudson on Windows 8 - java

I am attempting to have a Hudson job run a windows executable on a Windows 8 VM. When I attempt to run the exe file I get the error:
java.io.IOException: Cannot run program "C:\hudson\workspace\workspaceName\installer\bin\fileToExecute.exe": CreateProcess error=740, The requested operation requires elevation
Has anyone run into this and had it run automatically? I can't just have the exe file on the VM and set its permissions because a new copy gets downloaded at the start of each build.
Thanks in advance.

Disclaimer: I have not tried this with Windows 8.
First things first, even if you succeed to launch an .exe application from Hudson/Jenkins, it will be running under a different session, probably invisible to you. I've managed to achieve the workarounds for this with PsExec as detailed here:
Open Excel on Jenkins CI
With the above method, you will be able to launch an application and actually see it in the logged in session.
If your application does require elevated permissions for whatever reason, you've got to add -h switch to PsExec

Related

Running a Java/Selenium program on another computer

I have a small Java program that uses Selenium that I'd like to install on someone else's computer so they can use it too. It uses Selenium (for what it's worth).
I exported from Eclipse to a jar file. I then used launch4j to create a windows executable. I used Java version 1.7_079 to develop the program.
The other computer has JRE version 1.7_079 installed I made sure CLASSPATH is set.
If I run this executable on my system it works fine. If I try and run it on another system nothing happens at all, no errors, no nothing.
What am I doing wrong?
Would it be easier to NOT wrap it in an executable and just use a batch file to run it?
what's the best and easiest way to accomplish this?
Try to execute the .jar directly on the system where it doesn't work by using java.exe/javaw.exe and note the error, if any.
java.exe -jar helloworld.jar
If you get "'java.exe' is not recognized..." you need to add the folder where java/w.exe is to your path (eg: SET PATH=folder-with-java-exes;%PATH%
You can locate java/w.exe files with:
cd /d c:\
dir /S java*.exe
I finally have an answer to this. I traced it down to an issue with Chrome and Chrome driver. I was running Chrome v55.0.x. The users computer was running 57.0.. Once I upgraded my machine to 57. it failed like the users did. I updated Chrome driver and everything works as expected.
you can try this in your code put the path as C:/xxxxxxxx.exe
and put selenuim and the web driver In the C drive and create a jre or exe now .
next step is to ask your client to put selenuim and the web driver also in the C drive in there computers and int will work fine .

jenkins calling batch file get stuck in windows 7

I have a Jenkins server in windows 7 environment, and I run a batch file from jenkins. This batch file launches a jar that calls cmd.exe in order to connect to an instrument (spirent).
The above batch file fails when is started from jenkins, installed as a windows service, but works fine either if is started directly from cmd or from a jenkins started as
java -jar jenkins.war.....
If the windows service user running Jenkins is different than the user you are logged in as, you are likely running into a permissions issue. Possible solutions include changing the user running the service or modifying permissions necessary to allow the service user to perform the desired tasks.

Error when starting Datomic shell: java.lang.NoClassDefFoundError: jline/ConsoleRunner

I followed the instructions on the Datomic site: http://docs.datomic.com/getting-started.html, but I'm getting this error when trying to start up the datomic shell prompt. I'm using a windows machine. Any suggestions? I tried the same thing on my linux box and did not get this error.
Edit: moved to a different windows machine and it's working. If I have time to troubleshoot this problem and I find a solution I'll report back
I noticed that you cannot run the shell.cmd from within the bin directory, you need to call it with bin\shell.cmd from the parent directory... hope that helps.
In case you are using cygwin/bash and call bin/shell :
The java runtime on windows does not understand classpath with a ":"
but this is what you get from bin/classpath.
Either correct this or use DOS-CMD shell and call bin/shell.cmd inside.
Regards
Some tips for running datomic on Windows (7 at least):
Do not download datomic into Program Files. On startup, it creates logging directories and temp files into its own directories, so unless you run the command prompt as Administrator, you're gonna have screens full of Unable to write to file... errors.
You need to run datomic as such (assuming you extracted the download to C:)
c:\datomic-free-0.x.xxxx>bin\shell.cmd
Note the backslash. Tripped me up forever coming from *nix world.
After that, return to your regularly scheduled datomic tutorials.

Installation failed due to low priviledge on Win8

I am using Java code to install an EXE program on Win8, by executing this command "java -jar installapp.jar" in CML. The command line window is NOT opened by "Run as administrator", but the current user is a member of administrator group.
However, in the same CML window, if I install the EXE directly, it works. It just fails when the installation is executed by Java.
So anyone can give me a tip?
Thanks a lot,
Michael
To correctly install an application which includes writing to system-protected areas can't be done without elevating through UAC. That means the CML window must be Run as administrator.
Java executables are marked with manifest which requests asInvoker privileges. So the process would start with administrator tokens dropped if the parent process wasn't elevated. It's the whole point of UAC: even if you are member of Administrators group, you don't get the full, unlimited privileges until you elevate.
What do you mean by "install the exe directly"?

windows service from batch file failed to execute

i need to execute a batch file as windows service.
For that i had created a batch file.
In this batch file i just add the below code to run a jar file.
java -jar myTest.jar
When i double click on the batch file..no problem .its working fine. It executes the jar file (a java application).
But the same batch file when i used in a windows service on a windows server, its not working.? Its just getting blinked to show the command window and gets closed. None of my code portion inside the jar file gets executed.
Another thing is i had successfully checked this from another windows server. Its working fine there.
Why this strange issue..??Can anyone help me out to solve the issue..
The service is not executed in the same environment as when you run the batch from an interactive Windows session. Make shure in the .bat file that change into the correct (working) directory, even with absolut path (cd \users\my\java\service), and maybe specify the full path to the java.exe. The other server do you mention could have a totally diferent setup of the environment, installed software, etc.
C:
cd \users\my\java\service
"\program files\java\jre\bin\java" -jar test.jar

Categories