If you come across with this error:
Error building Player: Win32Exception: ApplicationName='C:\Program Files (x86)\Java\jre7\bin\javac.exe',
then you only have Java JRE which does not come with javac.exe. You must install JAVA JDK from java website . Also be sure to read about PATH Environment Variable (Optional) on java documentation page.
You need JAVA JDK ! Not JRE !
here is the way to set environment table for java path:
C:\> "C:\Program Files\Java\jdk1.7.0\bin\javac" MyClass.javaIt is useful to set thePATH
variable permanently so it will persist after rebooting.To set thePATH
variable permanently, add the full path of thejdk1.7.0\bin
directory to thePATH
variable. Typically, this full path looks something likeC:\Program Files\Java\jdk1.7.0\bin
. Set thePATH
variable as follows on Microsoft Windows:
Click Start, then Control Panel, then System. Click Advanced, then Environment Variables. Add the location of thebin
folder of the JDK installation for thePATH
variable in System Variables. The following is a typical value for thePATH
variable:C:\WINDOWS\system32;C:\WINDOWS;C:\Program Files\Java\jdk1.7.0\binNote:
- The PATH environment variable is a series of directories separated by semicolons (
;
) and is not case-sensitive. Microsoft Windows looks for programs in thePATH
directories in order, from left to right.- You should only have one bin directory for a JDK in the path at a time. Those following the first instance are ignored.
- If you are not sure where to add the path, add it to the right of the value of the
PATH
variable.- The new path takes effect in each new command window you open after setting the
PATH
variable.
also you may have to set JAVA_HOME to the directory on your machine that does have JDK (and javac.exe) installed.
here is a step by step how to change JAVA_HOME directory:
Set the JAVA_HOME Variable
Once you have the JDK installation path:
- Right-click the My Computer icon on
- your desktop and select Properties.
- Click the Advanced tab. Click the
- Environment Variables button. Under System Variables, click New.
- Enter the variable name as JAVA_HOME.
- Enter the variable value as the installation path for the Java Development Kit.
- Click OK.
- Click Apply Changes.
You might need to restart windows.
NOTE: You have to put the path to the jdk without /bin in the end.
For example: C:\Java\jdk1.6.0_44 , NOT C:\Java\jdk1.6.0_44\bin.
You have to restart Unity3D so that unity can read the new java home path. After this you can build your unity3d game with facebook sdk without any problems.
Btw, if you need openssl for windows to create keystore for facebook sdk for unity3d, you must first download openssl and extrac its bin folder content to C:\Program Files\Java\jdk1.8.0\bin (or whereever you java install dir is) then add C:\Program Files\Java\jdk1.8.0\bin to enviroment path.
and to create keystore:
keytool -exportcert -alias androiddebugkey -keystore %HOMEPATH%\.android\debug.keystore | penssl.exe sha1 -binary | openssl.exe base64
and the SECOND common problem is this error:
... your android debug keystore file is missing ...
This second problem is EASY to fix.
This happens when your your Unity project is on another drive than C: drive. Anyway this is not a problem. You need to fix a c# script in facebook directory in your unity project panel. Locate Facebook>Android>FacebookAndroidUtil cd file. Open file. Find this row:
System.Environment.GetEnvironmentVariable("HOMEPATH") + @"\.android\debug.keystore" :
and change it with this one:
System.Environment.GetEnvironmentVariable("HOMEDRIVE") + System.Environment.GetEnvironmentVariable("HOMEPATH") + @"\.android\debug.keystore" :
save the file. and restart unity3d. you will see that your problems will go away :)
Thank you!!!!!!! This post solved my issue! :D :D!!
ReplyDeleteTy, well played!
ReplyDelete