LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - Newbie (https://www.linuxquestions.org/questions/linux-newbie-8/)
-   -   How to execute .jar files in ubuntu linux server (https://www.linuxquestions.org/questions/linux-newbie-8/how-to-execute-jar-files-in-ubuntu-linux-server-881536/)

ankit.pandey3 05-19-2011 12:33 AM

How to execute .jar files in ubuntu linux server
 
Hi friends...........
I have a .jar file named "server.jar". In windows it executes on simply double click on it but I want to execute it on the server and I don't know how to do it???
I have Filezilla to upload any file on server and putty for cmd prompt.
Plz let me know where i have to upload my file on server and hoto execute it.....
It's urgent plzzzzz make it fast.......
Thanks in advance.................

Nylex 05-19-2011 12:38 AM

Assuming you have the Java Runtime Environment installed, you should just be able to do "java -jar filename". You may need to run this as root (i.e. put "sudo" in front).

Also, please don't say your threads are urgent. This is a volunteer site, so nothing is urgent for anyone here.

ankit.pandey3 05-19-2011 12:56 AM

Quote:

Originally Posted by Nylex (Post 4360590)
Assuming you have the Java Runtime Environment installed, you should just be able to do "java -jar filename". You may need to run this as root (i.e. put "sudo" in front).

Also, please don't say your threads are urgent. This is a volunteer site, so nothing is urgent for anyone here.

Sorry for my words frd..
I upload my jar file in root folder and then i run command
"root@li226-128:~#sudo java -jar server.jar" and "root@li226-128:~#java -jar server.jar" but I got following error msg.

"Exception in thread "main" java.awt.HeadlessException:
No X11 DISPLAY variable was set, but this program performed an operation which requires it.
at java.awt.GraphicsEnvironment.checkHeadless(GraphicsEnvironment.java:173)
at java.awt.Window.<init>(Window.java:437)
at java.awt.Frame.<init>(Frame.java:419)
at javax.swing.JFrame.<init>(JFrame.java:218)
at Server.InfiniteChatServer.<init>(InfiniteChatServer.java:42)
at Server.InfiniteChatServer.main(InfiniteChatServer.java:283)"
Can you plz tell me where is problem.....???
Plz help me......

EricTRA 05-19-2011 01:09 AM

Hello,

This messages:
Code:

No X11 DISPLAY variable was set, but this program performed an operation which requires it
tells you that your application is looking for a variable that hasn't been set. Does your server have graphical environment installed?
Also spell out your words please, and don't double post (already reported by Nylex) since that will only pull attention away from your question.

Kind regards,

Eric

ankit.pandey3 05-19-2011 01:24 AM

Quote:

Originally Posted by EricTRA (Post 4360603)
Hello,

This messages:
Code:

No X11 DISPLAY variable was set, but this program performed an operation which requires it
tells you that your application is looking for a variable that hasn't been set. Does your server have graphical environment installed?
Also spell out your words please, and don't double post (already reported by Nylex) since that will only pull attention away from your question.

Kind regards,

Eric

Sorrry for double post.
Frd how I can check whether it is installed or not, if it is not installed then how I can install it???
Plz explain it properly....
Thanks in advance....

Nylex 05-19-2011 01:31 AM

It's probably a good idea for you to read the documentation for your distribution.

Also, if you have to run graphical programs on a remote machine, it might be worth you looking into NX (see, e.g. this).

Wim Sturkenboom 05-19-2011 01:34 AM

A bit of googling can get you a long way. But I understand that one has to know what to search for.

ubuntu server install gui

First hits: Install GUI in Ubuntu Server and How to install GUI in Ubuntu 10.04 (Lucid Lynx) Server.

ankit.pandey3 05-19-2011 04:13 AM

Frds I checked it. Jre is installed in linux server already.
Now what I should do??
Any other idea????
Plzzzz help

Nylex 05-19-2011 04:19 AM

Again, please spell out your words.

Obviously the JRE is installed, given you can run "java". The problem is that you need X running, as Eric pointed out. Please see the links given in posts 6 and 7.

ankit.pandey3 05-19-2011 04:30 AM

what is X Running???
Please explain it and I also tried these links but no results.....
Sorry friends but any other solution??/

Wim Sturkenboom 05-19-2011 04:43 AM

You need the graphical environment to be installed (I guess you have done that but not sure which one) and running. If I'm not mistaken, you have to start your application from within the graphical environment as well, but not 100% sure.

Search how to start X; this might depend on the version of Ubuntu (not sure). A link I found: http://nixcraft.com/linux-software/4...ntu-linux.html

And read the documentation.

EricTRA 05-19-2011 04:43 AM

Hello,

As already pointed out by various LQ users, you need X installed. X is a graphical server on top of which a desktop environment and/or window manager can be installed so that you are not 'limited' to the console. Apparently your application needs X, or a part of it to function properly. So Wim Sturkenboom pointed you to an easy to follow step by step guide in post #7. Follow that guide to install X and try running your application again.

If an LQ user points you to a website you might want to take the time to read it since it could be of great help to you. If you don't understand what's explained in the website then tell us so and we'll try to clarify.

Kind regards,

Eric

ankit.pandey3 05-19-2011 04:50 AM

Quote:

Originally Posted by EricTRA (Post 4360717)
Hello,

As already pointed out by various LQ users, you need X installed. X is a graphical server on top of which a desktop environment and/or window manager can be installed so that you are not 'limited' to the console. Apparently your application needs X, or a part of it to function properly. So Wim Sturkenboom pointed you to an easy to follow step by step guide in post #7. Follow that guide to install X and try running your application again.

If an LQ user points you to a website you might want to take the time to read it since it could be of great help to you. If you don't understand what's explained in the website then tell us so and we'll try to clarify.

Kind regards,

Eric

As http://www.ubuntugeek.com/ubuntu-ser...bex-guide.html
links tells I installed GNOME desktop. Now what I have to do guide me please......

Fracker 05-19-2011 05:12 AM

1. Install Xmanager
2. Open Xmanager (passive)
3. run command on the server "export DISPLAY=you.r.ip.add:0.0:
4. java -jar jarfile.jar

ankit.pandey3 05-19-2011 11:30 PM

Quote:

Originally Posted by Fracker (Post 4360735)
1. Install Xmanager
2. Open Xmanager (passive)
3. run command on the server "export DISPLAY=you.r.ip.add:0.0:
4. java -jar jarfile.jar

Thanks for your support but can you please tell me where I found Xmanager setup and how to install it...
Please explain step by step so i do it properly.
Thanks in advance


All times are GMT -5. The time now is 09:27 PM.