The reaction medium shows a significant effect on the distribution of alkane products for the hydro-deoxygenation of fatty acid methyl esters (FAMEs) over a bifunctional catalyst. Biodiesel-related methyl stearate was hydrodeoxygenated to heptadecane and octadecane over Ru/HZSM-5. In aqueous medium, heptadecane is a predominant product owing to a suppression effect of water on the octadecanol dehydration process. In the case of cyclohexane medium, the C-17/(C-17 + C-18) ratio significantly decreases with the temperature due to a promotion effect of reaction temperature on the octadecanol hydro-deoxygenation process. Our research results further reveal that solvent water can remarkably promote the methyl stearate-to-stearic acid transformation in the network of hydrodeoxygenation of methyl stearate via hydrolysis and hydrogenolysis steps. The hydrodeoxygenation temperature required for methyl stearate is approximately 40 degrees lower in water than in cyclohexane. The reaction pathway involves methyl stearate hydrogenolysis over Ru/HZSM-5 (in water or organic phase) and methyl stearate hydrolysis over HZSM-5 (in water) to generate stearic acid. Octadecanal is a key "intermediate" for subsequent stearic acid-to-octadecanol transformation and is responsible for heptadecane production via the decarbonylation pathway over Ru/HZSM-5, while hydrodeoxygenation of octadecanol leads to the formation of octadecane.