Executable jar file won't run on centOS - java

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)

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.

error in opening jar file rt.jar jdeveloper Oracle Middleware

I'm developing a project with web services in JAVA, in JDEV.
I'm using Oracle Middleware and I am getting this error when trying to run every time:
Error occurred during initialization of VM
java/lang/ClassNotFoundException: error in opening JAR file C:\Oracle\Middleware\Oracle_Home\oracle_common\jdk\jre\lib\rt.jar
Process exited with exit code 1.
I've found people with the same issue, but apparently no fix so far:
https://community.oracle.com/thread/3783771?start=0&tstart=0
My workaround is to copy and paste the .jar in my local project folder.
But is pretty annoying to do this everytime I want to run.
It works after doing it, so I'm sticking to that for now.
I'm using Windows and my app does not "crash" when running in a Web Logic Server so I'm thinking is something in my laptop.
The .jar is fine, and is not 0kb.
Modify access control of the rt.jar file in windows.
Give full control to the windows logged in user.

how to run a spring application in tomcat without using eclipse etc

my application is running in eclipse but i want to run it on tomcat .i want to run my spring application in tomcat server and don't want to use eclipse or any other tool, so how can i do that and where do i put my various files basically the directory of it, and the complete procedure to do that.
main problem is in the directory structure and the path to be put in the tomcat server to run that application. i tried but it gives the 404 error file not found ,as i am new to the spring framework explain in detail
You are asking a very broad question. But, in an attempt to point you in the right direction please see this article. The link given provides insight into the directory structure of your application.
Now as far as running "outside of eclipse" you should be able to export your project from the "File" menu as a "Web Application Archive" or "WAR" file. This file can then be placed under ${CATALINA_BASE}/webapps and be launched when you start your container.
If you are using a stock configuration and you have an archive named "myapp.war", you can access it on
http://localhost:8080/myapp
I hope this information helps you get to where you need to go.
First export the war file using eclipse as you are using eclipse.
Then follow the procedure
How to deploy a war file in Tomcat 7

Have Jar copy to another Directory when Executed

I have a Jar file that when I'm executing I would essentially like it to copy to windows startup, and start on its own.
If this isn't a possibility I'd like to copy the JAR file to another directory and then modify the registry to have it start this file on startup.
I've tried using Files.Copy and using FileStreams without any success for the currently running file, is this going to require me placing the Executable Jar within a jar to essentially copy the file, and then execute it?
Thanks for any insight.
Based on your question. It seems like you want your program to run on startup.
If that is correct, then you could have your java class run as a windows service. Try using a java service wrapper like tanuki software.
Running java application as a windows service
How to create a windows service from java app

What needs to be set up on Unix for a java web client?

I created a client using proxy in Oracle JDeveloper to call web service. JDeveloper deployed automatically and the code works well under windows environment. But now I'm required to migrate the code to unix server. I deployed the project to a .war file and copy it to unix which cannot be executed correctly using "jar" command.
Could anybody give me a whole picture or a high-level step-by-step instruction about what I need to set up to execute war on unix? I'm new to this area, and for now I got some suggestions like installing a Tomcat first.
What I have now:
1. a war file including .class, .java, WEB-INF, META-INF, MANIFEST.MF deployed from JDeveloper
2. JDK 1.6.0_25 installed on unix usr/java/
3. Tomcat installed on unix, but not under bin or local or usr directory(is it ok?)
Some specific questions:
1. what else do I need?
2. where to drop the .war?
3. do I need to unzip or re-compile the war?
4. how can I run the main class in the war?
Errors poped-up now:
1. cannot find main class
2. I tried to un-zip war and compile the class including main, and get "cannot find symbol" for the webservice specified classes' name.
Thanks to whoever attempt to help!
Even though this question probably should've been asked on ServerFault instead of here, sounds like you got all you need. Try dropping the .war on tomcat's webapps directory.
You should be able to just drop the .war file in $CATALINA_BASE/webapps and tomcat should pick it up when you start it.
$CATALINA_BASE is where you installed tomcat, unless you've configured tomcat for multiple bases.
You only need a war file if you are developing web application. From what you describe, you need to create a zip file which contains all the libraries and classes you need and copy it to Unix. Then you unpack it and execute it using java command.
Alternatively you can create a jar file with all dependencies included using Maven Shade Plugin and execute your code using jar command.

Categories