Unable to access jarfile on server using VNC - java

I'm trying to run a java application on a server computer by using VNC (tightVNC).
I have the java application in eclipse and it runs perfectly. Then I export it to a runnable jar file and upload the runnable jar file to the server. Now I'm trying to run the application (called ABUN_0.0.0.jar) using VNC.
I use /u01/gatc/java/jdk1.6.0_10/bin/java -jar ABUN_0.0.0.jar& (I've used this for previous versions of the app and its worked perfectly). However now I get Unable to access jarfile ABUN_0.0.0.jar

instead of
/u01/gatc/java/jdk1.6.0_10/bin/java -jar ABUN_0.0.0.jar&
use this,
/u01/gatc/java/jdk1.6.0_10/bin/java -jar /**path to jar**/ABUN_0.0.0.jar &
or
if Linux System,
check ABUN_0.0.0.jar's permission level.
To give Permission,
chmod 755 /**path to jar**/ABUN_0.0.0.jar

Related

Mac Os Catalina prevents jar app to folder

I have a .app on mac that launches a jar via a sh script. This means that the app itself is just lunching a jar then the app is no longer running as the jar starts.
The Jar requires access to the launching users Desktop, but in Catalina due to new security restrictions the desktop is blocked. Anyway to trigger in java a mac alert that allows the user to grant access? This is the best approach due to if you go to privacy and whitelist to full folder access the user can only add the app, not the jar/java jre which is what i believe the issue is.
So i was able to figure it out. My app launcher was a sh script that ran an exec java ... so basically bc i wanted to use my included framework i launched from java bin folder in the .app using an exec command in a shell script that.
I changed to just running the command line and setting the icon without exec, so in essence java launched like it would have if i executed out of terminal . By doing thus catalina recognized the folder access and prompted for access properly.

Sudo java -jar vs java -jar

I have a server running on Java using the library Pi4j to control the RaspberryPi's GPIOs and a file on which I write the current GPIOs' statuses. When I run the code from IntelliJ IDE everything works just fine.
But when I create the .jar file and run it like
sudo java -jar server.jar
It works fine updating the file, but the GPIOs do not change their status.
When I do
java -jar server.jar
The GPIOs correctly change their status but I get the error java.io.FileNotFoundException: relStat.txt (Permission denied)
My file permission are all set to anyone, so anyone should be able to read, modify and run it.
Why does this happen?
This is a permission issue,
The file owner is the "pi" user.
Which user you are running under?

Adding Java jar as Ubuntu service

I am trying to add my java jar application to Ubuntu as service so that when the Ubuntu server is restarted I dont need to manually run the jar command to run my application. At present I have to run this cmd on the terminal
java -jar myapp.jar -conf conf.json.
I came accross this link which would have solved my problem but for some reason the service is not running when i run the service as described in that website.
http://www.jcgonzalez.com/ubuntu-16-java-service-wrapper-example
Can someone please help me!!
I think your bash script should have "nohup" like this:
nohup java -jar myapp.jar -conf conf.json &

Launching jar file on Azure virtual machine

I am developing a java server-like application (though it is not a server itself, more like a bot for social network) and I decided to use Azure virtual machine to deploy the app on. So I've chosen Ubuntu virtual machine. I successfully uploaded .jar file on server, connected to it with Bash shell for Windows and SSH (as described in manual for Azure). Then I am able to launch my file with java -jar server.jar and it works. But the problem is that when I close the shell on my home computer, the app shuts down on the server too. So my question is how to launch .jar file in the way where it won't exit once I close SSH session?
Run the command in the background with nohup:
nohup java -jar server.jar &

java missing class when supervisor running process but not when running as www-data user

I've made my first clojure app and I've built it with leiningen by running lein ring uberjar. I can run this on my dev machine (fedora 23) and I can run this on my ubuntu production machine java -jar tomahawk.jar. I've followed the digital ocean tutorial here that describes how to set up the environment. My supervisor conf is the following:
[program:tomahawk]
environment=TOMAHAWK_DB=$TOMAHAWK_DB
command=/usr/lib/jvm/java-1.7.0-openjdk-amd64/bin/java -jar tomahawk.jar
logfile=/tmp/supervisord.log
directory=/var/www/tomahawk/app
user=www-data
autostart=true
autorestart=true
startretries=3
redirect_stderr=true
stdout_logfile=/var/www/logs/tomahawk.app.log
However, when using this through nginx, i get the error
2016-03-19 23:34:08.594:WARN:oejs.AbstractHttpConnection:/
java.sql.SQLException: No suitable driver found for jdbc:sqlserver:$
at java.sql.DriverManager.getConnection(DriverManager.java:596)
at java.sql.DriverManager.getConnection(DriverManager.java:187)
at clojure.java.jdbc$get_connection.invoke(jdbc.clj:255)
This comes from the com.microsoft.sqldbc4.jar file. However, I can run this standalone jar file, as well as I can run sudo -u www-data env TOMAHAWK_DB=$TOMAHAWK_DB java -jar tomahawk.jar just fine. Also, while this is running, I can hit it through the nginx reverse proxy.
I've searched around and found an unanswered email on the supervisor mailing list from 2011. Why can I only sometimes see the missing jar file?
I've tried putting it inside of the /usr/lib/jvm/.../lib/ext location for my jvm, bundled inside of the jar file, running from Tomcat, etc. I've made an upstart script as well with identical results as well. I am not sure what other paths I can try and was wondering if anyone had any insights.

Categories

Resources