wp.jochen.hayek.name/blog-en

using Microsoft Visual Studio’s C++ compiler commandline-wise — vcvarsall.bat

nice example illustrating how to properly qualify absolutely wherever possible (i.e. avoiding getting things found through PATH et al.!):

SET PF=C:Program Files
SET PFx86=C:Program Files (x86)
SET VSINSTALLDIR=%PFx86%Microsoft Visual Studio 10.0
SET VCINSTALLDIR=%VSINSTALLDIR%VC
:: Add compiler tools folder to the PATH variable.
:: Do not run this too many times
:: or %Path% will exceed the maximum limit.
call "%VCINSTALLDIR%vcvarsall.bat"
:: Microsoft Windows SDK for Windows 7 and .NET Framework 4 
:: (gets set by vcvarsall.bat)
::::SET WindowsSdkDir=...Microsoft SDKsWindows...

SET JAVA_HOME=%PF%Javajdk1.8.0_60
path %Path%;%JAVA_HOME%bin
javac HelloWorld.java
javah HelloWorld
:: On Windows, the JNI library should not have a "lib" prefix
%VC%bincl /I%JAVA_HOME%include /I%JAVA_HOME%includewin32 /I%VC%include /I%VC%lib /I%MSDK%Lib libHelloWorld.c /FeHelloWorld.dll /LD
java HelloWorld

The wikipedia article got the batch file quoting wrong — of course I couldn’t help and I corrected that.

Exit mobile version