I have written a short Sikuli script utilizing Java in Eclipse. Originally I created a swing GUI to begin execution, and this fires off the Sikuli script as intended (Waits for images, finds them, clicks them. Timeouts after 90 seconds if not found). Now I'm trying to get it to run from command line while taking in an input file as an argument. The command I'm using is below:
java -jar SikuliProject.jar intputFile.xlsx
I'm seeing my print statements in the commandline, so I know it's running the script, yet it's returning an image found error without waiting the expected 90 seconds :
[error] Region.exists: seems that imagefile could not be found on disk
Is there any reason why the program ignores wait times and can't seem to find images when run this way via commandline opposed to executing from a GUI / IDE?
Thanks,
Andrew
Related
I'm trying to use the Linux FBI utility to write a few .jpg images to the framebuffer on a Raspberry Pi 3 from Java.
From the command line everything works as expected. My java application runs fine until I attempt to run the following line of code (no Java errors by the way):
Process p = Runtime.getRuntime().exec("sudo fbi -T 1 -d /dev/fb0 -a -noverbose -t 1 -cachemem 0 /home/pi/Desktop/*.jpg");
The black loading screen for FBI does display when this process is executed so I know that it's executing properly, but FBI responds with an error stating /home/pi/Desktop/*.jpg Loading Failed. I've seen this error before but only when I'm referencing a folder or file that doesn't exist. The images that I am trying to display are on the Desktop. I can run the same command that is in the call to exec from any location in the CLI and it works. I'm not real sure why it's not working from my Java application.
Thanks in advance
Simple: the "*" wildcard (or any other wildcard) is a feature of the underlying shell. Therefore it works when you use it manually on the command line.
But when using it via the process builder, there is no shell. Thus there is no component that turns the asterisk into a list of file names. Thus that string is passed as file name, and of course, there is no such file!
You either have to write Java code that expands the wildcard in code (to then pass a list of file names directly) or you have to actually start a shell explicitly (getting that right, with all the commands might be quite tricky).
So I have a shell exec command that run a a java command, load a jar file it ask for input then produce an output in the browser. I'm done with the coding and its working just fine, but the problem is its a bit slow. So, is there a way to make it faster? A certain command or something?
I am working with one cmd like executable and source code of that is not available.
Executable is having multiple command sequence to be entered before it exit. Each command takes random time from 1 sec to 1 min.
I tried with Java's Process builder and runtime but I am getting output only after program completely exits from execution. Also, I am not able to insert any command to that executable via BufferedWriter. So my question is how to get output of executable while it is still running
Quenstions referred: Executing an EXE from Java and getting input and output from EXE
java runtime.getruntime() getting output from executing a command line program etc.
I've been coding a litte bash script which connects on several distant servers, then execute a java CLI program through a few expect instructions.
It goes like this :
bash script
expect
ssh to server using public keys
expect ...
expect ...
log_file my_file (everything displayed on the screen is now redirected to my_file)
expect ...
log_file (closing my_file)
exit
exit
When I execute my script manually everything runs OK.
When I execute it through crontab, the file my_file is empty.
I found out that cron jobs don't have a tty attached and that PATH isn't the same as usually
My question is : is there a way to force the creation/allocation of a tty to my cronjob?
I've tried using the -t and -tt option with ssh but no result.
redirecting standard output on different levels of the script didn't work.
Also, I can't install screen (which could have helped, maybe) and "script" isn't writing anything either.
Thanks a bunch!
You can check the cron tab log for erros and make sure the full path is given for the command to be executed.
I have a java app that I wrote. I am able to execute it using Ant and with "java -jar" from the command line. I want to be able to launch the file using "javaw.exe" (my app uses Swing). For some reason it doesn't seem to do anything (javaw starts for a second and then quits with no error that I can see). I tried running the same file on my Win XP computer using javaw and it executes fine. The other computer I am using it on is a Win 7 laptop.
Building on purtip31's comment ...
I expect that the problem is that some exception or error is occuring when you launch using javaw, but you can't see any diagnostics because they are going nowhere.
In the short term, redirect standard output to a file and look at what is being written.
In the long term, replace your "System.out" and "System.err" diagnostics with proper logging via a logging framework such as log4j, java.util.logging, etc.