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 09-09-2011, 03:25 AM   #1
brownie_cookie
Member
 
Registered: Mar 2011
Location: Belgium
Distribution: CentOS release 5.5 (Final), Red Hat Enterprise Linux ES release 4 (Nahant Update 8)
Posts: 416
Blog Entries: 2

Rep: Reputation: 12
Ubuntu 11.04 jar command


Hi all

I'm not new here, but Ubuntu is new to me so here i am..
I'm trying to execute the JAR command to update a jar file.

Code:
jar uf $loc/bin/jar/jinnyintegrator.jar $loc/bin/jar/config.properties
When i execute this script i get the message that jar isn't found.
Even when I do
Code:
which java
i get things i shouldn't get
so i know that java (or jar?) isn't installed appearently (something like openjdk is installed, but i don't know if that matters..?)
So can someone give me the right commands for succesfully install Java (or jar) on Ubuntu 11.04?
It's highly appreciated!

Brownie
 
Old 09-09-2011, 04:19 AM   #2
brownie_cookie
Member
 
Registered: Mar 2011
Location: Belgium
Distribution: CentOS release 5.5 (Final), Red Hat Enterprise Linux ES release 4 (Nahant Update 8)
Posts: 416
Blog Entries: 2

Original Poster
Rep: Reputation: 12
okay, i've found it, normally jar should work (which jar works so...)
but i want to update a jar file, but it isn't working..

this is what i do:
Code:
touch $loc/bin/jar/config.properties
	chmod 755 $loc/bin/jar/config.properties
	echo "# the time properties are expressed in minutes!" >> $loc/bin/jar/config.properties
	echo "filters.enabled=true" >> $loc/bin/jar/config.properties
	echo "filters.max_time=$Max_time" >> $loc/bin/jar/config.properties
	echo "filters.max_programs=$Max_progs" >> $loc/bin/jar/config.properties
	echo "filters.min_percentage=$Min_per" >> $loc/bin/jar/config.properties
	echo "filters.min_time=$Min_time" >> $loc/bin/jar/config.properties
	echo "" >> $loc/bin/jar/config.properties
	echo "# add the time viewed to a specific channel" >> $loc/bin/jar/config.properties
	echo "viewingrecordcorrelation.enabled=true" >> $loc/bin/jar/config.properties
	echo "tekst toegevoegd"
	
	# Zip the application
	echo "alles zippen"
	jar uf $loc/bin/jar/jinnyintegrator.jar $loc/bin/jar/config.properties
am i doing something wrong ??


Thanks for the help

Brownie
 
Old 09-09-2011, 04:24 AM   #3
jdkaye
LQ Guru
 
Registered: Dec 2008
Location: Westgate-on-Sea, Kent, UK
Distribution: Debian Testing Amd64
Posts: 5,464

Rep: Reputation: Disabled
In my jre I need to use
Code:
java -jar <jar file>
for running a jar file. Have you tried that?
ciao,
jdk
 
Old 09-09-2011, 05:14 AM   #4
brownie_cookie
Member
 
Registered: Mar 2011
Location: Belgium
Distribution: CentOS release 5.5 (Final), Red Hat Enterprise Linux ES release 4 (Nahant Update 8)
Posts: 416
Blog Entries: 2

Original Poster
Rep: Reputation: 12
yeah, i know how to execute a jar file, but i want to update my jar file

Man pages:
Code:
Update jar file
          jar u[v0Mmfe] [manifest] [jarfile] [entrypoint] [-C dir] inputfiles [-Joption]
So i do:
Code:
jar uf $loc/bin/jar/jinnyintegrator.jar $loc/bin/jar/config.properties
but the file he must update, doesn't update
 
Old 09-09-2011, 05:40 AM   #5
knudfl
LQ 5k Club
 
Registered: Jan 2008
Location: Copenhagen, DK
Distribution: pclos2016, Slack14.1 Deb Jessie, + 50+ other Linux OS, for test only.
Posts: 16,276

