restarting a java console application
At the moment I have a console application. I would like to be able to exit the application, update through svn, recompile and then relaunch. This is running under a Linux environment. At the moment I'm not sure how I would be able to relaunch the application. Is there a way to do this?
Asked by: Brad366 | Posted: 23-01-2022
Answer 1
You could create a file, say .relaunch
, when you exit the application in the specified circumstance and have the compile script remove the file and start the application when it has finished compiling if the relaunch file exists.
Answer 2
There is a low tech way to do this - assuming you want it all done in code:
1) Have your app launch a separate process (then exit) that:
a) Calls the svn.exe (or get svnkit...) with args to get the latest source
b) Calls you ant or whatever script to compile
c) Exec your newly compiled app
d) Exit
Similar questions
java - How do I reload servlet classes without restarting my web application?
I want to reload just my web layer classes without reloading my service layer classes (which take longer to initialize and change less frequently). There are no references from my service layer into the web layer and I can create a whole new instance of the web layer without problems.
I can conceive of a solution involving complicated class-loader tricks to isolate the web layer in its own class-loader and I think...
java - Cannot delete a database object after restarting the application
We have a Java application that uses Hibernate and a MySQL database. Delete transactions appear to work fine at first. But, if we exit our application and restart it, we are no longer able to delete anything from the database. We do not get any errors, the entries just don't delete. We can still create all and edit most entities.
I know that there are a lot of implementation-related reasons why this wouldn't work. ...
java - application loses touch input after restarting
I'm writing a 2D engine on android. I can receive touch input and update my scene according to touch events but there is a problem. When I restart the application after losing focus (clicking home screen button, receiving a call etc..) I can no longer receive touch input, screen still displays the content but it stays frozen.
Is there a way to fix this issue?
Here is the code :
import android.os.B...
Restarting Java Application
How can I introduce automatic updates and restart feature in Java Swing applications.
Also I needed to roll back to previous versions.
I have made a application jar file and launcher jar file, which launches the application jar file.
This attempt was successful. But I can not integrate these two jar files, when creating a installer for MacOSX.
The Launcher class as follows:
public class...
debugging - How to repoen Java's Console without restarting application?
I use the Java Console to debug / QA my company's products but sometimes I accidentally hit the "Close" button and in order to see the window again, I have to restart the entire application.
Is there an easier way to reopen the Java Console without having to restart the application?
Edit: I test the Java application on Windows, Linux, and OSX
java - how do I change log level in runtime without restarting spring boot application
I have deployed springboot application in PCF . I want to log the message based on the environment variable .What should I do so that the run time log level change will work without restarting the application?
java - Restarting Android application that has been uploaded to Google Play Store
I created an Android application a few months back and uploaded it to the Google Play Store. Over the past few months I've had a lot of practice with Java and Android development; naturally, I decided to update my Android application with my new found knowledge. After exploration of my Android code I was horrified by how unorganized and sloppy my entire application was. I then decided it would be best for me to simply star...
Update List in Java without restarting the application
I have a predefined list of phone numbers to block in my application, the list is being created based on a file input in PhoneListFilter constructor.
I need to be able to add and remove items from this list without restarting the application. I was thinking about implementing FileWatcher which could start a thread and check the file for any changes every 5 minutes or so and update the list. Is it a good approach or...
java - Stopping and restarting a file based H2 database from a Spring application
I have a use case where I need to backup the database. As with H2 the database can be stored in a file, this seems to be easy to just copy the file away. However this should happen while the application is running.
For that reason I have to stop the H2 database beforehand and restart in again afterwards.
I have this simple Spring boot application based on this Maven configuration:
<?xml v...
java - Restarting Springboot Application via batch script
I have a Springboot application which I need to restart upon returning some exit code(System.exit(5)) say. I know nothing about writing batch script.
Upon searching I found code which seems for a Java core Application.
@echo off
:start
java SpringBootApp %1
set exitcode=%ERRORLEVEL%
pause
if %exitcode% == "5" (goto :start)
Other methods were of using jar files, ...
windows - IE6 generated strange worksheet name when doing export from java application
I am encountering error like
test(10)[1].csv file cannot be found at
C:\Documents and Settings\Ron\Local Settings\Temporary Internet Files\Content.IE5\PQ0STUVW
When trying to do export of CSV file using the following codes.
Anyone have any idea what could be wrong? This issue does not occur in IE7 / Firefox and is only specific to IE6.
response.setContentType("applicati...
c# - Embedding Flash Player in a C++ or Java application?
I would like to embed Flash Player directly inside a C++ or Java application.
I found an article that describes how to do this for C#:
http://www.adobe.com/devnet/flash/articles/stock_history03.html
Unfortunately, I have no experience with C#, COM or ActiveX. I need someone to translate this code to C++, allowing ...
java - How best to implement user selectable variables in web application
I have a Java based web-application and a new requirement to allow Users to place variables into text fields that are replaced when a document or other output is produced. How have others gone about this?
I was thinking of having a pre-defined set of variables such as :
@BOOKING_NUMBER@
@INVOICE_NUMBER@
Then when a user enters some text they can specify a variable inline ...
java - BIRT in a desktop application
Did someone ever used a BIRT report in a desktop application. I'm comming from the .NET environment and there you can use Crystal Reports to show reports in desktop apps. Is this possible with BIRT too, without having to set up a server environment?
Can you give me some advice how to reach this goal?
Thanks in advance.
which library better for faster java application swt or swing?
which library better for faster java application swt or swing?
java - Which is the best Open source application server?
java - Access spring bean that is exposed using http invoker from GWT application
Can I access spring bean that exposed using http invoker (server) from GWT application (client)?
If so is there any example / tutorial for that?
How to close a Java Swing application from the code
What is the proper way to terminate a Swing application from the code, and what are the pitfalls?
I'd tried to close my application automatically after a timer fires. But just calling dispose() on the JFrame didn't do the trick - the window vanished but the application did not terminate. However when closing the window with the close button, the application does terminate. What should I do...
java - How best can I isolate my application from an unreliable database?
I have a Java SOAP data service which sits on top of a Sybase database which, for reasons out of my control, has unreliable performance. The database is part of a vendor package which has been modified by an internal team and most of the issues are caused by slow response times at certain times of the day.
The SOAP service provides data to a calculation grid and when I request data, I need the response time to be ...
java - Netbeans GUI Designer & Fixed-Size Application Panels
I'm having a problem, creating a fixed-size overall panel for a touchscreen GUI application that has to take up the entire screen. In a nutshell, the touchscreen is 800 x 600 pixels, and therefore I want the main GUI panel to be that size.
When I start a new GUI project in NetBeans, I set the properties of the main panel for min/max/preferred size to 800 x 600, and the panel within the 'Design' view changes size. ...
Still can't find your answer? Check out these amazing Java communities for help...
Java Reddit Community | Java Help Reddit Community | Dev.to Java Community | Java Discord | Java Programmers (Facebook) | Java developers (Facebook)