Java program to build and run a maven project [closed] - java

Closed. This question needs details or clarity. It is not currently accepting answers.
Want to improve this question? Add details and clarify the problem by editing this post.
Closed 6 years ago.
Improve this question
I was trying to create a java application that automatically build my project.Is it possible to create a java program to run a maven project?

You can follow below approach to start:
Create a batch/shell file to build your project using mvn/ant/gradle
command. You would need Maven/Ant/Gradle installed in your system
and environment variable needs to be setup properly.
Run This batch/shell file using java by taking advantage of Runtime
Class. Runtime.getRuntime().exec("cmd /c start build.bat");
To schedule your java program, Use ExecutorService or Quartz. Or you
can take advantage of Operating System Schedulers as well.
Hope this helps.

Related

Is there a way to add a path variable on macOS with a single bundled archive? [closed]

Closed. This question needs details or clarity. It is not currently accepting answers.
Want to improve this question? Add details and clarify the problem by editing this post.
Closed 1 year ago.
Improve this question
I've got an install4j program which contains 2 launchers, 1 GUI launcher and 1 command line interface launcher.
Currently the program uses a single bundle archive to install on macOS and it would very time consuming to change this. I was wondering if there was any way I could add some sort of path variable or symlink which would allow users to run my CLI launcher anytime from terminal. (The GUI launcher is installed and set up perfectly already!)
Modifying the PATH environment variable is not easily possible on macOS and a change like that might not be appreciated by some users.
I would recommend adding symlinks to /usr/local/bin, that directly is already in the path. You can do that with "Create a symbolic link" actions.

How do you build a docker image if you only have a shell installer for a java application? [closed]

Closed. This question needs to be more focused. It is not currently accepting answers.
Want to improve this question? Update the question so it focuses on one problem only by editing this post.
Closed 5 years ago.
Improve this question
I'm new to docker and want to understand on how to build a docker image that I can deploy in my organization's internal cloud
Currently, our vendor has provided us with a shell script which we use to install a java application on a VM.
Is there any way to build an image for this java application using this shell script?
Thanks.
Yes, just use
FROM <base_image>
to define the base image you want to start with (i.e. the best suited environement for you application to work: typically you would use Ubuntu 16.04, or maybe an Alpine linux distribution if you want to be more lightweight
then
RUN <shell-script>
to install you application
(note that if there are dependencies needed for the script to run (like JAVA), you will need to RUN the install steps for the dependencies before this RUN command)
and then
CMD <command-to-start-the-app>
to start the app.
A good place to start with Docker is to look up the official images of known services on github and see how they do it.
There are many images using JAVA, with a base like https://github.com/dockerfile/java

How to make a remote shell gui in java [closed]

Closed. This question needs to be more focused. It is not currently accepting answers.
Want to improve this question? Update the question so it focuses on one problem only by editing this post.
Closed 8 years ago.
Improve this question
I'm working on a java program that needs to be able to connect to a remote server and execute system commands. How would I create a command shell that looked exactly the same as windows command prompt for the client, but executes the commands on the remote server? Thx in advance
It's possible to do, but it's not easy - java has never been great for command-line operation. If you want to do it, look for java-based SSH implementations.
On the other hand, if the user will be running the java program from the command-line, it may be possible to execute an ssh command on the same terminal.
Here is a page that describes executing an external program from java: http://alvinalexander.com/java/java-exec-processbuilder-process-1.

Tomcat UI for windows Installation [closed]

Closed. This question needs to be more focused. It is not currently accepting answers.
Want to improve this question? Update the question so it focuses on one problem only by editing this post.
Closed 8 years ago.
Improve this question
As tomcat server is completely developed in Java, yet its installation file(.exe) are available for windows. As tomcat is open source, does the process of converting this java server application into windows installation file also documented anywhere. Which tool they use and how its works. How have they created UI wizard to take user inputs and do the registry entry and install tomcat as service.
Regards
They use Nullsoft Installer called from the ant build.
The nsi script can be found on svn, as well as all of tomcat code.

Executing script file using Eclipse [closed]

Closed. This question needs details or clarity. It is not currently accepting answers.
Want to improve this question? Add details and clarify the problem by editing this post.
Closed 9 years ago.
Improve this question
I am creating one .sh file using ECLIPSE on windows machine.
How can I make that same .sh file run on Ubuntu using that same Java code
to run on linux
Runtime.getRuntime.exec("foo.sh");
The class java.lang.Runtime features a static method called getRuntime(), which retrieves the current Java Runtime Environment. That is the only way to obtain a reference to the Runtime object. With that reference, you can run external programs by invoking the Runtime class's exec() method.
To execute a .sh script on Windows, you would have to have a suitable command interpreter installed.

Categories