Rep: Reputation: 3154Reputation: 3154Reputation: 3154Reputation: 3154Reputation: 3154Reputation: 3154Reputation: 3154Reputation: 3154Reputation: 3154Reputation: 3154Reputation: 3154
Installing "sun-java6-jdk" on Ubuntu 11.04 :

http://ubuntuguide.net/install-sun-j...n-ubuntu-11-04
 
Old 09-09-2011, 05:45 AM   #6
jdkaye
LQ Guru
 
Registered: Dec 2008
Location: Westgate-on-Sea, Kent, UK
Distribution: Debian Testing Amd64
Posts: 5,464

Rep: Reputation: Disabled
Sorry, now I get it.
Code:
jdkaye@AttilaII:~$ which jar
/usr/bin/jar
As you said, it looks like your java is not installed correctly.
I don't see any debian package that has /usr/bin/jar. Maybe you should download the jdk from Oracle *vomit noises*.
http://www.oracle.com/technetwork/ja...ads/index.html
ciao,
jdk

Last edited by jdkaye; 09-09-2011 at 09:11 AM.
 
Old 09-09-2011, 06:25 AM   #7
knudfl
LQ 5k Club
 
Registered: Jan 2008
Location: Copenhagen, DK
Distribution: pclos2016, Slack14.1 Deb Jessie, + 50+ other Linux OS, for test only.
Posts: 16,276

Rep: Reputation: 3154Reputation: 3154Reputation: 3154Reputation: 3154Reputation: 3154Reputation: 3154Reputation: 3154Reputation: 3154Reputation: 3154Reputation: 3154Reputation: 3154
# 6
Quote:
I don't see any debian package that has /usr/bin/jar.
which jar
/usr/bin/jar

ls -l /usr/bin/jar
lrwxrwxrwx 1 root root 21 16 aug 2009 /usr/bin/jar -> /etc/alternatives/jar

ls -l /etc/alternatives/jar
lrwxrwxrwx 1 root root 33 13 dec 2009 /etc/alternatives/jar -> /usr/lib/jvm/java-gcj/jre/bin/jar

But if the command 'java -jar' is used, it's not really a problem,
that "alternatives" use a link to the wrong java version ( java-gcj ) :

java -version
java version "1.6.0_22"
Java(TM) SE Runtime Environment (build 1.6.0_22-b04)
Java HotSpot(TM) Client VM (build 17.1-b03, mixed mode, sharing)
→ → → This is the sun-java6-jdk.

Code:
# update-alternatives --config java
-----------------------------------------------
          1    /usr/bin/gij-4.3
 +        2    /usr/lib/jvm/java-gcj/jre/bin/java
*         3    /usr/lib/jvm/java-6-sun/jre/bin/java
The above is from Debian Lenny.

To the OP : The Ubuntu package should be preferred. See post # 5.

.

Last edited by knudfl; 09-09-2011 at 06:31 AM.
 
Old 09-09-2011, 08:11 AM   #8
brownie_cookie
Member
 
Registered: Mar 2011
Location: Belgium
Distribution: CentOS release 5.5 (Final), Red Hat Enterprise Linux ES release 4 (Nahant Update 8)
Posts: 416
Blog Entries: 2

Original Poster
Rep: Reputation: 12
okay, first of all, thank you all for the replies !!

I tried the website provided in post # 5
The first few steps worked:
Code:
sudo add-apt-repository ppa:ferramroberto/java
sudo apt-get update
but then to install java, it failed:
Code:
# sudo apt-get install sun-java6-jre sun-java6-jre-plugin
Pakketlijsten worden ingelezen... DONE
Boom van vereisten wordt opgebouwd       
De status informatie wordt gelezen... DONE
E: Kan pakket sun-java6-jre-plugin niet vinden
i know it is in dutch, but in the last (see bold) it says it cannot find the plugin
any ideas?
 
Old 09-09-2011, 08:23 AM   #9
brownie_cookie
Member
 
Registered: Mar 2011
Location: Belgium
Distribution: CentOS release 5.5 (Final), Red Hat Enterprise Linux ES release 4 (Nahant Update 8)
Posts: 416
Blog Entries: 2

Original Poster
Rep: Reputation: 12
maybe some nice things to know...

Code:
#which jar
/usr/bin/jar

