LinuxQuestions.org
Share your knowledge at the LQ Wiki.
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie
User Name
Password
Linux - Newbie This Linux forum is for members that are new to Linux.
Just starting out and have a question? If it is not in the man pages or the how-to's this is the place!

Notices


Reply
  Search this Thread
Old 05-19-2011, 01:33 AM   #1
ankit.pandey3
LQ Newbie
 
Registered: May 2011
Posts: 27

Rep: Reputation: Disabled
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.................
 
Old 05-19-2011, 01:38 AM   #2
Nylex
LQ Addict
 
Registered: Jul 2003
Location: London, UK
Distribution: Slackware
Posts: 7,464

Rep: Reputation: Disabled
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.
 
Old 05-19-2011, 01:56 AM   #3
ankit.pandey3
LQ Newbie
 
Registered: May 2011
Posts: 27

Original Poster
Rep: Reputation: Disabled
Quote:
Originally Posted by Nylex View Post
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......
 
Old 05-19-2011, 02:09 AM   #4
EricTRA
LQ Guru
 
Registered: May 2009
Location: Gibraltar, Gibraltar
Distribution: Fedora 20 with Awesome WM
Posts: 6,805
Blog Entries: 1

Rep: Reputation: 1295Reputation: 1295Reputation: 1295Reputation: 1295Reputation: 1295Reputation: 1295Reputation: 1295Reputation: 1295Reputation: 1295
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
 
Old 05-19-2011, 02:24 AM   #5
ankit.pandey3
LQ Newbie
 
Registered: May 2011
Posts: 27

Original Poster
Rep: Reputation: Disabled
Quote:
Originally Posted by EricTRA View Post
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....
 
Old 05-19-2011, 02:31 AM   #6
Nylex
LQ Addict
 
Registered: Jul 2003
Location: London, UK
Distribution: Slackware
Posts: 7,464

Rep: Reputation: Disabled
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).

Last edited by Nylex; 05-19-2011 at 02:32 AM.
 
Old 05-19-2011, 02:34 AM   #7
Wim Sturkenboom
Senior Member
 
Registered: Jan 2005
Location: Roodepoort, South Africa
Distribution: Slackware 10.1/10.2/12, Ubuntu 12.04, Crunchbang Statler
Posts: 3,786

Rep: Reputation: 282Reputation: 282Reputation: 282
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.
 
Old 05-19-2011, 05:13 AM   #8
ankit.pandey3
LQ Newbie
 
Registered: May 2011
Posts: 27

Original Poster
Rep: Reputation: Disabled
Frds I checked it. Jre is installed in linux server already.
Now what I should do??
Any other idea????
Plzzzz help
 
Old 05-19-2011, 05:19 AM   #9
Nylex
LQ Addict
 
Registered: Jul 2003
Location: London, UK
Distribution: Slackware
Posts: 7,464

Rep: Reputation: Disabled
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.
 
Old 05-19-2011, 05:30 AM   #10
ankit.pandey3
LQ Newbie
 
Registered: May 2011
Posts: 27

Original Poster
Rep: Reputation: Disabled
what is X Running???
Please explain it and I also tried these links but no results.....
Sorry friends but any other solution??/
 
Old 05-19-2011, 05:43 AM   #11
Wim Sturkenboom
Senior Member
 
Registered: Jan 2005
Location: Roodepoort, South Africa
Distribution: Slackware 10.1/10.2/12, Ubuntu 12.04, Crunchbang Statler
Posts: 3,786

Rep: Reputation: 282Reputation: 282Reputation: 282
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.
 
Old 05-19-2011, 05:43 AM   #12
EricTRA
LQ Guru
 
Registered: May 2009
Location: Gibraltar, Gibraltar
Distribution: Fedora 20 with Awesome WM
Posts: 6,805
Blog Entries: 1

Rep: Reputation: 1295Reputation: 1295Reputation: 1295Reputation: 1295Reputation: 1295Reputation: 1295Reputation: 1295Reputation: 1295Reputation: 1295
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
 
Old 05-19-2011, 05:50 AM   #13
ankit.pandey3
LQ Newbie
 
Registered: May 2011
Posts: 27

Original Poster
Rep: Reputation: Disabled
Quote:
Originally Posted by EricTRA View Post
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......
 
Old 05-19-2011, 06:12 AM   #14
Fracker
Member
 
Registered: Mar 2009
Posts: 86

Rep: Reputation: 0
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
 
Old 05-20-2011, 12:30 AM   #15
ankit.pandey3
LQ Newbie
 
Registered: May 2011
Posts: 27

Original Poster
Rep: Reputation: Disabled
Quote:
Originally Posted by Fracker View Post
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
 
  


Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
How to write a daemon Linux service to a Java application which execute a .jar haseit Linux - Newbie 2 10-14-2011 04:10 AM
Jar files in linux kapilbajpai88 Linux - Newbie 4 11-05-2009 11:39 AM
Want to take a Backup as jar and upload jar to other server LearnUnix Linux - Newbie 4 10-30-2009 05:48 AM
how do i execute a jar (java application) in linux amolgupta Linux - Software 2 07-20-2006 06:55 AM
Fedora Core 1 Associating .jar files with java -jar command pymehta Fedora 0 01-13-2005 06:26 AM


All times are GMT -5. The time now is 02:07 AM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration