Programmatically stop and start JBoss in Eclipse - java

Is it possible to programmatically start and stop JBoss in Eclipse? I am using Indigo Eclipse Java EE, I have a JBoss 5.1.0.GA server that I manually start/stop in Eclipse.
I want to automate restarting the server (as part of a test procedure to restart the server to reflect changes in the database). Is there some library that I can use to do this, or some other way of accomplishing this?

Create a .bat or .sh file (depending on the OS your JBoss instance is installed) with a script that executes the shutdown (bat or sh) and then the run (bat or sh). There's no need to use Java or any other programming language for this.
Still, if you really want to do this using Java, you can use one of the approaches (again, depending on the OS):
Batch files:
How do I run a batch file from my Java Application?
Shell files:
Java - Execute a .SH file
Running .sh files with Java's exec in a different directory?
Just note that the run and stop scripts files are in [JBoss_install_path]/bin

Related

How to properly deploy .jar file using Tomcat (Or another solution?) on an EC2 instance

So I have a Spring API which I packaged as a .jar file. I would like to run this perpetually on my EC2 instance. I have downloaded tomcat 8.5 from aws-extras onto my instance and have placed the jar file in the .lib subfolder and started tomcat but I can't query the API.
Am I missing a step or is there a better way to do this without Tomcat?
The API works when run with java, but I would like a solution that has it constantly running on the server.
The easiest way I found to do this is with the following command.
nohup java -jar path/to/jar.jar &
This ensures the jar will run as a background process.

How to update native built JavaFX Application

I am building a JavaFX application in Intellij that will be built and distributed with an .exe installer and will be ran as an exe Application. I have been trying to find a way to allow for remote updates, but I have only found resources that update a jar file by using another jar file hosted on a website. Is there a way to allow for remote updates to a exe JavaFX application? I have though about using update4J, but sadly I have no idea how to implement it, use it, or if it will even work with exe applications. I have tried to use FXLauncher, but I am not able to use JavaFX with maven as an error occurs whenever I try adding maven framework to the project.
I am the developer of update4j.
The framework used to be complex and hard to use, but the last release (1.2.2 at time of writing) significantly simplified things leaving only one pain point, namely, generating a configuration.
So for starters, launch the framework using it's own main method:
# on classpath
$ java -jar update4j-1.2.2.jar
# on modulepath
$ java -p update4j-1.2.2.jar -m org.update4j
And read the output.
Creating the configuration is done using a builder, I'm still documenting it but the class javadoc for Configuration is quite complete.

how to create exec with installer and automatically run file

Recently I developed a jar file with JavaFX. Now my problem is how to convert it into an executable so it can install and run on other systems which do not have any JDK installed.
Also, when the client system starts from shutdown or hibernate I'd like the executable to run automatically.
I searched a lot on Google and I found content on the internet, but I did not find how I can achieve this.
how I can convert it into exec with the install so it can install into other systems which do not have any JDK on that system
You always need the JRE to run the jar file, there's no way around that. However, since the assumption that almost all systems would have the JRE installed is no longer correct, the normal thing these days is to bundle the entire JRE with the installer and use launch4j to create an exe file.
and another thing I want is that when client system start from shutdown or hibernate exec should run automatically.
You can't do this at the Java level, so it depends what OS you're running on. On windows you could use sc.exe to create a windows service from the executable, or you could just put it in the relevant user's startup folder.

Executable jar file won't run on centOS

I want to execute a little java program I wrote on my server running centOS and having the jdk1.7.0_10 running.
When logging onto the server with PuTTy, i navigate into the folder containing my eclipse generated runnable jar file jbtct.jar and try to launch it using the Command java -jar jbtct.jar.
But instead of launching, my putty session would just get stuck with nothing happening and The log files my Program should create won't come up as well.
I have a tomcat with applications running on the same server working quite well, so I guess it's some kind of config error. But what kind?
Alright, I solved the Problem! Eclipse may generated the runnable jar, but the Manifest files weren't set up properly as I was using maven to manage my dependencies.
The Solution was to add some code to the plugin management as described here (Posted by mike)

TO Use Cygwin within Eclipse 3.6

I'm working in J2EE application. We are developing application in java/j2ee. In our project we use cygwin to simulate linux os, run shell script included in application and to deploy. How to use eclipse to embed eclipse and cygwin and deloy in run/debug mode.
Am new to this kind of stuff and confused to how to proceed further. Please suggest me how to proceed with this.
Thanks in advance.
Appreciated for guiding...
We r developing j2ee project in window env. and deploying in linux server.
so to simulate linux in windows we use cygwin.
Now we use eclipse to develop and get into cmd prompt and start cygwin and then run basic shell script to initialize variables and build the project and deploy the EAR in linux server ...
For these two purpose i have to toggle the window and i couldn't debug the code and check for check time data.
Is there any possibility to merge cygwin with eclipse to start the server or in run in debug mode, so that my developement process would be efficient and easy to code walk through... My enter team is following the first process which may tedious work.
Can any one suggest to work efficient with this project
Thanks in advance
Don't use shell scripts for your deployment process. Maven almost certainly has plugins for everything your shell scripts are currently doing, and it runs on Windows and Linux transparently.

Categories