The most intelligent Java IDE
[Logo] JavaRanch » JavaRanch Saloon
  Search | FAQ | Recent Topics | Hot Topics
Register / Login


Reply Bookmark it! Watch this topic JavaRanch » Forums » Engineering » Ant, Maven and Other Build Tools
 
RSS feed
 
New topic
Author

signjar with ant from eclipse - BUILD FAILED: java.io.IOException

David Lambert
Greenhorn

Joined: Mar 24, 2003
Messages: 4

Hello,
I' m having a problem signing a jar with ant.
While the target works if run from the command line, when I run it from eclipse I get the following error:
[signjar] BUILD FAILED: file:C:/MyPath/build.xml:358: Execute failed: java.io.IOException: CreateProcess: jarsigner -keystore C:\storepath -storepass mypassword -keypass mykeypass -signedjar C:\signedjar.jar C:\myjar.jar myalias error=2
This is what I have in build.xml:
<signjar alias="myalias" jar="${app.name}.jar" keypass="mykeypass" keystore="${build.home}/storepath" signedjar="${build.home}/sgn${app.name}.jar" storepass="mypassword"/>
The paths and variables look fine (it works from command line...) so I don' t really know what' s wrong...
Thanks for any help!
Greg Charles
Ranch Hand

Joined: Oct 01, 2001
Messages: 901

It seems to me that Ant can't find the jarsigner executable. I'd guess that means the JAVA_HOME/bin is not in the path, but you say it works from the command line. Maybe Eclipse adjusts the path to make sure a particular JDK is being used?
Greg Charles
Ranch Hand

Joined: Oct 01, 2001
Messages: 901

I really don't think it's a classpath problem, but rather your regular path, that thing that tells the system where to look for executables. I don't know why Eclipse would use a different one from the command line though. Just for fun, try copying the jarsigner.exe from JAVA_HOME/bin to another directory in your path, e.g., c:/winnt/system32 If that works, you know Eclipse is definitely messing with your path.
David Lambert
Greenhorn

Joined: Mar 24, 2003
Messages: 4

Hi Greg, thanks a lot for your time!
You are absolutely right. After checking the 'Path' variable, it turns out I didn' t have
'%JAVA_HOME%\bin' in it.
Everything works fine now.
Still don' t understand why I could use the command line to run signjar or ant tasks though...trying to find that out now.
Thanks a lot again. That was great help!
David Lambert
Greenhorn

Joined: Mar 24, 2003
Messages: 4

My previous message got deleted by mistake while I was trying to edit it earlier...so I post it again just in case there is someone else with the same problem...
>Hi Greg, thanks for your reply.
>
>In my environments variables I have:
>JAVA_HOME = C:\j2sdk1.4.1_01
>ANT_HOME = C:\ant-1.5
>
>In Eclipse Window > Preferences > Ant > >Runtime
>ANT_HOME = C:\ant-1.5
>(which sets my runtime classpath to:
> C:\ant-1.5\lib\ant.jar
> C:\ant-1.5\lib\catalina-ant.jar
> C:\ant-1.5\lib\optional.jar
> C:\ant-1.5\lib\xml-apis.jar
> To this I' ve added:
> C:\j2sdk1.4.1_01\lib\tools.jar
> I' ve tried adding
> C:\j2sdk1.4.1_01\bin
> but no luck...
>
>
>In Eclipse Window > Preferences > Java >> Installed JREs:
>C:\j2sdk1.4.1_01
>
>I really cannot see what is wron
>
Kunal Changela
Greenhorn

Joined: Sep 16, 2004
Messages: 1

I had exactly the same problem with the jarsigner.exe

I have fixed the problem but you will be very surprised as to how I have done so. ALL I did was:

1) remove all the installed JREs from the Window -> Preferences -> Java -> Installed JREs

2) add a JRE with the path to my root J2SDK folder (JRE home directory: C:\j2sdk1.4.2_05) with the (JRE name: j2re1.4.2_05).

3) i had NO environment variables, system variable set to point to any Java bins, libraries etc.

4) there was also no need to add tools.jar to my ANT runtime classpath entries.

My jar signing, compiling and building ALL works.

Hope this is useful.
[ September 16, 2004: Message edited by: Kunal Changela ]

Kunal D Changela
vishu. gautam
Greenhorn

Joined: Dec 18, 2004
Messages: 1

I was getting the same problem as listed above and fixed it as mentioned in the replies. Now I have a another problem.

The jarsigner tasks works well sometimes. At other times it fails with error message suggesting that it failed to rename the original ...jar file to same ...jar.os.. file.
However, When I run the ant script again it works fine, successfully signing the jars.

So this is kind of a error which occurs intermittently.

Any pointers anyone?
 
 
 
Reply Bookmark it! Watch this topic JavaRanch » Forums » Engineering » Ant, Maven and Other Build Tools
 
RSS feed
 
New topic
hibernate profiler