During the pathogenic infection of Drosophila melanogaster, hemocytes play an important role in the immune response throughout the infection. Thus, the goal of this protocol is to develop a method to visualize the pathogen invasion in a specific immune compartment of flies, namely hemocytes. Using the method presented here, up to 3 × 106 live hemocytes can be obtained from 200 Drosophila 3rd instar larvae in 30 min for ex vivo infection. Alternatively, hemocytes can be infected in vivo through injection of 3rd instar larvae followed by hemocyte extraction up to 24 h post-infection. These infected primary cells were fixed, stained, and imaged using confocal microscopy. Then, 3D representations were generated from the images to definitively show pathogen invasion. Additionally, high-quality RNA for qRT-PCR can be obtained for the detection of pathogen mRNA following infection, and sufficient protein can be extracted from these cells for Western blot analysis. Taken together, we present a method for definite reconciliation of pathogen invasion and confirmation of infection using bacterial and viral pathogen types and an efficient method for hemocyte extraction to obtain enough live hemocytes from Drosophila larvae for ex vivo and in vivo infection experiments.