aboutsummaryrefslogtreecommitdiffstats
path: root/find_java
diff options
context:
space:
mode:
Diffstat (limited to 'find_java')
-rw-r--r--find_java/.gitignore2
-rw-r--r--find_java/build.gradle16
-rwxr-xr-xfind_java/find_java.bat21
-rwxr-xr-xfind_java/find_java.sln30
-rwxr-xr-xfind_java/find_java_exe.vcproj205
-rw-r--r--find_java/find_java_exe.vcxproj174
-rw-r--r--find_java/find_java_exe.vcxproj.filters36
-rwxr-xr-xfind_java/find_java_lib.vcproj187
-rw-r--r--find_java/find_java_lib.vcxproj135
-rw-r--r--find_java/find_java_lib.vcxproj.filters33
-rwxr-xr-xfind_java/src/source/find_java.h19
-rw-r--r--find_java/src/source/find_java_exe.cpp158
-rwxr-xr-xfind_java/src/source/find_java_lib.cpp194
-rwxr-xr-xfind_java/src/source/utils.h30
14 files changed, 689 insertions, 551 deletions
diff --git a/find_java/.gitignore b/find_java/.gitignore
index 50843b4..d15bd0c 100644
--- a/find_java/.gitignore
+++ b/find_java/.gitignore
@@ -2,3 +2,5 @@ images/find_java_icon.o
*.ncb
*.suo
*.user
+Debug
+Release
diff --git a/find_java/build.gradle b/find_java/build.gradle
index b1dfa79..b359e0a 100644
--- a/find_java/build.gradle
+++ b/find_java/build.gradle
@@ -19,10 +19,16 @@ sources {
sdk {
windows {
- item( { getExeName("windows") } ) {
+ item( { getExeName("windows32FindJavaExecutable") } ) {
into 'lib'
- name 'find_java.exe'
- builtBy 'findJavaExecutable'
+ name 'find_java32.exe'
+ builtBy 'windows32FindJavaExecutable'
+ notice 'NOTICE'
+ }
+ item( { getExeName("windows64FindJavaExecutable") } ) {
+ into 'lib'
+ name 'find_java64.exe'
+ builtBy 'windows64FindJavaExecutable'
notice 'NOTICE'
}
item('find_java.bat') {
@@ -32,9 +38,9 @@ sdk {
}
}
-def getExeName(String platform) {
+def getExeName(String name) {
// binaries will return a set of binaries
- def binaries = executables.findJava.binaries.matching { it.name == "findJavaExecutable" }
+ def binaries = executables.findJava.binaries.matching { it.name == name }
// calling .exeFile on the set returns an array with the result from each item in the set...
return binaries.executableFile.get(0)
}
diff --git a/find_java/find_java.bat b/find_java/find_java.bat
index e7bc590..01367c1 100755
--- a/find_java/find_java.bat
+++ b/find_java/find_java.bat
@@ -21,15 +21,32 @@ rem Useful links:
rem Command-line reference:
rem http://technet.microsoft.com/en-us/library/bb490890.aspx
+rem Query whether this system is 32-bit or 64-bit
+rem Note: Some users report that reg.exe is missing on their machine, so we
+rem check for that first, as we'd like to use it if we can.
+set sys_32=%SYSTEMROOT%\system32
+if exist %sys_32%\reg.exe (
+ rem This first-pass solution returns the correct architecture even if you
+ rem call this .bat file from a 32-bit process.
+ rem See also: http://stackoverflow.com/a/24590583/1299302
+ %sys_32%\reg query "HKLM\Hardware\Description\System\CentralProcessor\0"^
+ | %sys_32%\find /i "x86" > NUL && set arch_ext=32|| set arch_ext=64
+) else (
+ rem This fallback approach is simpler, but may misreport your architecture as
+ rem 32-bit if running from a 32-bit process. Still, it should serve to help
+ rem our users without reg.exe, at least.
+ if "%PROCESSOR_ARCHITECTURE%" == "x86" (set arch_ext=32) else (set arch_ext=64)
+)
+
rem Check we have a valid Java.exe in the path. The return code will
rem be 0 if the command worked or 1 if the exec failed (program not found).
-for /f "delims=" %%a in ('"%~dps0\find_java.exe" -s') do set java_exe=%%a
+for /f "delims=" %%a in ('"%~dps0\find_java%arch_ext%.exe" -s') do set java_exe=%%a
if not defined java_exe goto :CheckFailed
:SearchJavaW
rem Check if we can find a javaw.exe at the same location than java.exe.
rem If that doesn't work, just fall back on the java.exe we just found.
-for /f "delims=" %%a in ('"%~dps0\find_java.exe" -s -w') do set javaw_exe=%%a
+for /f "delims=" %%a in ('"%~dps0\find_java%arch_ext%.exe" -s -w') do set javaw_exe=%%a
if not exist "%javaw_exe%" set javaw_exe=%java_exe%
goto :EOF
diff --git a/find_java/find_java.sln b/find_java/find_java.sln
index ec14173..510ab9b 100755
--- a/find_java/find_java.sln
+++ b/find_java/find_java.sln
@@ -1,36 +1,54 @@

-Microsoft Visual Studio Solution File, Format Version 10.00
-# Visual Studio 2008
-Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "FindJavaLib", "find_java_lib.vcproj", "{D194C98B-3FA4-4DAB-908A-16C03C15EC35}"
+Microsoft Visual Studio Solution File, Format Version 11.00
+# Visual Studio 2010
+Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "FindJavaLib", "find_java_lib.vcxproj", "{D194C98B-3FA4-4DAB-908A-16C03C15EC35}"
EndProject
-Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "FindJavaExe", "find_java_exe.vcproj", "{F116176E-AE3E-42E6-9249-663F49FAAFAE}"
+Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "FindJavaExe", "find_java_exe.vcxproj", "{F116176E-AE3E-42E6-9249-663F49FAAFAE}"
EndProject
-Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "FindLock", "..\find_lock\find_lock_exe.vcproj", "{42701EC1-6226-47FD-8817-57A3DEC7A1E2}"
+Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "FindLock", "..\find_lock\find_lock_exe.vcxproj", "{42701EC1-6226-47FD-8817-57A3DEC7A1E2}"
EndProject
-Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "SdkLauncher", "..\sdklauncher\sdklauncher.vcproj", "{331EADA4-DC19-429D-AAD0-5B9632B4CBC1}"
+Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "sdklauncher", "..\sdklauncher\sdklauncher.vcxproj", "{331EADA4-DC19-429D-AAD0-5B9632B4CBC1}"
EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Debug|Win32 = Debug|Win32
+ Debug|Win64 = Debug|Win64
Release|Win32 = Release|Win32
+ Release|Win64 = Release|Win64
EndGlobalSection
GlobalSection(ProjectConfigurationPlatforms) = postSolution
{D194C98B-3FA4-4DAB-908A-16C03C15EC35}.Debug|Win32.ActiveCfg = Debug|Win32
{D194C98B-3FA4-4DAB-908A-16C03C15EC35}.Debug|Win32.Build.0 = Debug|Win32
+ {D194C98B-3FA4-4DAB-908A-16C03C15EC35}.Debug|Win64.ActiveCfg = Debug|x64
+ {D194C98B-3FA4-4DAB-908A-16C03C15EC35}.Debug|Win64.Build.0 = Debug|x64
{D194C98B-3FA4-4DAB-908A-16C03C15EC35}.Release|Win32.ActiveCfg = Release|Win32
{D194C98B-3FA4-4DAB-908A-16C03C15EC35}.Release|Win32.Build.0 = Release|Win32
+ {D194C98B-3FA4-4DAB-908A-16C03C15EC35}.Release|Win64.ActiveCfg = Release|x64
+ {D194C98B-3FA4-4DAB-908A-16C03C15EC35}.Release|Win64.Build.0 = Release|x64
{F116176E-AE3E-42E6-9249-663F49FAAFAE}.Debug|Win32.ActiveCfg = Debug|Win32
{F116176E-AE3E-42E6-9249-663F49FAAFAE}.Debug|Win32.Build.0 = Debug|Win32
+ {F116176E-AE3E-42E6-9249-663F49FAAFAE}.Debug|Win64.ActiveCfg = Debug|x64
+ {F116176E-AE3E-42E6-9249-663F49FAAFAE}.Debug|Win64.Build.0 = Debug|x64
{F116176E-AE3E-42E6-9249-663F49FAAFAE}.Release|Win32.ActiveCfg = Release|Win32
{F116176E-AE3E-42E6-9249-663F49FAAFAE}.Release|Win32.Build.0 = Release|Win32
+ {F116176E-AE3E-42E6-9249-663F49FAAFAE}.Release|Win64.ActiveCfg = Release|x64
+ {F116176E-AE3E-42E6-9249-663F49FAAFAE}.Release|Win64.Build.0 = Release|x64
{42701EC1-6226-47FD-8817-57A3DEC7A1E2}.Debug|Win32.ActiveCfg = Debug|Win32
{42701EC1-6226-47FD-8817-57A3DEC7A1E2}.Debug|Win32.Build.0 = Debug|Win32
+ {42701EC1-6226-47FD-8817-57A3DEC7A1E2}.Debug|Win64.ActiveCfg = Debug|x64
+ {42701EC1-6226-47FD-8817-57A3DEC7A1E2}.Debug|Win64.Build.0 = Debug|x64
{42701EC1-6226-47FD-8817-57A3DEC7A1E2}.Release|Win32.ActiveCfg = Release|Win32
{42701EC1-6226-47FD-8817-57A3DEC7A1E2}.Release|Win32.Build.0 = Release|Win32
+ {42701EC1-6226-47FD-8817-57A3DEC7A1E2}.Release|Win64.ActiveCfg = Release|x64
+ {42701EC1-6226-47FD-8817-57A3DEC7A1E2}.Release|Win64.Build.0 = Release|x64
{331EADA4-DC19-429D-AAD0-5B9632B4CBC1}.Debug|Win32.ActiveCfg = Debug|Win32
{331EADA4-DC19-429D-AAD0-5B9632B4CBC1}.Debug|Win32.Build.0 = Debug|Win32
+ {331EADA4-DC19-429D-AAD0-5B9632B4CBC1}.Debug|Win64.ActiveCfg = Debug|x64
+ {331EADA4-DC19-429D-AAD0-5B9632B4CBC1}.Debug|Win64.Build.0 = Debug|x64
{331EADA4-DC19-429D-AAD0-5B9632B4CBC1}.Release|Win32.ActiveCfg = Release|Win32
{331EADA4-DC19-429D-AAD0-5B9632B4CBC1}.Release|Win32.Build.0 = Release|Win32
+ {331EADA4-DC19-429D-AAD0-5B9632B4CBC1}.Release|Win64.ActiveCfg = Release|x64
+ {331EADA4-DC19-429D-AAD0-5B9632B4CBC1}.Release|Win64.Build.0 = Release|x64
EndGlobalSection
GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE
diff --git a/find_java/find_java_exe.vcproj b/find_java/find_java_exe.vcproj
deleted file mode 100755
index 4ad3e45..0000000
--- a/find_java/find_java_exe.vcproj
+++ /dev/null
@@ -1,205 +0,0 @@
-<?xml version="1.0" encoding="Windows-1252"?>
-<VisualStudioProject
- ProjectType="Visual C++"
- Version="9.00"
- Name="FindJavaExe"
- ProjectGUID="{F116176E-AE3E-42E6-9249-663F49FAAFAE}"
- RootNamespace="FindJavaExe"
- Keyword="Win32Proj"
- TargetFrameworkVersion="196613"
- >
- <Platforms>
- <Platform
- Name="Win32"
- />
- </Platforms>
- <ToolFiles>
- </ToolFiles>
- <Configurations>
- <Configuration
- Name="Debug|Win32"
- OutputDirectory="$(SolutionDir)..\..\out\host\windows-x86\$(ConfigurationName)\$(ProjectName)"
- IntermediateDirectory="$(SolutionDir)..\..\out\host\windows-x86\$(ConfigurationName)\$(ProjectName)"
- ConfigurationType="1"
- CharacterSet="2"
- >
- <Tool
- Name="VCPreBuildEventTool"
- />
- <Tool
- Name="VCCustomBuildTool"
- />
- <Tool
- Name="VCXMLDataGeneratorTool"
- />
- <Tool
- Name="VCWebServiceProxyGeneratorTool"
- />
- <Tool
- Name="VCMIDLTool"
- />
- <Tool
- Name="VCCLCompilerTool"
- Optimization="0"
- PreprocessorDefinitions="WIN32;_DEBUG;_CONSOLE"
- MinimalRebuild="true"
- BasicRuntimeChecks="3"
- RuntimeLibrary="3"
- UsePrecompiledHeader="0"
- WarningLevel="3"
- DebugInformationFormat="4"
- />
- <Tool
- Name="VCManagedResourceCompilerTool"
- />
- <Tool
- Name="VCResourceCompilerTool"
- />
- <Tool
- Name="VCPreLinkEventTool"
- />
- <Tool
- Name="VCLinkerTool"
- LinkIncremental="2"
- GenerateDebugInformation="true"
- SubSystem="1"
- TargetMachine="1"
- />
- <Tool
- Name="VCALinkTool"
- />
- <Tool
- Name="VCManifestTool"
- />
- <Tool
- Name="VCXDCMakeTool"
- />
- <Tool
- Name="VCBscMakeTool"
- />
- <Tool
- Name="VCFxCopTool"
- />
- <Tool
- Name="VCAppVerifierTool"
- />
- <Tool
- Name="VCPostBuildEventTool"
- />
- </Configuration>
- <Configuration
- Name="Release|Win32"
- OutputDirectory="$(SolutionDir)..\..\out\host\windows-x86\$(ConfigurationName)\$(ProjectName)"
- IntermediateDirectory="$(SolutionDir)..\..\out\host\windows-x86\$(ConfigurationName)\$(ProjectName)"
- ConfigurationType="1"
- CharacterSet="2"
- WholeProgramOptimization="1"
- >
- <Tool
- Name="VCPreBuildEventTool"
- />
- <Tool
- Name="VCCustomBuildTool"
- />
- <Tool
- Name="VCXMLDataGeneratorTool"
- />
- <Tool
- Name="VCWebServiceProxyGeneratorTool"
- />
- <Tool
- Name="VCMIDLTool"
- />
- <Tool
- Name="VCCLCompilerTool"
- Optimization="2"
- EnableIntrinsicFunctions="true"
- PreprocessorDefinitions="WIN32;NDEBUG;_CONSOLE"
- RuntimeLibrary="2"
- EnableFunctionLevelLinking="true"
- UsePrecompiledHeader="0"
- WarningLevel="3"
- DebugInformationFormat="3"
- />
- <Tool
- Name="VCManagedResourceCompilerTool"
- />
- <Tool
- Name="VCResourceCompilerTool"
- />
- <Tool
- Name="VCPreLinkEventTool"
- />
- <Tool
- Name="VCLinkerTool"
- LinkIncremental="1"
- GenerateDebugInformation="true"
- SubSystem="1"
- OptimizeReferences="2"
- EnableCOMDATFolding="2"
- TargetMachine="1"
- />
- <Tool
- Name="VCALinkTool"
- />
- <Tool
- Name="VCManifestTool"
- />
- <Tool
- Name="VCXDCMakeTool"
- />
- <Tool
- Name="VCBscMakeTool"
- />
- <Tool
- Name="VCFxCopTool"
- />
- <Tool
- Name="VCAppVerifierTool"
- />
- <Tool
- Name="VCPostBuildEventTool"
- />
- </Configuration>
- </Configurations>
- <References>
- <ProjectReference
- ReferencedProjectIdentifier="{D194C98B-3FA4-4DAB-908A-16C03C15EC35}"
- RelativePathToProject=".\FindJavaLib.vcproj"
- />
- </References>
- <Files>
- <Filter
- Name="Source Files"
- Filter="cpp;c;cc;cxx;def;odl;idl;hpj;bat;asm;asmx"
- UniqueIdentifier="{4FC737F1-C7A5-4376-A066-2A32D752A2FF}"
- >
- <File
- RelativePath=".\find_java_exe.cpp"
- >
- </File>
- </Filter>
- <Filter
- Name="Header Files"
- Filter="h;hpp;hxx;hm;inl;inc;xsd"
- UniqueIdentifier="{93995380-89BD-4b04-88EB-625FBE52EBFB}"
- >
- <File
- RelativePath=".\find_java.h"
- >
- </File>
- <File
- RelativePath=".\utils.h"
- >
- </File>
- </Filter>
- <Filter
- Name="Resource Files"
- Filter="rc;ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe;resx;tiff;tif;png;wav"
- UniqueIdentifier="{67DA6AB6-F800-4c08-8B7A-83BB121AAD01}"
- >
- </Filter>
- </Files>
- <Globals>
- </Globals>
-</VisualStudioProject>
diff --git a/find_java/find_java_exe.vcxproj b/find_java/find_java_exe.vcxproj
new file mode 100644
index 0000000..67ebf71
--- /dev/null
+++ b/find_java/find_java_exe.vcxproj
@@ -0,0 +1,174 @@
+<?xml version="1.0" encoding="utf-8"?>
+<Project DefaultTargets="Build" ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
+ <ItemGroup Label="ProjectConfigurations">
+ <ProjectConfiguration Include="Debug|Win32">
+ <Configuration>Debug</Configuration>
+ <Platform>Win32</Platform>
+ </ProjectConfiguration>
+ <ProjectConfiguration Include="Debug|x64">
+ <Configuration>Debug</Configuration>
+ <Platform>x64</Platform>
+ </ProjectConfiguration>
+ <ProjectConfiguration Include="Release|Win32">
+ <Configuration>Release</Configuration>
+ <Platform>Win32</Platform>
+ </ProjectConfiguration>
+ <ProjectConfiguration Include="Release|x64">
+ <Configuration>Release</Configuration>
+ <Platform>x64</Platform>
+ </ProjectConfiguration>
+ </ItemGroup>
+ <PropertyGroup Label="Globals">
+ <ProjectName>FindJavaExe</ProjectName>
+ <ProjectGuid>{F116176E-AE3E-42E6-9249-663F49FAAFAE}</ProjectGuid>
+ <RootNamespace>FindJavaExe</RootNamespace>
+ <Keyword>Win32Proj</Keyword>
+ </PropertyGroup>
+ <Import Project="$(VCTargetsPath)\Microsoft.Cpp.Default.props" />
+ <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'" Label="Configuration">
+ <ConfigurationType>Application</ConfigurationType>
+ <CharacterSet>MultiByte</CharacterSet>
+ <WholeProgramOptimization>true</WholeProgramOptimization>
+ <UseOfMfc>Static</UseOfMfc>
+ </PropertyGroup>
+ <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'" Label="Configuration">
+ <ConfigurationType>Application</ConfigurationType>
+ <CharacterSet>MultiByte</CharacterSet>
+ <WholeProgramOptimization>true</WholeProgramOptimization>
+ <UseOfMfc>Static</UseOfMfc>
+ </PropertyGroup>
+ <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'" Label="Configuration">
+ <ConfigurationType>Application</ConfigurationType>
+ <CharacterSet>MultiByte</CharacterSet>
+ <UseOfMfc>Static</UseOfMfc>
+ </PropertyGroup>
+ <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'" Label="Configuration">
+ <ConfigurationType>Application</ConfigurationType>
+ <CharacterSet>MultiByte</CharacterSet>
+ <UseOfMfc>Static</UseOfMfc>
+ </PropertyGroup>
+ <Import Project="$(VCTargetsPath)\Microsoft.Cpp.props" />
+ <ImportGroup Label="ExtensionSettings">
+ </ImportGroup>
+ <ImportGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'" Label="PropertySheets">
+ <Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
+ </ImportGroup>
+ <ImportGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'" Label="PropertySheets">
+ <Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
+ </ImportGroup>
+ <ImportGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'" Label="PropertySheets">
+ <Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
+ </ImportGroup>
+ <ImportGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'" Label="PropertySheets">
+ <Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
+ </ImportGroup>
+ <PropertyGroup Label="UserMacros" />
+ <PropertyGroup>
+ <_ProjectFileVersion>10.0.40219.1</_ProjectFileVersion>
+ <OutDir Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">$(SolutionDir)..\..\out\host\windows-x86\$(Configuration)\$(ProjectName)\</OutDir>
+ <OutDir Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">$(SolutionDir)..\..\out\host\windows-x64\$(Configuration)\$(ProjectName)\</OutDir>
+ <IntDir Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">$(SolutionDir)..\..\out\host\windows-x86\$(Configuration)\$(ProjectName)\</IntDir>
+ <IntDir Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">$(SolutionDir)..\..\out\host\windows-x64\$(Configuration)\$(ProjectName)\</IntDir>
+ <LinkIncremental Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">true</LinkIncremental>
+ <LinkIncremental Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">true</LinkIncremental>
+ <OutDir Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">$(SolutionDir)..\..\out\host\windows-x86\$(Configuration)\$(ProjectName)\</OutDir>
+ <OutDir Condition="'$(Configuration)|$(Platform)'=='Release|x64'">$(SolutionDir)..\..\out\host\windows-x64\$(Configuration)\$(ProjectName)\</OutDir>
+ <IntDir Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">$(SolutionDir)..\..\out\host\windows-x86\$(Configuration)\$(ProjectName)\</IntDir>
+ <IntDir Condition="'$(Configuration)|$(Platform)'=='Release|x64'">$(SolutionDir)..\..\out\host\windows-x64\$(Configuration)\$(ProjectName)\</IntDir>
+ <LinkIncremental Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">false</LinkIncremental>
+ <LinkIncremental Condition="'$(Configuration)|$(Platform)'=='Release|x64'">false</LinkIncremental>
+ <TargetName Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">find_java64</TargetName>
+ <TargetName Condition="'$(Configuration)|$(Platform)'=='Release|x64'">find_java64</TargetName>
+ <TargetName Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">$(ProjectName)32</TargetName>
+ <TargetName Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">find_java32</TargetName>
+ </PropertyGroup>
+ <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
+ <ClCompile>
+ <Optimization>Disabled</Optimization>
+ <PreprocessorDefinitions>WIN32;_DEBUG;_CONSOLE;%(PreprocessorDefinitions)</PreprocessorDefinitions>
+ <MinimalRebuild>true</MinimalRebuild>
+ <BasicRuntimeChecks>EnableFastChecks</BasicRuntimeChecks>
+ <RuntimeLibrary>MultiThreaded</RuntimeLibrary>
+ <PrecompiledHeader>
+ </PrecompiledHeader>
+ <WarningLevel>Level3</WarningLevel>
+ <DebugInformationFormat>EditAndContinue</DebugInformationFormat>
+ </ClCompile>
+ <Link>
+ <GenerateDebugInformation>true</GenerateDebugInformation>
+ <SubSystem>Console</SubSystem>
+ <TargetMachine>MachineX86</TargetMachine>
+ <AdditionalDependencies>user32.lib;advapi32.lib;shell32.lib</AdditionalDependencies>
+ </Link>
+ </ItemDefinitionGroup>
+ <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">
+ <ClCompile>
+ <Optimization>Disabled</Optimization>
+ <PreprocessorDefinitions>WIN32;_DEBUG;_CONSOLE;%(PreprocessorDefinitions)</PreprocessorDefinitions>
+ <BasicRuntimeChecks>EnableFastChecks</BasicRuntimeChecks>
+ <RuntimeLibrary>MultiThreaded</RuntimeLibrary>
+ <PrecompiledHeader>
+ </PrecompiledHeader>
+ <WarningLevel>Level3</WarningLevel>
+ <DebugInformationFormat>ProgramDatabase</DebugInformationFormat>
+ </ClCompile>
+ <Link>
+ <GenerateDebugInformation>true</GenerateDebugInformation>
+ <SubSystem>Console</SubSystem>
+ <AdditionalDependencies>user32.lib;advapi32.lib;shell32.lib</AdditionalDependencies>
+ </Link>
+ </ItemDefinitionGroup>
+ <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
+ <ClCompile>
+ <Optimization>MaxSpeed</Optimization>
+ <IntrinsicFunctions>true</IntrinsicFunctions>
+ <PreprocessorDefinitions>WIN32;NDEBUG;_CONSOLE;%(PreprocessorDefinitions)</PreprocessorDefinitions>
+ <RuntimeLibrary>MultiThreaded</RuntimeLibrary>
+ <FunctionLevelLinking>true</FunctionLevelLinking>
+ <PrecompiledHeader>
+ </PrecompiledHeader>
+ <WarningLevel>Level3</WarningLevel>
+ <DebugInformationFormat>ProgramDatabase</DebugInformationFormat>
+ </ClCompile>
+ <Link>
+ <GenerateDebugInformation>true</GenerateDebugInformation>
+ <SubSystem>Console</SubSystem>
+ <OptimizeReferences>true</OptimizeReferences>
+ <EnableCOMDATFolding>true</EnableCOMDATFolding>
+ <TargetMachine>MachineX86</TargetMachine>
+ <AdditionalDependencies>user32.lib;advapi32.lib;shell32.lib</AdditionalDependencies>
+ </Link>
+ </ItemDefinitionGroup>
+ <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'">
+ <ClCompile>
+ <Optimization>MaxSpeed</Optimization>
+ <IntrinsicFunctions>true</IntrinsicFunctions>
+ <PreprocessorDefinitions>WIN32;NDEBUG;_CONSOLE;%(PreprocessorDefinitions)</PreprocessorDefinitions>
+ <RuntimeLibrary>MultiThreaded</RuntimeLibrary>
+ <FunctionLevelLinking>true</FunctionLevelLinking>
+ <PrecompiledHeader>
+ </PrecompiledHeader>
+ <WarningLevel>Level3</WarningLevel>
+ <DebugInformationFormat>ProgramDatabase</DebugInformationFormat>
+ </ClCompile>
+ <Link>
+ <GenerateDebugInformation>true</GenerateDebugInformation>
+ <SubSystem>Console</SubSystem>
+ <OptimizeReferences>true</OptimizeReferences>
+ <EnableCOMDATFolding>true</EnableCOMDATFolding>
+ <AdditionalDependencies>user32.lib;advapi32.lib;shell32.lib</AdditionalDependencies>
+ </Link>
+ </ItemDefinitionGroup>
+ <ItemGroup>
+ <ClCompile Include="src\source\find_java_exe.cpp" />
+ <ClCompile Include="src\source\find_java_lib.cpp" />
+ <ClCompile Include="src\source\utils.cpp" />
+ </ItemGroup>
+ <ItemGroup>
+ <ClInclude Include="src\source\find_java.h" />
+ <ClInclude Include="src\source\utils.h" />
+ </ItemGroup>
+ <Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" />
+ <ImportGroup Label="ExtensionTargets">
+ </ImportGroup>
+</Project> \ No newline at end of file
diff --git a/find_java/find_java_exe.vcxproj.filters b/find_java/find_java_exe.vcxproj.filters
new file mode 100644
index 0000000..7cc0be1
--- /dev/null
+++ b/find_java/find_java_exe.vcxproj.filters
@@ -0,0 +1,36 @@
+<?xml version="1.0" encoding="utf-8"?>
+<Project ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
+ <ItemGroup>
+ <Filter Include="Source Files">
+ <UniqueIdentifier>{4FC737F1-C7A5-4376-A066-2A32D752A2FF}</UniqueIdentifier>
+ <Extensions>cpp;c;cc;cxx;def;odl;idl;hpj;bat;asm;asmx</Extensions>
+ </Filter>
+ <Filter Include="Header Files">
+ <UniqueIdentifier>{93995380-89BD-4b04-88EB-625FBE52EBFB}</UniqueIdentifier>
+ <Extensions>h;hpp;hxx;hm;inl;inc;xsd</Extensions>
+ </Filter>
+ <Filter Include="Resource Files">
+ <UniqueIdentifier>{67DA6AB6-F800-4c08-8B7A-83BB121AAD01}</UniqueIdentifier>
+ <Extensions>rc;ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe;resx;tiff;tif;png;wav</Extensions>
+ </Filter>
+ </ItemGroup>
+ <ItemGroup>
+ <ClCompile Include="src\source\find_java_exe.cpp">
+ <Filter>Source Files</Filter>
+ </ClCompile>
+ <ClCompile Include="src\source\utils.cpp">
+ <Filter>Source Files</Filter>
+ </ClCompile>
+ <ClCompile Include="src\source\find_java_lib.cpp">
+ <Filter>Source Files</Filter>
+ </ClCompile>
+ </ItemGroup>
+ <ItemGroup>
+ <ClInclude Include="src\source\find_java.h">
+ <Filter>Header Files</Filter>
+ </ClInclude>
+ <ClInclude Include="src\source\utils.h">
+ <Filter>Header Files</Filter>
+ </ClInclude>
+ </ItemGroup>
+</Project> \ No newline at end of file
diff --git a/find_java/find_java_lib.vcproj b/find_java/find_java_lib.vcproj
deleted file mode 100755
index 944d08a..0000000
--- a/find_java/find_java_lib.vcproj
+++ /dev/null
@@ -1,187 +0,0 @@
-<?xml version="1.0" encoding="Windows-1252"?>
-<VisualStudioProject
- ProjectType="Visual C++"
- Version="9.00"
- Name="FindJavaLib"
- ProjectGUID="{D194C98B-3FA4-4DAB-908A-16C03C15EC35}"
- RootNamespace="FindJavaLib"
- Keyword="Win32Proj"
- TargetFrameworkVersion="196613"
- >
- <Platforms>
- <Platform
- Name="Win32"
- />
- </Platforms>
- <ToolFiles>
- </ToolFiles>
- <Configurations>
- <Configuration
- Name="Debug|Win32"
- OutputDirectory="$(SolutionDir)..\..\out\host\windows-x86\$(ConfigurationName)\$(ProjectName)"
- IntermediateDirectory="$(SolutionDir)..\..\out\host\windows-x86\$(ConfigurationName)\$(ProjectName)"
- ConfigurationType="4"
- CharacterSet="2"
- >
- <Tool
- Name="VCPreBuildEventTool"
- />
- <Tool
- Name="VCCustomBuildTool"
- />
- <Tool
- Name="VCXMLDataGeneratorTool"
- />
- <Tool
- Name="VCWebServiceProxyGeneratorTool"
- />
- <Tool
- Name="VCMIDLTool"
- />
- <Tool
- Name="VCCLCompilerTool"
- Optimization="0"
- PreprocessorDefinitions="WIN32;_DEBUG;_LIB"
- MinimalRebuild="true"
- BasicRuntimeChecks="3"
- RuntimeLibrary="3"
- UsePrecompiledHeader="0"
- WarningLevel="3"
- DebugInformationFormat="4"
- />
- <Tool
- Name="VCManagedResourceCompilerTool"
- />
- <Tool
- Name="VCResourceCompilerTool"
- />
- <Tool
- Name="VCPreLinkEventTool"
- />
- <Tool
- Name="VCLibrarianTool"
- />
- <Tool
- Name="VCALinkTool"
- />
- <Tool
- Name="VCXDCMakeTool"
- />
- <Tool
- Name="VCBscMakeTool"
- />
- <Tool
- Name="VCFxCopTool"
- />
- <Tool
- Name="VCPostBuildEventTool"
- />
- </Configuration>
- <Configuration
- Name="Release|Win32"
- OutputDirectory="$(SolutionDir)..\..\out\host\windows-x86\$(ConfigurationName)\$(ProjectName)"
- IntermediateDirectory="$(SolutionDir)..\..\out\host\windows-x86\$(ConfigurationName)\$(ProjectName)"
- ConfigurationType="4"
- CharacterSet="2"
- WholeProgramOptimization="1"
- >
- <Tool
- Name="VCPreBuildEventTool"
- />
- <Tool
- Name="VCCustomBuildTool"
- />
- <Tool
- Name="VCXMLDataGeneratorTool"
- />
- <Tool
- Name="VCWebServiceProxyGeneratorTool"
- />
- <Tool
- Name="VCMIDLTool"
- />
- <Tool
- Name="VCCLCompilerTool"
- Optimization="2"
- EnableIntrinsicFunctions="true"
- PreprocessorDefinitions="WIN32;NDEBUG;_LIB"
- RuntimeLibrary="2"
- EnableFunctionLevelLinking="true"
- UsePrecompiledHeader="0"
- WarningLevel="3"
- DebugInformationFormat="3"
- />
- <Tool
- Name="VCManagedResourceCompilerTool"
- />
- <Tool
- Name="VCResourceCompilerTool"
- />
- <Tool
- Name="VCPreLinkEventTool"
- />
- <Tool
- Name="VCLibrarianTool"
- />
- <Tool
- Name="VCALinkTool"
- />
- <Tool
- Name="VCXDCMakeTool"
- />
- <Tool
- Name="VCBscMakeTool"
- />
- <Tool
- Name="VCFxCopTool"
- />
- <Tool
- Name="VCPostBuildEventTool"
- />
- </Configuration>
- </Configurations>
- <References>
- </References>
- <Files>
- <Filter
- Name="Source Files"
- Filter="cpp;c;cc;cxx;def;odl;idl;hpj;bat;asm;asmx"
- UniqueIdentifier="{4FC737F1-C7A5-4376-A066-2A32D752A2FF}"
- >
- <File
- RelativePath=".\find_java_lib.cpp"
- >
- </File>
- <File
- RelativePath=".\utils.cpp"
- >
- </File>
- </Filter>
- <Filter
- Name="Header Files"
- Filter="h;hpp;hxx;hm;inl;inc;xsd"
- UniqueIdentifier="{93995380-89BD-4b04-88EB-625FBE52EBFB}"
- >
- <File
- RelativePath=".\find_java.h"
- >
- </File>
- <File
- RelativePath=".\utils.h"
- >
- </File>
- </Filter>
- <Filter
- Name="Resource Files"
- Filter="rc;ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe;resx;tiff;tif;png;wav"
- UniqueIdentifier="{67DA6AB6-F800-4c08-8B7A-83BB121AAD01}"
- >
- </Filter>
- <File
- RelativePath=".\ReadMe.txt"
- >
- </File>
- </Files>
- <Globals>
- </Globals>
-</VisualStudioProject>
diff --git a/find_java/find_java_lib.vcxproj b/find_java/find_java_lib.vcxproj
new file mode 100644
index 0000000..7ca3499
--- /dev/null
+++ b/find_java/find_java_lib.vcxproj
@@ -0,0 +1,135 @@
+<?xml version="1.0" encoding="utf-8"?>
+<Project DefaultTargets="Build" ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
+ <ItemGroup Label="ProjectConfigurations">
+ <ProjectConfiguration Include="Debug|Win32">
+ <Configuration>Debug</Configuration>
+ <Platform>Win32</Platform>
+ </ProjectConfiguration>
+ <ProjectConfiguration Include="Debug|x64">
+ <Configuration>Debug</Configuration>
+ <Platform>x64</Platform>
+ </ProjectConfiguration>
+ <ProjectConfiguration Include="Release|Win32">
+ <Configuration>Release</Configuration>
+ <Platform>Win32</Platform>
+ </ProjectConfiguration>
+ <ProjectConfiguration Include="Release|x64">
+ <Configuration>Release</Configuration>
+ <Platform>x64</Platform>
+ </ProjectConfiguration>
+ </ItemGroup>
+ <PropertyGroup Label="Globals">
+ <ProjectName>FindJavaLib</ProjectName>
+ <ProjectGuid>{D194C98B-3FA4-4DAB-908A-16C03C15EC35}</ProjectGuid>
+ <RootNamespace>FindJavaLib</RootNamespace>
+ <Keyword>Win32Proj</Keyword>
+ </PropertyGroup>
+ <Import Project="$(VCTargetsPath)\Microsoft.Cpp.Default.props" />
+ <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'" Label="Configuration">
+ <ConfigurationType>StaticLibrary</ConfigurationType>
+ <CharacterSet>MultiByte</CharacterSet>
+ <WholeProgramOptimization>true</WholeProgramOptimization>
+ </PropertyGroup>
+ <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'" Label="Configuration">
+ <ConfigurationType>StaticLibrary</ConfigurationType>
+ <CharacterSet>MultiByte</CharacterSet>
+ <WholeProgramOptimization>true</WholeProgramOptimization>
+ </PropertyGroup>
+ <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'" Label="Configuration">
+ <ConfigurationType>StaticLibrary</ConfigurationType>
+ <CharacterSet>MultiByte</CharacterSet>
+ </PropertyGroup>
+ <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'" Label="Configuration">
+ <ConfigurationType>StaticLibrary</ConfigurationType>
+ <CharacterSet>MultiByte</CharacterSet>
+ </PropertyGroup>
+ <Import Project="$(VCTargetsPath)\Microsoft.Cpp.props" />
+ <ImportGroup Label="ExtensionSettings">
+ </ImportGroup>
+ <ImportGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'" Label="PropertySheets">
+ <Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
+ </ImportGroup>
+ <ImportGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'" Label="PropertySheets">
+ <Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
+ </ImportGroup>
+ <ImportGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'" Label="PropertySheets">
+ <Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
+ </ImportGroup>
+ <ImportGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'" Label="PropertySheets">
+ <Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
+ </ImportGroup>
+ <PropertyGroup Label="UserMacros" />
+ <PropertyGroup>
+ <_ProjectFileVersion>10.0.40219.1</_ProjectFileVersion>
+ <OutDir Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">$(SolutionDir)..\..\out\host\windows-x86\$(Configuration)\$(ProjectName)\</OutDir>
+ <OutDir Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">$(SolutionDir)..\..\out\host\windows-x64\$(Configuration)\$(ProjectName)\</OutDir>
+ <IntDir Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">$(SolutionDir)..\..\out\host\windows-x86\$(Configuration)\$(ProjectName)\</IntDir>
+ <IntDir Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">$(SolutionDir)..\..\out\host\windows-x64\$(Configuration)\$(ProjectName)\</IntDir>
+ <OutDir Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">$(SolutionDir)..\..\out\host\windows-x86\$(Configuration)\$(ProjectName)\</OutDir>
+ <OutDir Condition="'$(Configuration)|$(Platform)'=='Release|x64'">$(SolutionDir)..\..\out\host\windows-x64\$(Configuration)\$(ProjectName)\</OutDir>
+ <IntDir Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">$(SolutionDir)..\..\out\host\windows-x86\$(Configuration)\$(ProjectName)\</IntDir>
+ <IntDir Condition="'$(Configuration)|$(Platform)'=='Release|x64'">$(SolutionDir)..\..\out\host\windows-x64\$(Configuration)\$(ProjectName)\</IntDir>
+ </PropertyGroup>
+ <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
+ <ClCompile>
+ <Optimization>Disabled</Optimization>
+ <PreprocessorDefinitions>WIN32;_DEBUG;_LIB;%(PreprocessorDefinitions)</PreprocessorDefinitions>
+ <MinimalRebuild>true</MinimalRebuild>
+ <BasicRuntimeChecks>EnableFastChecks</BasicRuntimeChecks>
+ <RuntimeLibrary>MultiThreadedDebugDLL</RuntimeLibrary>
+ <PrecompiledHeader>
+ </PrecompiledHeader>
+ <WarningLevel>Level3</WarningLevel>
+ <DebugInformationFormat>EditAndContinue</DebugInformationFormat>
+ </ClCompile>
+ </ItemDefinitionGroup>
+ <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">
+ <ClCompile>
+ <Optimization>Disabled</Optimization>
+ <PreprocessorDefinitions>WIN32;_DEBUG;_LIB;%(PreprocessorDefinitions)</PreprocessorDefinitions>
+ <BasicRuntimeChecks>EnableFastChecks</BasicRuntimeChecks>
+ <RuntimeLibrary>MultiThreadedDebugDLL</RuntimeLibrary>
+ <PrecompiledHeader>
+ </PrecompiledHeader>
+ <WarningLevel>Level3</WarningLevel>
+ <DebugInformationFormat>ProgramDatabase</DebugInformationFormat>
+ </ClCompile>
+ </ItemDefinitionGroup>
+ <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
+ <ClCompile>
+ <Optimization>MaxSpeed</Optimization>
+ <IntrinsicFunctions>true</IntrinsicFunctions>
+ <PreprocessorDefinitions>WIN32;NDEBUG;_LIB;%(PreprocessorDefinitions)</PreprocessorDefinitions>
+ <RuntimeLibrary>MultiThreadedDLL</RuntimeLibrary>
+ <FunctionLevelLinking>true</FunctionLevelLinking>
+ <PrecompiledHeader>
+ </PrecompiledHeader>
+ <WarningLevel>Level3</WarningLevel>
+ <DebugInformationFormat>ProgramDatabase</DebugInformationFormat>
+ </ClCompile>
+ </ItemDefinitionGroup>
+ <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'">
+ <ClCompile>
+ <Optimization>MaxSpeed</Optimization>
+ <IntrinsicFunctions>true</IntrinsicFunctions>
+ <PreprocessorDefinitions>WIN32;NDEBUG;_LIB;%(PreprocessorDefinitions)</PreprocessorDefinitions>
+ <RuntimeLibrary>MultiThreadedDLL</RuntimeLibrary>
+ <FunctionLevelLinking>true</FunctionLevelLinking>
+ <PrecompiledHeader>
+ </PrecompiledHeader>
+ <WarningLevel>Level3</WarningLevel>
+ <DebugInformationFormat>ProgramDatabase</DebugInformationFormat>
+ </ClCompile>
+ </ItemDefinitionGroup>
+ <ItemGroup>
+ <ClCompile Include="src\source\find_java_lib.cpp" />
+ <ClCompile Include="src\source\utils.cpp" />
+ </ItemGroup>
+ <ItemGroup>
+ <ClInclude Include="src\source\find_java.h" />
+ <ClInclude Include="src\source\utils.h" />
+ </ItemGroup>
+ <Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" />
+ <ImportGroup Label="ExtensionTargets">
+ </ImportGroup>
+</Project> \ No newline at end of file
diff --git a/find_java/find_java_lib.vcxproj.filters b/find_java/find_java_lib.vcxproj.filters
new file mode 100644
index 0000000..4bc439b
--- /dev/null
+++ b/find_java/find_java_lib.vcxproj.filters
@@ -0,0 +1,33 @@
+<?xml version="1.0" encoding="utf-8"?>
+<Project ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
+ <ItemGroup>
+ <Filter Include="Source Files">
+ <UniqueIdentifier>{4FC737F1-C7A5-4376-A066-2A32D752A2FF}</UniqueIdentifier>
+ <Extensions>cpp;c;cc;cxx;def;odl;idl;hpj;bat;asm;asmx</Extensions>
+ </Filter>
+ <Filter Include="Header Files">
+ <UniqueIdentifier>{93995380-89BD-4b04-88EB-625FBE52EBFB}</UniqueIdentifier>
+ <Extensions>h;hpp;hxx;hm;inl;inc;xsd</Extensions>
+ </Filter>
+ <Filter Include="Resource Files">
+ <UniqueIdentifier>{67DA6AB6-F800-4c08-8B7A-83BB121AAD01}</UniqueIdentifier>
+ <Extensions>rc;ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe;resx;tiff;tif;png;wav</Extensions>
+ </Filter>
+ </ItemGroup>
+ <ItemGroup>
+ <ClCompile Include="src\source\find_java_lib.cpp">
+ <Filter>Source Files</Filter>
+ </ClCompile>
+ <ClCompile Include="src\source\utils.cpp">
+ <Filter>Source Files</Filter>
+ </ClCompile>
+ </ItemGroup>
+ <ItemGroup>
+ <ClInclude Include="src\source\find_java.h">
+ <Filter>Header Files</Filter>
+ </ClInclude>
+ <ClInclude Include="src\source\utils.h">
+ <Filter>Header Files</Filter>
+ </ClInclude>
+ </ItemGroup>
+</Project> \ No newline at end of file
diff --git a/find_java/src/source/find_java.h b/find_java/src/source/find_java.h
index 1181aa1..49b5fd9 100755
--- a/find_java/src/source/find_java.h
+++ b/find_java/src/source/find_java.h
@@ -21,15 +21,24 @@
#include "utils.h"
-// We currently search for a Java version for at least 1.6
+#define TO_JAVA_VERSION(major, minor) ((major) * 1000 + (minor))
+#define JAVA_MAJOR(version) ((version) / 1000)
+#define JAVA_MINOR(version) ((version) % 1000)
+
+// We currently search for a Java version for at least 1.6 by default
#define MIN_JAVA_VERSION_MAJOR 1
#define MIN_JAVA_VERSION_MINOR 6
-#define MIN_JAVA_VERSION (MIN_JAVA_VERSION_MAJOR * 1000 + MIN_JAVA_VERSION_MINOR)
+#define MIN_JAVA_VERSION TO_JAVA_VERSION(MIN_JAVA_VERSION_MAJOR, MIN_JAVA_VERSION_MINOR)
+int findJavaInPath(const CPath &path, CPath *outJavaPath, bool isJdk = false,
+ int minVersion = MIN_JAVA_VERSION);
+int findJavaInEnvPath(CPath *outJavaPath, bool isJdk = false,
+ int minVersion = MIN_JAVA_VERSION);
+int findJavaInRegistry(CPath *outJavaPath, bool isJdk = false,
+ int minVersion = MIN_JAVA_VERSION);
+int findJavaInProgramFiles(CPath *outJavaPath, bool isJdk = false,
+ int minVersion = MIN_JAVA_VERSION);
-int findJavaInEnvPath(CPath *outJavaPath);
-int findJavaInRegistry(CPath *outJavaPath);
-int findJavaInProgramFiles(CPath *outJavaPath);
bool getJavaVersion(CPath &javaPath, CString *outVersionStr, int *outVersionInt);
#endif /* _WIN32 */
diff --git a/find_java/src/source/find_java_exe.cpp b/find_java/src/source/find_java_exe.cpp
index 6b1add9..50ca024 100644
--- a/find_java/src/source/find_java_exe.cpp
+++ b/find_java/src/source/find_java_exe.cpp
@@ -43,21 +43,71 @@
#include <io.h>
#include <fcntl.h>
-static void testFindJava() {
+static int showHelpMessage() {
+ printf(
+ "Outputs the path of the first Java.exe found on the local system.\n"
+ "Returns code 0 when found, 1 when not found.\n"
+ "Options:\n"
+ "-h / -help : This help.\n"
+ "-t / -test : Internal test.\n"
+ "-e / -error : Print an error message to the console if Java.exe isn't found.\n"
+ "-j / -jdk : Only returns java.exe found in a JDK.\n"
+ "-s / -short : Print path in short DOS form.\n"
+ "-p / -path `dir` : A custom path to search first. Pass in JDK base dir if -j is set.\n"
+ "-w / -javaw : Search a matching javaw.exe; defaults to java.exe if not found.\n"
+ "-m / -minv # : Pass in a minimum version to use (default: 1.6).\n"
+ "-v / -version: Only prints the Java version found.\n"
+ );
+ return 2;
+}
+
+static void printError(const char *message) {
+
+ CString error;
+ error.setLastWin32Error(message);
+ printf(error.cstr());
+}
+
+static void testFindJava(bool isJdk, int minVersion) {
CPath javaPath("<not found>");
- int v = findJavaInEnvPath(&javaPath);
- printf("findJavaInEnvPath: [%d] %s\n", v, javaPath.cstr());
+ int v = findJavaInEnvPath(&javaPath, isJdk, minVersion);
+ printf(" findJavaInEnvPath: [%d] %s\n", v, javaPath.cstr());
javaPath.set("<not found>");
- v = findJavaInRegistry(&javaPath);
- printf("findJavaInRegistry [%d] %s\n", v, javaPath.cstr());
+ v = findJavaInRegistry(&javaPath, isJdk, minVersion);
+ printf(" findJavaInRegistry [%d] %s\n", v, javaPath.cstr());
javaPath.set("<not found>");
- v = findJavaInProgramFiles(&javaPath);
- printf("findJavaInProgramFiles [%d] %s\n", v, javaPath.cstr());
+ v = findJavaInProgramFiles(&javaPath, isJdk, minVersion);
+ printf(" findJavaInProgramFiles [%d] %s\n", v, javaPath.cstr());
+}
+
+static void testFindJava(int minVersion) {
+
+ printf("Searching for version %d.%d or newer...\n", JAVA_MAJOR(minVersion),
+ JAVA_MINOR(minVersion));
+
+ printf("\n");
+ printf("Searching for any java.exe:\n");
+ testFindJava(false, minVersion);
+
+ printf("\n");
+ printf("Searching for java.exe within a JDK:\n");
+ testFindJava(true, minVersion);
}
+// Returns 0 on failure or a java version on success.
+int parseMinVersionArg(char* arg) {
+
+ int versionMajor = -1;
+ int versionMinor = -1;
+ if (sscanf(arg, "%d.%d", &versionMajor, &versionMinor) != 2) {
+ // -m arg is malformatted
+ return 0;
+ }
+ return TO_JAVA_VERSION(versionMajor, versionMinor);
+}
int main(int argc, char* argv[]) {
@@ -66,12 +116,28 @@ int main(int argc, char* argv[]) {
bool doShortPath = false;
bool doVersion = false;
bool doJavaW = false;
+ bool isJdk = false;
+ bool shouldPrintError = false;
+ int minVersion = MIN_JAVA_VERSION;
+ const char *customPathStr = NULL;
for (int i = 1; i < argc; i++) {
if (strncmp(argv[i], "-t", 2) == 0) {
- testFindJava();
+ testFindJava(minVersion);
return 0;
+ } else if (strncmp(argv[i], "-j", 2) == 0) {
+ isJdk = true;
+
+ } else if (strncmp(argv[i], "-e", 2) == 0) {
+ shouldPrintError = true;
+
+ } else if (strncmp(argv[i], "-p", 2) == 0) {
+ i++;
+ if (i == argc) {
+ return showHelpMessage();
+ }
+ customPathStr = argv[i];
} else if (strncmp(argv[i], "-d", 2) == 0) {
gIsDebug = true;
@@ -81,57 +147,75 @@ int main(int argc, char* argv[]) {
} else if (strncmp(argv[i], "-v", 2) == 0) {
doVersion = true;
- } else if (strcmp(argv[i], "-w") == 0 || strcmp(argv[i], "-javaw") == 0) {
+ } else if (strncmp(argv[i], "-m", 2) == 0) {
+ i++;
+ if (i == argc ||
+ ((minVersion = parseMinVersionArg(argv[i])) == 0)) {
+ return showHelpMessage();
+ }
+ }
+ else if (strcmp(argv[i], "-w") == 0 || strcmp(argv[i], "-javaw") == 0) {
doJavaW = true;
- } else {
- printf(
- "Outputs the path of the first Java.exe found on the local system.\n"
- "Returns code 0 when found, 1 when not found.\n"
- "Options:\n"
- "-h / -help : This help.\n"
- "-t / -test : Internal test.\n"
- "-s / -short : Print path in short DOS form.\n"
- "-w / -javaw : Search a matching javaw.exe; defaults to java.exe if not found.\n"
- "-v / -version: Only prints the Java version found.\n"
- );
- return 2;
+ }
+ else {
+ return showHelpMessage();
}
}
// Find the first suitable version of Java we can use.
CPath javaPath;
- int version = findJavaInEnvPath(&javaPath);
- if (version < MIN_JAVA_VERSION) {
- version = findJavaInRegistry(&javaPath);
+
+ int version = 0;
+ if (customPathStr != NULL) {
+ CPath customPath(customPathStr);
+ version = findJavaInPath(customPath, &javaPath, isJdk, minVersion);
+ }
+ if (version == 0) {
+ version = findJavaInEnvPath(&javaPath, isJdk, minVersion);
+ }
+ if (version == 0) {
+ version = findJavaInRegistry(&javaPath, isJdk, minVersion);
}
- if (version < MIN_JAVA_VERSION) {
- version = findJavaInProgramFiles(&javaPath);
+ if (version == 0) {
+ version = findJavaInProgramFiles(&javaPath, isJdk, minVersion);
}
- if (version < MIN_JAVA_VERSION || javaPath.isEmpty()) {
+
+ if (version == 0) {
+ CString s;
+ s.setf("Failed to find Java %d.%d (or newer) on your system. ", JAVA_MAJOR(minVersion),
+ JAVA_MINOR(minVersion));
+
if (gIsDebug) {
- fprintf(stderr, "Failed to find Java on your system.\n");
+ fprintf(stderr, s.cstr());
+ }
+
+ if (shouldPrintError) {
+ printError(s.cstr());
}
+
return 1;
}
_ASSERT(!javaPath.isEmpty());
if (doShortPath) {
- PVOID oldWow64Value = disableWow64FsRedirection();
if (!javaPath.toShortPath(&javaPath)) {
- revertWow64FsRedirection(&oldWow64Value);
- fprintf(stderr,
- "Failed to convert path to a short DOS path: %s\n",
- javaPath.cstr());
+ CString s;
+ s.setf("Failed to convert path (%s) to a short DOS path. ", javaPath.cstr());
+ fprintf(stderr, s.cstr());
+
+ if (shouldPrintError) {
+ printError(s.cstr());
+ }
+
return 1;
}
- revertWow64FsRedirection(&oldWow64Value);
}
if (doVersion) {
// Print version found. We already have the version as an integer
// so we don't need to run java -version a second time.
- printf("%d.%d", version / 1000, version % 1000);
+ printf("%d.%d", JAVA_MAJOR(version), JAVA_MINOR(version));
return 0;
}
@@ -140,15 +224,13 @@ int main(int argc, char* argv[]) {
CPath javawPath(javaPath);
javawPath.replaceName("java.exe", "javaw.exe");
// Only accept it if we can actually find the exec
- PVOID oldWow64Value = disableWow64FsRedirection();
if (javawPath.fileExists()) {
javaPath.set(javawPath.cstr());
}
- revertWow64FsRedirection(&oldWow64Value);
}
// Print java.exe path found
- printf("%s", javaPath.cstr());
+ printf(javaPath.cstr());
return 0;
}
diff --git a/find_java/src/source/find_java_lib.cpp b/find_java/src/source/find_java_lib.cpp
index 4c04e7f..fe50f83 100755
--- a/find_java/src/source/find_java_lib.cpp
+++ b/find_java/src/source/find_java_lib.cpp
@@ -35,6 +35,17 @@
typedef LONG LSTATUS;
#endif
+// Check to see if the application is running in 32-bit or 64-bit mode. In other words, this will
+// return false if you run a 32-bit build even on a 64-bit machine.
+static bool isApplication64() {
+ SYSTEM_INFO sysInfo;
+ GetSystemInfo(&sysInfo);
+
+ // Note: The constant name here is a bit misleading, as it actually covers all 64-bit processors
+ // and not just AMD.
+ // See also: http://msdn.microsoft.com/en-us/library/windows/desktop/ms724958(v=vs.85).aspx
+ return (sysInfo.wProcessorArchitecture == PROCESSOR_ARCHITECTURE_AMD64);
+}
// Extract the first thing that looks like (digit.digit+).
// Note: this will break when java reports a version with major > 9.
@@ -70,6 +81,21 @@ static bool extractJavaVersion(const char *start,
return false;
}
+// Check if the passed in path is a path to a JDK
+static bool isJdkPath(const CPath &path) {
+
+ // If the files "bin/java.exe" and "lib/tools.jar" exist, we're probably a JDK.
+ CPath pathBin(path);
+ pathBin.addPath("bin");
+ pathBin.addPath("java.exe");
+
+ CPath pathTools(path);
+ pathTools.addPath("lib");
+ pathTools.addPath("tools.jar");
+
+ return (pathBin.fileExists() && pathTools.fileExists());
+}
+
// Check whether we can find $PATH/java.exe.
// inOutPath should be the directory where we're looking at.
// In output, it will be the java path we tested.
@@ -79,7 +105,6 @@ static int checkPath(CPath *inOutPath) {
inOutPath->addPath("java.exe");
int result = 0;
- PVOID oldWow64Value = disableWow64FsRedirection();
if (inOutPath->fileExists()) {
// Run java -version
// Reject the version if it's not at least our current minimum.
@@ -88,7 +113,6 @@ static int checkPath(CPath *inOutPath) {
}
}
- revertWow64FsRedirection(oldWow64Value);
return result;
}
@@ -99,29 +123,54 @@ static int checkBinPath(CPath *inOutPath) {
return checkPath(inOutPath);
}
-// Search java.exe in the environment
-int findJavaInEnvPath(CPath *outJavaPath) {
+// Test for the existence of java.exe in a custom path
+int findJavaInPath(const CPath &path, CPath *outJavaPath, bool isJdk, int minVersion) {
SetLastError(0);
- int currVersion = 0;
+ int version = 0;
+ CPath temp(path);
+ if (!isJdk) {
+ version = checkPath(&temp);
+ }
+ else {
+ if (isJdkPath(temp)) {
+ version = checkBinPath(&temp);
+ }
+ }
+
+ if (version >= minVersion) {
+ if (gIsDebug) {
+ fprintf(stderr, "Java %d found in path: %s\n", version, temp.cstr());
+ }
+ *outJavaPath = temp;
+ return version;
+ }
+ return 0;
+}
+
+// Search java.exe in the environment
+int findJavaInEnvPath(CPath *outJavaPath, bool isJdk, int minVersion) {
+ SetLastError(0);
const char* envPath = getenv("JAVA_HOME");
if (envPath != NULL) {
CPath p(envPath);
- currVersion = checkBinPath(&p);
- if (currVersion > 0) {
- if (gIsDebug) {
- fprintf(stderr, "Java %d found via JAVA_HOME: %s\n", currVersion, p.cstr());
+
+ if (!isJdk || isJdkPath(p)) {
+ int v = checkBinPath(&p);
+ if (v >= minVersion) {
+ if (gIsDebug) {
+ fprintf(stderr, "Java %d found via JAVA_HOME: %s\n", v, p.cstr());
+ }
+ *outJavaPath = p;
+ // As an optimization for runtime, if we find a suitable java
+ // version in JAVA_HOME we won't waste time looking at the PATH.
+ return v;
}
- *outJavaPath = p;
- }
- if (currVersion >= MIN_JAVA_VERSION) {
- // As an optimization for runtime, if we find a suitable java
- // version in JAVA_HOME we won't waste time looking at the PATH.
- return currVersion;
}
}
+ int currVersion = 0;
envPath = getenv("PATH");
if (!envPath) return currVersion;
@@ -131,11 +180,17 @@ int findJavaInEnvPath(CPath *outJavaPath) {
CArray<CString> *paths = CString(envPath).split(';');
for(int i = 0; i < paths->size(); i++) {
CPath p((*paths)[i].cstr());
+
+ if (isJdk && !isJdkPath(p)) {
+ continue;
+ }
+
int v = checkPath(&p);
- if (v > currVersion) {
+ if (v >= minVersion && v > currVersion) {
if (gIsDebug) {
fprintf(stderr, "Java %d found via env PATH: %s\n", v, p.cstr());
}
+
currVersion = v;
*outJavaPath = p;
}
@@ -196,7 +251,8 @@ static bool getRegValue(const char *keyPath,
// Returns an int which is the version of Java found (e.g. 1006 for 1.6) and the
// matching path in outJavaPath.
// Returns 0 if nothing suitable was found.
-static int exploreJavaRegistry(const char *entry, REGSAM access, CPath *outJavaPath) {
+static int exploreJavaRegistry(const char *entry, REGSAM access, int minVersion,
+ CPath *outJavaPath) {
// Let's visit HKEY_LOCAL_MACHINE\SOFTWARE\JavaSoft\Java Runtime Environment [CurrentVersion]
CPath rootKey("SOFTWARE\\JavaSoft\\");
@@ -220,7 +276,7 @@ static int exploreJavaRegistry(const char *entry, REGSAM access, CPath *outJavaP
}
*outJavaPath = javaHome;
}
- if (versionInt >= MIN_JAVA_VERSION) {
+ if (versionInt >= minVersion) {
// Heuristic: if the current version is good enough, stop here
return versionInt;
}
@@ -279,7 +335,7 @@ static int exploreJavaRegistry(const char *entry, REGSAM access, CPath *outJavaP
static bool getMaxJavaInRegistry(const char *entry, REGSAM access, CPath *outJavaPath, int *inOutVersion) {
CPath path;
- int version = exploreJavaRegistry(entry, access, &path);
+ int version = exploreJavaRegistry(entry, access, *inOutVersion, &path);
if (version > *inOutVersion) {
*outJavaPath = path;
*inOutVersion = version;
@@ -288,45 +344,18 @@ static bool getMaxJavaInRegistry(const char *entry, REGSAM access, CPath *outJav
return false;
}
-int findJavaInRegistry(CPath *outJavaPath) {
- // We'll do the registry test 3 times: first using the default mode,
- // then forcing the use of the 32-bit registry then forcing the use of
- // 64-bit registry. On Windows 2k, the 2 latter will fail since the
- // flags are not supported. On a 32-bit OS the 64-bit is obviously
- // useless and the 2 first tests should be equivalent so we just
- // need the first case.
-
+int findJavaInRegistry(CPath *outJavaPath, bool isJdk, int minVersion) {
// Check the JRE first, then the JDK.
- int version = MIN_JAVA_VERSION - 1;
+ int version = minVersion - 1; // Inner methods check if they're greater than this version.
bool result = false;
- result |= getMaxJavaInRegistry("Java Runtime Environment", 0, outJavaPath, &version);
- result |= getMaxJavaInRegistry("Java Development Kit", 0, outJavaPath, &version);
-
- // Get the app sysinfo state (the one hidden by WOW64)
- SYSTEM_INFO sysInfo;
- GetSystemInfo(&sysInfo);
- WORD programArch = sysInfo.wProcessorArchitecture;
- // Check the real sysinfo state (not the one hidden by WOW64) for x86
- GetNativeSystemInfo(&sysInfo);
- WORD actualArch = sysInfo.wProcessorArchitecture;
-
- // Only try to access the WOW64-32 redirected keys on a 64-bit system.
- // There's no point in doing this on a 32-bit system.
- if (actualArch == PROCESSOR_ARCHITECTURE_AMD64) {
- if (programArch != PROCESSOR_ARCHITECTURE_INTEL) {
- // If we did the 32-bit case earlier, don't do it twice.
- result |= getMaxJavaInRegistry(
- "Java Runtime Environment", KEY_WOW64_32KEY, outJavaPath, &version);
- result |= getMaxJavaInRegistry(
- "Java Development Kit", KEY_WOW64_32KEY, outJavaPath, &version);
-
- } else if (programArch != PROCESSOR_ARCHITECTURE_AMD64) {
- // If we did the 64-bit case earlier, don't do it twice.
- result |= getMaxJavaInRegistry(
- "Java Runtime Environment", KEY_WOW64_64KEY, outJavaPath, &version);
- result |= getMaxJavaInRegistry(
- "Java Development Kit", KEY_WOW64_64KEY, outJavaPath, &version);
- }
+ result |= (!isJdk && getMaxJavaInRegistry("Java Runtime Environment", 0, outJavaPath, &version));
+ result |= getMaxJavaInRegistry("Java Development Kit", 0, outJavaPath, &version);
+
+ // Even if we're 64-bit, try again but check the 32-bit registry, looking for 32-bit java.
+ if (isApplication64()) {
+ result |= (!isJdk &&
+ getMaxJavaInRegistry("Java Runtime Environment", KEY_WOW64_32KEY, outJavaPath, &version));
+ result |= getMaxJavaInRegistry("Java Development Kit", KEY_WOW64_32KEY, outJavaPath, &version);
}
return result ? version : 0;
@@ -334,12 +363,14 @@ int findJavaInRegistry(CPath *outJavaPath) {
// --------------
-static bool checkProgramFiles(CPath *outJavaPath, int *inOutVersion) {
+static bool checkProgramFiles(CPath *outJavaPath, int *inOutVersion, bool isJdk,
+ bool force32bit) {
char programFilesPath[MAX_PATH + 1];
+ int nFolder = force32bit ? CSIDL_PROGRAM_FILESX86 : CSIDL_PROGRAM_FILES;
HRESULT result = SHGetFolderPathA(
NULL, // hwndOwner
- CSIDL_PROGRAM_FILES, // nFolder
+ nFolder,
NULL, // hToken
SHGFP_TYPE_CURRENT, // dwFlags
programFilesPath); // pszPath
@@ -348,7 +379,7 @@ static bool checkProgramFiles(CPath *outJavaPath, int *inOutVersion) {
CPath path(programFilesPath);
path.addPath("Java");
- // Do we have a C:\\Program Files\\Java directory?
+ // Do we have a C:\Program Files\Java directory?
if (!path.dirExists()) return false;
CPath glob(path);
@@ -362,12 +393,15 @@ static bool checkProgramFiles(CPath *outJavaPath, int *inOutVersion) {
if ((findData.dwFileAttributes & FILE_ATTRIBUTE_DIRECTORY) != 0) {
CPath temp(path);
temp.addPath(findData.cFileName);
- // Check C:\\Program Files[x86]\\Java\\j*\\bin\\java.exe
- int v = checkBinPath(&temp);
- if (v > *inOutVersion) {
- found = true;
- *inOutVersion = v;
- *outJavaPath = temp;
+ // Check C:\Program Files\Java\j*\bin\java.exe
+
+ if (!isJdk || isJdkPath(temp)) {
+ int v = checkBinPath(&temp);
+ if (v > *inOutVersion) {
+ found = true;
+ *inOutVersion = v;
+ *outJavaPath = temp;
+ }
}
}
} while (!found && FindNextFileA(findH, &findData) != 0);
@@ -376,25 +410,17 @@ static bool checkProgramFiles(CPath *outJavaPath, int *inOutVersion) {
return found;
}
-int findJavaInProgramFiles(CPath *outJavaPath) {
+int findJavaInProgramFiles(CPath *outJavaPath, bool isJdk, int minVersion) {
- // Check the C:\\Program Files (x86) directory
- // With WOW64 fs redirection in place by default, we should get the x86
- // version on a 64-bit OS since this app is a 32-bit itself.
+ // Check the C:\Program Files directory
bool result = false;
- int version = MIN_JAVA_VERSION - 1;
- result |= checkProgramFiles(outJavaPath, &version);
+ int version = minVersion - 1; // Inner methods check if they're greater than this version.
+ result |= checkProgramFiles(outJavaPath, &version, isJdk, false);
- // Check the real sysinfo state (not the one hidden by WOW64) for x86
- SYSTEM_INFO sysInfo;
- GetNativeSystemInfo(&sysInfo);
-
- if (sysInfo.wProcessorArchitecture == PROCESSOR_ARCHITECTURE_AMD64) {
- // On a 64-bit OS, try again by disabling the fs redirection so
- // that we can try the real C:\\Program Files directory.
- PVOID oldWow64Value = disableWow64FsRedirection();
- result |= checkProgramFiles(outJavaPath, &version);
- revertWow64FsRedirection(oldWow64Value);
+ // Even if we're 64-bit, try again but check the C:\Program Files (x86) directory, looking for
+ // 32-bit java.
+ if (isApplication64()) {
+ result |= checkProgramFiles(outJavaPath, &version, isJdk, true);
}
return result ? version : 0;
@@ -402,7 +428,6 @@ int findJavaInProgramFiles(CPath *outJavaPath) {
// --------------
-
// Tries to invoke the java.exe at the given path and extract it's
// version number.
// - outVersionStr: if not null, will capture version as a string (e.g. "1.6")
@@ -529,9 +554,12 @@ bool getJavaVersion(CPath &javaPath, CString *outVersionStr, int *outVersionInt)
// care about specific ordering or case-senstiviness.
// We only captures roughtly the first line in lower case.
char *j = strstr(first32, "java");
+ if (!j) {
+ j = strstr(first32, "openjdk");
+ }
char *v = strstr(first32, "version");
if ((gIsConsole || gIsDebug) && (!j || !v)) {
- fprintf(stderr, "Error: keywords 'java version' not found in '%s'\n", first32);
+ fprintf(stderr, "Error: keywords 'java|openjdk version' not found in '%s'\n", first32);
}
if (j != NULL && v != NULL) {
result = extractJavaVersion(first32, index, outVersionStr, outVersionInt);
diff --git a/find_java/src/source/utils.h b/find_java/src/source/utils.h
index dc9031d..a65e6fe 100755
--- a/find_java/src/source/utils.h
+++ b/find_java/src/source/utils.h
@@ -73,7 +73,7 @@ public:
CString() { mStr = NULL; }
CString(const CString &str) { mStr = NULL; set(str.mStr); }
explicit CString(const char *str) { mStr = NULL; set(str); }
- CString(const char *start, int length) { mStr = NULL; set(start, length); }
+ CString(const char *start, size_t length) { mStr = NULL; set(start, length); }
CString& operator=(const CString &str) {
return set(str.cstr());
@@ -89,7 +89,7 @@ public:
return *this;
}
- CString& set(const char *start, int length) {
+ CString& set(const char *start, size_t length) {
_free();
if (start != NULL) {
mStr = (char *)malloc(length + 1);
@@ -103,7 +103,7 @@ public:
_free();
// _vscprintf(str, ap) is only available with the MSVCRT, not MinGW.
// Instead we'll iterate till we have enough space to generate the string.
- int len = strlen(str) + 1024;
+ size_t len = strlen(str) + 1024;
mStr = (char *)malloc(len);
strcpy(mStr, str); // provide a default in case vsnprintf totally fails
for (int guard = 0; guard < 10; guard++) {
@@ -145,7 +145,7 @@ public:
return mStr == NULL || *mStr == 0;
}
- int length() const {
+ size_t length() const {
return mStr == NULL ? 0 : strlen(mStr);
}
@@ -163,7 +163,7 @@ public:
if (mStr == NULL) {
set(str, length);
} else {
- int l1 = strlen(mStr);
+ size_t l1 = strlen(mStr);
mStr = (char *)realloc((void *)mStr, l1 + length + 1);
strncpy(mStr + l1, str, length);
mStr[l1 + length] = 0;
@@ -256,7 +256,7 @@ public:
CPath& addPath(const char *s) {
_ASSERT(s != NULL);
if (s != NULL && s[0] != 0) {
- int n = length();
+ size_t n = length();
if (n > 0 && s[0] != '\\' && mStr[n-1] != '\\') add("\\");
add(s);
}
@@ -308,12 +308,12 @@ public:
// If the path ends with the given searchName, replace in-place by the new name
void replaceName(const char *searchName, const char* newName) {
if (mStr == NULL) return;
- int n = length();
- int sn = strlen(searchName);
+ size_t n = length();
+ size_t sn = strlen(searchName);
if (n < sn) return;
// if mStr ends with searchName
if (strcmp(mStr + n - sn, searchName) == 0) {
- int sn2 = strlen(newName);
+ size_t sn2 = strlen(newName);
if (sn2 > sn) {
mStr = (char *)realloc((void *)mStr, n + sn2 - sn + 1);
}
@@ -330,7 +330,7 @@ public:
const char *longPath = mStr;
if (mStr == NULL) return false;
- DWORD lenShort = strlen(longPath) + 1;
+ DWORD lenShort = (DWORD)strlen(longPath) + 1; // GetShortPathName deals with DWORDs
char * shortPath = (char *)malloc(lenShort);
DWORD length = GetShortPathName(longPath, shortPath, lenShort);
@@ -366,15 +366,5 @@ int execWait(const char *cmd);
bool getModuleDir(CPath *outDir);
-// Disables the FS redirection done by WOW64.
-// Because this runs as a 32-bit app, Windows automagically remaps some
-// folder under the hood (e.g. "Programs Files(x86)" is mapped as "Program Files").
-// This prevents the app from correctly searching for java.exe in these folders.
-// The registry is also remapped.
-PVOID disableWow64FsRedirection();
-
-// Reverts the redirection disabled in disableWow64FsRedirection.
-void revertWow64FsRedirection(PVOID oldWow64Value);
-
#endif /* _WIN32 */
#endif /* _H_UTILS */