In recent times, programming knowledge tracing, as a fundamental task in programming learning analytics, has been widely applied in education, enabling accurate diagnosis of learners' mastery of programming knowledge concepts across diverse learning contexts. Existing programming knowledge tracing methods often overlook two key challenges: knowledge concept annotation deficiencies caused by the multiple-solution nature of programming problems and inadequate modeling of the actual progression of knowledge states within students' continuous submission sequences for targeted problems. Consequently, the information contained in the submitted code is underutilized, negatively impacting the estimation of students' evolving knowledge states. In this paper, we propose HGAKT-Code, a code-aware knowledge tracing framework for programming education assisted by Online Judge (OJ) systems. Our model integrates three novel components: (1) a Hierarchical Multi-label Code Classification (HMCC) algorithm to mitigate Q-matrix inaccuracies caused by diverse code solutions; (2) a code similarity-enhanced attention mechanism to better capture critical submissions reflecting subtle changes in students' knowledge states; and (3) a heterogeneous GNN with designed graph attention, modeling both conceptual and temporal learning dynamics. We evaluated HGAKT-Code on three OJ datasets and achieve AUC improvements of 4.2%, 3.0%(public OJ dataset) and 2.9% (institutional OJ dataset) over state-of-the-art baselines, respectively, demonstrating its effectiveness across educational settings.