what is the easiest method to run a Java program inside a gear on OpenShift?
I don't need a complex framework or web server. I just need a container to which I can upload my Java Files, compile and execute them in the cloud. The application I have in mind is very simple, a program that gathers some information and that I can connect to via RMI and just ask for the data.
Thanks.
If you don't need an application server you'd better take a look at DIY cartridge. You'd just have to create it from your code:
rhc app-create yourapp diy-0.1 --from-code git://github.com/(...).git
You could even use git hooks to launch it. Take a look at the hooks I use at my Wedding Tables Planner web, based in this template.
I think easiest is tu run a jbossas app and stop the jbossas cart if necessary. Otherwise you may play with the diy app type.
Related
I have created a java application in intellij ide. The application is working well. Now that my application is ready I want to transfer my java application from my machine to server and make it live. I have one server, domain and all the basic rights in the server. Can any one help me figuring out?
I am very new in this part. I dont know anything about hosting my own website and application.
The answer depends on what technology you use. If you use application that needs to be deploy into servlet container you can deploy it onto e.g. Tomcat.
Whatever technology you use you definiately should build your application - it also depends on what building system you use.
E.g.fFor gradle, you can use gradlew build.
For maven: mvn compile.
Tell us more details about technology you use to allow us to help you.
You have a java application (Dropwizard) and first need a server to run it on, which means that it must be a server with java installed or where you can install it yourself.
Then you need to transfer the application "fat" jar (typically you find this in the target directory, depending on how you built it) to this server and start it with java -jar my-application.jar.
Then you need to make sure that the port that the application runs on is available externally. This usually means that you need to have a web server installed (commonly nginx or httpd) which redirects from port 80 or 443 to the port of your application.
Only then is you app "live".
We have to develop an application using Java Play Framework 2. There is a simple database calling H2, and we can browse it using h2-browser command in play console, but if an application compiled with 'dist' command, we didnotget access to the play console, but we need to debug database. So how can we access h2-browser without play console in 'dist' compiled application.
Thank you for answer.
p.s. Sorry for poor english
Download and run the standalone H2 engine and connect to it using ServerMode (from both: Play and browser), link and samples available at H2 docs.
Note performance will drop while using TCP connection so back to Embed solution after debugging if that matters to you.
I now have a java program and amazon instance provided with a key..
Used to run java on aws programmatically, but now all I need to do is, use this instance, powerful.. to run my java application, but how.?
Should I make my java program a .jar and upload on the instance?
And documents about the command needed?
Thanks.
You upload a file to your EC2 instance with scp:
scp your.jar root#your.ec2:/tmp
You run your file with ssh:
ssh your.ec2 "java -jar /tmp/your.jar"
All that can be easily automated since no passwords are required to execute scp or ssh, you'll just need to exchange certificates.
Or did you mean that you wanted to make Java program part of your image?
If your Java application is web based, I would encourage you to have a look at Amazon's Elastic Beanstalk
http://docs.aws.amazon.com/elasticbeanstalk/latest/dg/create_deploy_Java.html
This service allows you to quickly deploy and manage applications to the cloud without worrying about the underlying infrastructure.
See more at http://docs.aws.amazon.com/elasticbeanstalk/latest/dg/create_deploy_Java.html
Seb
I need to call a jar which is kept on a shared windows machine.
The JVM also needs to be placed on this shared machine so that anyone with access to the remote location should be able to call this jar.
I need to write a windows script which shall be run using a service user.
Is this possible? If yes, request you to please provide pointers.
Java Management Extensions provides the tools for building Web-based, distributed, dynamic and modular solutions for managing and monitoring devices, applications, and service-driven networks.
see JMX Tutorial
see example with Linux script
see Windows cmd script
You might have some luck using the Tanuki Software Java Service Wrapper. Jetty uses this for their Windows Service Wrapper.
Another option is Apache Commons Procrun, which is what Apache Tomcat uses.
Both work well to set up a Java application as a Windows service. You will need to ensure your application is designed to run well as a service; you should be able to "trigger" events (start, stop, restart, etc.). You might need a lightweight adapter around the application to get it to work right as a service; but that should be a trivial exercise.
Once you have a service set up, make sure appropriate user(s) have rights to start/stop the service [1] [2]. You could even set the service up to run using a specific account. Then you can use the net start, net stop, etc. commands in a batch file.
I have a rails app that talks to an api running on the same domain via ajax calls. I want to test this app using cucumber. The api is written in java and packaged as a jar. How can I mount the jar when using cucumber?
There is no way to do it automatically but you can add Before hook into env.rb or put it into separate file and in this method you can load your java extension by issuing shell command, you can store process pid in variable and kill this process in After callbalk. You can configure Capybara to start server on specific port and I think you can tune your application to use specific port too.