In Canada, criminal court judges are appointed. In other countries, such as the US, Japan, and Switzerland, judges are elected.
The methods and voting systems used to elect these judges varies based on country and municipality.
In the US for example, judges run for local office in the same way as other politicians (eg, mayors, council people, etc.), and sometimes have a party
affiliation for campaigning.