deploy jar on Windows Server AWS EC2 - java

I need to run a jar on a windows server instance.
I would like to build/update/redeploy the jar through a script.
On Linux I know how this works but I cannot seem to find any information how this works on Windows server.
I build the jar somewhere on jenkins.
On linux I can scp (ssh-copy) the jar to the server on a certain location. Then restart it.
In Windows don't even know how to copy the file on to the server without logging in manually via RDP.
I would like a scirpt that I can run in jenkins, that connects to windows server. Stops the running jar and exchanges it for the new one. Starts it up again. (with windows file handles I'd have to stop it before overwriting the jar).
How does CI work on windows server?
PS:The issue is that the jar starts up a process which only runs on windows server in a NON headless mode and thus, I cannot get around windows.

Related

Mac Os Catalina prevents jar app to folder

I have a .app on mac that launches a jar via a sh script. This means that the app itself is just lunching a jar then the app is no longer running as the jar starts.
The Jar requires access to the launching users Desktop, but in Catalina due to new security restrictions the desktop is blocked. Anyway to trigger in java a mac alert that allows the user to grant access? This is the best approach due to if you go to privacy and whitelist to full folder access the user can only add the app, not the jar/java jre which is what i believe the issue is.
So i was able to figure it out. My app launcher was a sh script that ran an exec java ... so basically bc i wanted to use my included framework i launched from java bin folder in the .app using an exec command in a shell script that.
I changed to just running the command line and setting the icon without exec, so in essence java launched like it would have if i executed out of terminal . By doing thus catalina recognized the folder access and prompted for access properly.

Possible to start up Jenkins again via ..war file even though the machine where Jenkins is deployed restarts?

Is it possible to start up Jenkins again via .war even though the machine where Jenkins is deployed restarts?
I have jenkins deployed on a Virtual machine using a .war file with the following command: java -jar jenkins.war
If the machine gets restarted, the command prompt which is using the above command closes and therefore stops my instance of Jenkins from running.
Is there a way to automatically start up Jenkins again even if the machine gets restarted?
VM is using windows 2008 server.
Thanks
Msconfig in Run > startup programs > add your command.
It will be executed on start of OS.
Creating a batch file and pasting in the following location has resolved the issue: C:\Users\zzzzzz\Roaming\Microsoft\Windows\Start Menu\Programs\Startup

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

Deploy java program on Linux

A web application has been developed in C# which hits my Java code through a restful web service which returns a JSON response.This process was working on a local machine with tomcat server. Now my Java application needs to be hosted on an external server in Linux environment.
Using putty, I logged into the particular hostname and as a root admin.
I have installed Java JDK 1.7, Apache tomcat server 7, my Java application as a war file is placed in the webapps folder. I can start the tomcat server too.
My question is:
How do I hit my application from windows. Is it http://x.y.z.k:8080//MYAPPNAME(war file name)/?
How do i check the java logs in the linux env?
Also I have a set of files that I read from my windows folders as in C://uploads//file.txt or C:\DeveloperTool\Pluggins\
I replaced them with the linux structure in my java code. as /home/opt/file.txt
Will this work?
How do I hit my application from windows. Is it
http://x.y.z.k:8080//MYAPPNAME(war file name)/?
If 8080 is the port Tomcat is configured to listen on (I think by default, it is), then that is correct. Bare in mind the web app name is case sensitive. You can configure this setting in $TOMCAT_HOME/conf/server.xml
How do i check the java logs in the linux env?
Since you're using a remote shell over SSH, you will want to use either tail or less to monitor logs in real time. The log files are stored in $TOMCAT_HOME/logs.
Try
$ less +F /path/to/tomcat/logs/catalina.out
catalina.out is the main file when running Tomcat on *nix systems.
Also I have a set of files that I read from my windows folders as in
C://uploads//file.txt or C:\DeveloperTool\Pluggins\
I replaced them with the linux structure in my java code. as
/home/opt/file.txt Will this work?
As Lutz Horn mentioned in the comments, try it. In theory, that should work fine as long as the permissions are setup properly.

"Failed to create java" on running Windows service

I have a java application, which has to run as windows service.
I am able to install the service using the following command.
"%EXECUTABLE%" //IS//%SERVICE_NAME% --StartClass %STARTER% --StopClass %STOPPER% %START_PARAMS% %STOP_PARAMS%
The service is installed successfully but when i try to run it it shows Failed to create java. path also it is not showing in the jkartha log file.
I have JAVA_HOME environment variable pointing to jdk1.5.
and even i copied msvcr71.dll to windows\system32 folder and restarted the PC.
I am running this on windows 2008 server.
I didn't install apache tomcat server. prunsrv.exe and procmgr.exe i just copied.
Please suggest me how i need to overcome this problem.
whether to run application as windows service, prunsrv.exe, prunmgr.exe are enough is it? I am able to successfully install but not able to start why???
You probably need to set your service to run as the user that installed Java, otherwise it won't find its environment variables.
If you must run in the default Local System account, then you can run a batch file that sets up the environment and then launches java.exe.

Categories

Resources