LinuxQuestions.org
Download your favorite Linux distribution at LQ ISO.
Home Forums Tutorials Articles Register
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 10-10-2012, 04:38 AM   #1
khinmyo
Member
 
Registered: Aug 2012
Posts: 37

Rep: Reputation: Disabled
How to install(use) NSG2(NS2 Scenarios Generator 2) in ubuntu 10.0.4


Hello All,

I want to use NSG2 in Ubuntu.
But I'm unable to use it!!
I already install java and download NSG2 from https://sites.google.com/site/pengjungwu/nsg!!!
But I encounter the problem as follow!
So, How to solve this problem?
Please Help Me ,Sir!!!
kmw@ubuntu:~$ java -version
java version "1.6.0_24"
OpenJDK Runtime Environment (IcedTea6 1.11.4) (6b24-1.11.4-1ubuntu0.10.04.1)
OpenJDK Client VM (build 20.0-b12, mixed mode, sharing)
kmw@ubuntu:~$ java -jar NSG2.jar
Exception in thread "main" java.awt.HeadlessException
at java.awt.GraphicsEnvironment.checkHeadless(GraphicsEnvironment.java:173)
at java.awt.Window.<init>(Window.java:477)
at java.awt.Frame.<init>(Frame.java:419)
at javax.swing.JFrame.<init>(JFrame.java:218)
at nsg.NSG2.<init>(NSG2.java:51)
at nsg.NSG2.main(NSG2.java:253)
kmw@ubuntu:~$
 
Old 10-10-2012, 04:47 AM   #2
EODSteven
Member
 
Registered: Oct 2012
Location: Manchester, Tn
Distribution: Ubuntu 14.04, Windows 8, Windows Server 2012. Ubuntu Server 14.04
Posts: 196

Rep: Reputation: 3
Try running it in the headless mode....
Code:
-Djava.awt.headless=true
or using a headless JVM.
 
Old 10-10-2012, 06:12 AM   #3
khinmyo
Member
 
Registered: Aug 2012
Posts: 37

Original Poster
Rep: Reputation: Disabled
dear EODSteven,
Thank You so much for your helping!!!
But I don't know how to run it in the headless mode?
Please guide me in detail,sir!!!

Best regards,
khinmyo
 
Old 10-10-2012, 06:24 AM   #4
EODSteven
Member
 
Registered: Oct 2012
Location: Manchester, Tn
Distribution: Ubuntu 14.04, Windows 8, Windows Server 2012. Ubuntu Server 14.04
Posts: 196

Rep: Reputation: 3
How do you execute your program? I think we need to create a script file to add that variable into the java...let me know I have a simple script my grandson uses to play a game but I have to swith to linux to retreive it.
 
Old 10-10-2012, 06:49 AM   #5
EODSteven
Member
 
Registered: Oct 2012
Location: Manchester, Tn
Distribution: Ubuntu 14.04, Windows 8, Windows Server 2012. Ubuntu Server 14.04
Posts: 196

Rep: Reputation: 3
The answer was right in front of me....edit this command to go headless and it should fix it!

Code:
 kmw@ubuntu:~$ java -jar NSG2.jar
add the headless switch
Code:
 kmw@ubuntu:~$ java -Djava.awt.headless -jar NSG2.jar

Last edited by EODSteven; 10-10-2012 at 06:51 AM.
 
Old 10-10-2012, 06:54 AM   #6
knudfl
LQ 5k Club
 
Registered: Jan 2008
Location: Copenhagen DK
Distribution: PCLinuxOS2023 Fedora38 + 50+ other Linux OS, for test only.
Posts: 17,511

Rep: Reputation: 3641Reputation: 3641Reputation: 3641Reputation: 3641Reputation: 3641Reputation: 3641Reputation: 3641Reputation: 3641Reputation: 3641Reputation: 3641Reputation: 3641
java -jar NSG2.1.jar
... Runs OK with sun-java6-jdk : Starts as a very tiny GUI.

sudo apt-get install sun-java6-jdk
.
Attached Images
 
 
1 members found this post helpful.
Old 10-10-2012, 07:27 AM   #7
EODSteven
Member
 
Registered: Oct 2012
Location: Manchester, Tn
Distribution: Ubuntu 14.04, Windows 8, Windows Server 2012. Ubuntu Server 14.04
Posts: 196

Rep: Reputation: 3
Gonna have to upgrade to 7, I tried to download this and got this....
Attached Thumbnails
Click image for larger version

Name:	Screenshot from 2012-10-10 07:25:45.png
Views:	152
Size:	36.8 KB
ID:	10930  
 
Old 10-10-2012, 09:13 AM   #8
knudfl
LQ 5k Club
 
Registered: Jan 2008
Location: Copenhagen DK
Distribution: PCLinuxOS2023 Fedora38 + 50+ other Linux OS, for test only.
Posts: 17,511

Rep: Reputation: 3641Reputation: 3641Reputation: 3641Reputation: 3641Reputation: 3641Reputation: 3641Reputation: 3641Reputation: 3641Reputation: 3641Reputation: 3641Reputation: 3641
# 7


