File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
The moose likes Beginning Java and the fly likes Jarsigner Error Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » Beginning Java
Bookmark "Jarsigner Error" Watch "Jarsigner Error" New topic
Author

Jarsigner Error

H Houly
Greenhorn

Joined: Aug 19, 2011
Posts: 5
Hi All

i am no programmer, i am a mere systems admin and iam new to JAVA so bear with me

I have been trying to solve this problem all day yesterday but with no luck , so your help is greatly appreciated

the JAVA APPLET certificate is due to expire on our webserver, we bought the certificate and applied it fine until the last step in which we need to sign the JAR file with the new certificate using the Jarsigner

when typing the following command

$sudo jarsigner jarfile keystore Alias

i get the following error

Error: could not find libjava.so
Error: could not find Java 2 Runtime Environment.

for some reason the jarsigner can not find the the JRE, or that is what i think. However, i am not sure how to solve this problem i tried setting up the environment but with no luck, can you pelase help

below are my system info:

REDHAT 5.5
Linux 2.6.18-274.el5 #1 SMP Fri Jul 8 17:36:59 EDT 2011 x86_64 x86_64 x86_64 GNU/Linux

java version "1.4.0_02"
Java(TM) 2 Runtime Environment, Standard Edition (build 1.4.0_02-b02)
Java HotSpot(TM) Client VM (build 1.4.0_02-b02, mixed mode)

$ which java
/usr/java/j2sdk1.4.0_02/bin/java

$ which javac
/usr/java/j2sdk1.4.0_02/bin/javac

The /home/<user>/.bash_profile file is as follows

# .bash_profile

# Get the aliases and functions
if [ -f ~/.bashrc ]; then
. ~/.bashrc
fi

# User specific environment and startup programs

PATH=$PATH:$HOME/bin:/usr/X11R6/bin:/usr/java/j2sdk1.4.0_02/bin

export PATH

Thanks


Ulf Dittmer
Marshal

Joined: Mar 22, 2005
Posts: 41854
    
  63
You should set the JAVA_HOME variable to point to the JRE or JDK. The correct value is probably /usr/java/j2sdk1.4.0_02.


Ping & DNS - my free Android networking tools app
H Houly
Greenhorn

Joined: Aug 19, 2011
Posts: 5
Ulf Dittmer wrote:You should set the JAVA_HOME variable to point to the JRE or JDK. The correct value is probably /usr/java/j2sdk1.4.0_02.


Hi Ulf

thank you for your reply

can you please advice on how todo that?

is thsi correct?

export JAVA_HOME=/usr/java/j2sdk1.4.0_02
Ulf Dittmer
Marshal

Joined: Mar 22, 2005
Posts: 41854
    
  63
Does it work? If not, try doing it analogous to PATH.
Darryl Burke
Bartender

Joined: May 03, 2008
Posts: 4543
    
    5

H Houly, please BeForthrightWhenCrossPostingToOtherSites

http://www.java-forums.org/java-applets/47799-jarsiner-error-error-could-not-find-libjava-so.html


luck, db
There are no new questions, but there may be new answers.
H Houly
Greenhorn

Joined: Aug 19, 2011
Posts: 5


Am I supposed to mention that i have posted in other forums!!!??

when i find the solution i was going to post it in both posts

H Houly
Greenhorn

Joined: Aug 19, 2011
Posts: 5
Ulf Dittmer wrote:Does it work? If not, try doing it analogous to PATH.


Hi Ulf

i did: $export JAVA_HOME=/usr/java/j2sdk1.4.0_02

but did not work,

what do you mean by (try doing it analogous to PATH)

Thanks
Jesper de Jong
Java Cowboy
Saloon Keeper

Joined: Aug 16, 2005
Posts: 14150
    
  18

H Houly wrote:but did not work,

What do you mean by that? What exactly did you do; did you get an error message? What was the error message? (Note: You're not supposed to type the "$" in front of "export").


Java Beginners FAQ - JavaRanch SCJP FAQ - The Java Tutorial - Java SE 7 API documentation
Scala Notes - My blog about Scala
Ernest Friedman-Hill
author and iconoclast
Marshal

Joined: Jul 08, 2003
Posts: 24184
    
  34

You're running the jarsigner command as root using sudo, not running it as yourself; that means your environment is meaningless, and it's root's environment that matters. The jarsigner that you get on your path is not necessarily the one that root gets; nor is the sudo shell going to inherit things like JAVA_HOME from your environment. All of the environment info you've reported to us so far is pretty much meaningless because it's not in effect for the command you eventually run.

Try sudo which jarsigner, sudo java -version, and sudo printenv JAVA_HOME. That should give you an idea of what you're working with. If you still don't know what to do, tell us what those commands report and we'll try to help.

Alternatively, to make it work without knowing what was going wrong, just set JAVA_HOME in root's environment and force the right version of jarsigner:



[Jess in Action][AskingGoodQuestions]
Campbell Ritchie
Sheriff

Joined: Oct 13, 2005
Posts: 38840
    
  23
H Houly wrote: . . . Am I supposed to mention that i have posted in other forums!!!?? . . .
Yes. People on both fora need to know there might be a solution elsewhere.

And welcome to the Ranch

Try echo $PATH and export PATH=/usr/java.jdk1.4.2.0_02/bin:$PATH at a terminal, and see whether that helps. [Or "j2sdk" instead of "jdk", wherever your Java™ installation lives.]
Ernest Friedman-Hill
author and iconoclast
Marshal

Joined: Jul 08, 2003
Posts: 24184
    
  34

Campbell Ritchie wrote:
Try echo $PATH and export PATH=/usr/java.jdk1.4.2.0_02/bin:$PATH at a terminal, and see whether that helps.


Or don't; please see my answer above.
Campbell Ritchie
Sheriff

Joined: Oct 13, 2005
Posts: 38840
    
  23
Yes, I think we are trying different ways of doing the same thing.

I'll vanish before I confuse him any more.
H Houly
Greenhorn

Joined: Aug 19, 2011
Posts: 5
Hi Ernest

it worked perfectly

your help is greatly appreciated.

I shoudl have known better that the reason is me using the Sudo

Campbell, thank you for your help as well

i am a forum newbie , next time i will make sure to post the link if i post in a different forum

Thanks all
Campbell Ritchie
Sheriff

Joined: Oct 13, 2005
Posts: 38840
    
  23
Well done getting it to work
Darryl Burke
Bartender

Joined: May 03, 2008
Posts: 4543
    
    5

H Houly wrote:


Am I supposed to mention that i have posted in other forums!!!??

when i find the solution i was going to post it in both posts


H Houly wrote:Hi Ernest

it worked perfectly


Still waiting to see that solution appear on the other forum.
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Jarsigner Error