#which java
/usr/bin/java

# java version
Exception in thread "main" java.lang.NoClassDefFoundError: version
Caused by: java.lang.ClassNotFoundException: version
	at java.net.URLClassLoader$1.run(URLClassLoader.java:217)
	at java.security.AccessController.doPrivileged(Native Method)
	at java.net.URLClassLoader.findClass(URLClassLoader.java:205)
	at java.lang.ClassLoader.loadClass(ClassLoader.java:321)
	at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:294)
	at java.lang.ClassLoader.loadClass(ClassLoader.java:266)
Could not find the main class: version. Program will exit.
Also the website of post 5, i did all the commands seperatly and i did not install the plugin because that one gave an error, but the rest is installed.
Can someone explain why i can locate the place where java is installed but when i try to execute it (version) that it fails?

thanks
 
Old 09-09-2011, 08:32 AM   #10
knudfl
LQ 5k Club
 
Registered: Jan 2008
Location: Copenhagen, DK
Distribution: pclos2016, Slack14.1 Deb Jessie, + 50+ other Linux OS, for test only.
Posts: 16,276

Rep: Reputation: 3154Reputation: 3154Reputation: 3154Reputation: 3154Reputation: 3154Reputation: 3154Reputation: 3154Reputation: 3154Reputation: 3154Reputation: 3154Reputation: 3154
There is no command : java version

The command is : java -version
( You forgot the hyphen ( - ).

And : Those command should not be run as root.
Root is for administrative tasks only.
Running as root is the fastest way to trash your OS.
+ Makes things unsafe for everybody on the internet, if you are connected.

.
 
1 members found this post helpful.
Old 09-09-2011, 09:15 AM   #11
jdkaye
LQ Guru
 
Registered: Dec 2008
Location: Westgate-on-Sea, Kent, UK
Distribution: Debian Testing Amd64
Posts: 5,464

Rep: Reputation: Disabled
Just do be sure, does this mean you've sorted out your problem?
ciao,
jdk

Last edited by jdkaye; 09-09-2011 at 09:18 AM.
 
Old 09-09-2011, 10:06 AM   #12
brownie_cookie
Member
 
Registered: Mar 2011
Location: Belgium
Distribution: CentOS release 5.5 (Final), Red Hat Enterprise Linux ES release 4 (Nahant Update 8)
Posts: 416
Blog Entries: 2

Original Poster
Rep: Reputation: 12
Quote:
Originally Posted by knudfl View Post
There is no command : java version

The command is : java -version
( You forgot the hyphen ( - ).

And : Those command should not be run as root.
Root is for administrative tasks only.
Running as root is the fastest way to trash your OS.
+ Makes things unsafe for everybody on the internet, if you are connected.

.
damn, true, forgot it!! sorry guys
Code:
# java -version
java version "1.6.0_22"
OpenJDK Runtime Environment (IcedTea6 1.10.2) (6b22-1.10.2-0ubuntu1~11.04.1)
OpenJDK Client VM (build 20.0-b11, mixed mode, sharing)
and i see your point of the root problem, but i don't put anything online, it's just for testing and i'm working in a virtual environment so if any goes wrong -> reinstall -> done (but still i know it's probably not the best way to do it, but that is not the issue)

but let's recap
the issue of java is solved, but the problem with the jar command isn't..
So i want to update a jarfile with a file i create.
I create and update the jarfile in the same script, is that the problem?

Thanks in advance guys
 
  


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
why is jar command not found? s0450776 Programming 11 09-08-2012 10:41 AM
How to set mail.jar(JavaMail) and mysql-connector-java.jar in Linux class path Terry56 Linux - Software 3 01-19-2010 10:06 AM
I got error with this command 'java -jar NodeView-v1.1.jar' mohdismiaswaly Linux - Software 3 04-23-2009 07:24 AM
Fedora Core 1 Associating .jar files with java -jar command pymehta Fedora 0 01-13-2005 06:26 AM
Mandrake and the command java -jar silent1_22 Linux - Distributions 3 11-23-2002 07:25 AM


All times are GMT -5. The time now is 10:05 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