Synaptic > Settings > Repositories : Other Software
... and then mark "non-free".

Next : Refresh, and install 'sun-java6-jdk'.

( sudo apt-get update && sudo apt-get install sun-java6-jdk ).


.

Last edited by knudfl; 10-10-2012 at 09:14 AM.
 
Old 10-12-2012, 01:17 AM   #9
khinmyo
Member
 
Registered: Aug 2012
Posts: 37

Original Poster
Rep: Reputation: Disabled
Hello sir!
Thank you very much for your guide line!
But, still now , I'm not ok to run NSG2.
So,please help me ,sir!
I will never forget your kindness!

kmw@ubuntu:~$ java -version
java version "1.6.0_24"
OpenJDK Runtime Environment (IcedTea6 1.11.4) (6b24-1.11.4-1ubuntu0.10.04.1)
OpenJDK Client VM (build 20.0-b12, mixed mode, sharing)
kmw@ubuntu:~$ java -jar NSG2.1.jar
Exception in thread "main" java.awt.HeadlessException
at java.awt.GraphicsEnvironment.checkHeadless(GraphicsEnvironment.java:173)
at java.awt.Window.<init>(Window.java:477)
at java.awt.Frame.<init>(Frame.java:419)
at javax.swing.JFrame.<init>(JFrame.java:218)
at nsg.NSG2.<init>(NSG2.java:57)
at nsg.NSG2.main(NSG2.java:297)
kmw@ubuntu:~$ java -Djava.awt.headless -jar NSG2.1.jar
Exception in thread "main" java.lang.UnsatisfiedLinkError: Can't load library: /usr/lib/jvm/java-6-openjdk/jre/lib/i386/xawt/libmawt.so
at java.lang.ClassLoader.loadLibrary(ClassLoader.java:1649)
at java.lang.Runtime.load0(Runtime.java:787)
at java.lang.System.load(System.java:1022)
at java.lang.ClassLoader$NativeLibrary.load(Native Method)
at java.lang.ClassLoader.loadLibrary0(ClassLoader.java:1750)
at java.lang.ClassLoader.loadLibrary(ClassLoader.java:1667)
at java.lang.Runtime.loadLibrary0(Runtime.java:840)
at java.lang.System.loadLibrary(System.java:1047)
at sun.security.action.LoadLibraryAction.run(LoadLibraryAction.java:67)
at sun.security.action.LoadLibraryAction.run(LoadLibraryAction.java:47)
at java.security.AccessController.doPrivileged(Native Method)
at java.awt.Toolkit.loadLibraries(Toolkit.java:1614)
at java.awt.Toolkit.<clinit>(Toolkit.java:1636)
at java.awt.Component.<clinit>(Component.java:582)
Could not find the main class: nsg.NSG2. Program will exit.
kmw@ubuntu:~$
 
Old 10-12-2012, 02:44 AM   #10
knudfl
LQ 5k Club
 
Registered: Jan 2008
Location: Copenhagen DK
Distribution: PCLinuxOS2023 Fedora38 + 50+ other Linux OS, for test only.
Posts: 17,511

Rep: Reputation: 3641Reputation: 3641Reputation: 3641Reputation: 3641Reputation: 3641Reputation: 3641Reputation: 3641Reputation: 3641Reputation: 3641Reputation: 3641Reputation: 3641
Sorry, the sun-java packages were removed from 10.04 ealier this year ..
http://www.bytespring.com/blog/sun-j...04-repostitory

The easy way : Cheating an rpm package install ..
1) sudo apt-get install rpm
2) sudo rpm -Uvh --nodeps jdk-1.6.0_35-fcs.i586.rpm --force-debian
http://ftp.scientificlinux.org/linux...5-fcs.i586.rpm
3)
sudo update-alternatives --install /usr/bin/java java /usr/java/jdk1.6.0_33/bin/java 2
4)
sudo update-alternatives --config java
... And then choose the "/usr/java/jdk1.6.0_35/bin/java" entry.


Ubuntu 10.04 : java -jar NSG2.1.jar : Opens OK with "jdk1.6.0_35"
NSG2.1 https://sites.google.com/site/pengjungwu/nsg
EDIT : Both versions NSG2.jar, NSG2.1.jar work OK here with OpenJDK and the "sun jdk".

.

Last edited by knudfl; 10-12-2012 at 03:05 AM.
 
  


Reply



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 install ns2 in ubuntu 11.10 miu Linux - Networking 20 10-31-2013 02:50 PM
Unable to install ns2.34 on ubuntu 11.10 san_as Linux - Software 1 05-01-2012 10:25 AM
NS2- Traffic Generator Embedding in loop Madhu S H Linux - Software 0 02-29-2012 03:15 AM
How to install ns2 2.33 in ubuntu 10.04 andolby Linux - Software 1 03-21-2011 10:48 PM
NS2.34 won't install on ubuntu 9.10 insync Linux - Wireless Networking 1 02-25-2010 02:34 AM

LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie

All times are GMT -5. The time now is 06:50 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
Open Source Consulting | Domain Registration