Run a command before windows service starts - java

I have a windows service running a java application. When I install this application on a share drive it takes ages to start. I decided i want to copy all the application jars and libs to a local path, and run it from there.
The problem is I can't find a clean way to do it. I understand i cannot run a batch script (to copy the files before starting the app) as a service. I don't want to create two services with dependancies on them and creating another java app just for copying the jars sounds and overkill for the problem.
Can you think if a nice way to do it? I thought maybe downloading a template of a generic windows service (I don't care what language, preferablly C\C++) and make it copy the jars\libs to local disk and then execute the regular service to run from there. If this is the write way, is there an equivilant of the exec linux system call in Windows? i don't want the startup executable to stay alive while the app is running.
Thanks in advance

Related

Running an IDE on MacOS from Docker

I am working on a project which has a particular filesystem requirement. In order to build the project, I will have to create various sub-file systems on my Mac. However, I do not want to meddle with the file system on my actual mac as I could corrupt it. Hence, I want to use a docker container.
I use eclipse as my IDE. However, in order to use the docker file system in my IDE - I have to run the IDE from within the container. (I am able to do that successfully by following this
However, this is super super super slow, and I cannot develop on the IDE running inside the container.
Is there a way to use my IDE by running it outside the docker container (on my actual machine) BUT link it to the file system and directories of the container?
Having everything inside a docker container can quickly lead to absolutely horrible IO performance. See here for in-depth details.
We have a similar problem: a really large project, that can be built using a predefined docker infrastructure. But having the docker container work on the native MacOS filesystem is several times slower compared to running the same docker setup on a Linux machine (just because the IO from the docker to the underlying file system).
Our solution: the source code lives and gets edited directly on MacOS filesystem. Then there is a docker volume that contains a copy of the project. And: a permanent docker instance that does nothing else but rsync the two sides. Of course, the first rsync takes its time, but afterwards, it is just about small changes on either side.
Long story short: I suggest to "reverse" things. Don't move your IDE into docker, but move the source code out of docker.

Changes to a java application server not showing after deployment

I'm using a system which runs various Java programs from a cloud server. The programs use external command line tools. Our programs build up commands and send them to another java program, an application server, to further process and execute the command.
I'm working on something which involves editing the application server. I make changes, package it as a jar, deploy it to the server, and then run a script which executes the application server. The script uses the location of the jar file on the server as the path of the executable. However, none of my changes appear after running and deploying.
To make matters more confusing, even DELETING the jar on the server and stopping the process does not make any changes, i.e. running a request from one of the programs is still successful. Deleting this jar ought to break things, right?
I'm sure the jar path that the script is pointing to is correct. I guess my question is, is there anything further that needs to be done to edit an application server program running on a server?

Jubula - Test suite will not map the object possible jar issue?

I'm using Jubula to run some automation for a large Java project. The gateway is a launcher that sets all the parameters etc for the project to run. The gateway is wrapped as a .exe file. I converted it back to a jar in order to get Jubula working with it, I managed to one time but not all the projects jars were launched from the main project launcher. If I attempted to use the .exe within the AUT properties, it won't launch at all. If I convert back to a jar, then I run into an issue of either not being able to object map no matter how much I press CTL+SHIFT+Q or some of the apps don't launch when I use Jubula to automate. Also I need to create a bat file to launch either the jar or the .exe file in any case. I can't just launch the jar from settings within AUT properties.
Is this an issue of the .exe wrapper being the culprit and I should just launch everything without the project launcher or are there known issues with object mapping someone can alert me to?
The .exe should mean no problem. If you can't map it means the RC (Remote Control) .jar is either not present or is not launched. Could you check that?
The less likely possibilities are Firewall blocking the communication between remote client and AUT agent (corporate machines with Windows usually do), or that you're using incompatible versions of RC/AUT agent/Testexec triple. The latter can only happen if you've updated your Jubula on your machine to newer version.
Actually it wasn't an issue with Jubula at all. I had a permissions issue somehow with anything Java related. So I got my machine reimaged and now everything works like a champ.

Is there any guide showing how to build effectively an application with appengine and maven in eclipse?

I'm trying to develop an application using Google App-Engine and Maven using Eclipse. I am facing a problem where by whenever you change a CSS or JSP file, a restart of the application is required. This makes working quite difficult, since a reload takes a lot of time.
For example when you develop on tomcat no need for restart is required when such a change is made, only Java or xml file require restart of the server.
Is there a solution that mimics the tomcat behavior on GAE SDK when developing on localhost?
If you've built using the standard app engine maven archetype, when you run mvn appengine:devserver from you -ear directory, the exploded war working directory is located here:
<yourapp>/<yourapp>-ear/target/<yourapp>-ear-1.0-SNAPSHOT/<yourapp>-war-1.0-SNAPSHOT.war
If you change any JSPs in this directory, they will get reloaded without needing to restart the devserver.
Thus, you can set up a simple script or command that copies all your JSPs and static files from /-war/src/main/webapp to that deploy directory whenever you want your files to be refreshed. I saw on some threads where people set up their IDE (in this case IntelliJ) to automatically do that copy whenever the IDE loses focuses, which makes it trivial to get pages reloaded.
Building application with appengine in eclipse using maven is not very effective and time consuming because on every change on jsp/css/js with a traditional approach there is a need to restart appengine or mvn appengine:devserver.
#adevine make me thought about a solution, and I found this link: http://andrei.gmxhome.de/filesync/index.html wich installs a plugin in eclipse, then I activate the project to sync files from myapp/src/main/webapp to a target folder generated by maven myapp/target/myapp-snapshot-0.0.1.
It's working!!!
Whenever a change is done in webapp the files are transfered automtically(no need to run anything else, just save the file) to the target folder and are reloaded successfully.
Hope this could help people because its frustrating working with appengine(restarts takes a lot).

Have Jar copy to another Directory when Executed

I have a Jar file that when I'm executing I would essentially like it to copy to windows startup, and start on its own.
If this isn't a possibility I'd like to copy the JAR file to another directory and then modify the registry to have it start this file on startup.
I've tried using Files.Copy and using FileStreams without any success for the currently running file, is this going to require me placing the Executable Jar within a jar to essentially copy the file, and then execute it?
Thanks for any insight.
Based on your question. It seems like you want your program to run on startup.
If that is correct, then you could have your java class run as a windows service. Try using a java service wrapper like tanuki software.
Running java application as a windows service
How to create a windows service from java app

Categories