I am trying to sign a jar file using an ANT script. I know this has to be pointed at the JDK directory for jarsigner.exe
to run, but when I echo java.home it returns the JRE directory.
This isn't a problem for javac, because I can set the executable path. But, that does not exist for signjar.
How do I change the java.home path? When I right-click on MyComputer and go to:
Properties > Advanced > Environment Variables
The "PATH" variable is correctly pointed to the JDK (C:\program files\java\jdk\bin
).
Update: The file now signs correctly after changing the PATH variable suggested below.
Configure the default JRE Set it as the default in Eclipse by selecting Preferences -> Java -> Installed JREs. Add the installed JDK and select the checkbox, making it the default.
To set JAVA_HOME, do the following: Right click My Computer and select Properties. On the Advanced tab, select Environment Variables, and then edit JAVA_HOME to point to where the JDK software is located, for example, C:\Program Files\Java\jdk1. 6.0_02.
Click on the Window tab in Eclipse, go to Preferences and when that window comes up, go to Java → Installed JREs → Execution Environment and choose JavaSE-1.5. You then have to go to Compiler and set the Compiler compliance level.
In Eclipse the Ant java.home variable is not based on the Windows JAVA_HOME environment variable. Instead it is set to the home directory of the project's JRE.
To change the default JRE (e.g. change it to a JDK) you can go to Windows->Preferences... and choose Java->Installed JREs.
To change just a single project's JRE you can go to Project->Properties and choose Java Build Path and choose the Libraries tab. Find the JRE System Library and click it, then choose Edit and choose the JRE (or JDK) that you want.
If that doesn't work then when running the build file you can choose Run as->Ant Build... and click the JRE tab, choose separate JRE and specify the JRE you want there.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With