This is ultimately a decision that everyone has to make on its own, and it's an ethically complex issue with many facets.
My take on it is that if you contribute in any way to the development of a weapon that is used in morally unjustifiable ways, then you're complicit to murder and manslaughter, and you should be aware of that.
For example, the US is conducting drone strikes in Afghanistan, which are essentially political assassinations. These are condemned by almost any independent expert on international human rights and come with a very high death toll of civilians, including many women and children. In fact, the number of non-combatant civilian victims is routinely higher than the number of targets. Moreover, they are routinely conducted over the territory of another, sovereign country without any international mandate, without any judicial oversight, and without any trial.
If you participate in developing the drones or missiles that used in these strikes, or support them in any other way, then you are making yourself at least partially guilty of murder or manslaughter. From a moral perspective, it barely matters whether you believe or feel that the drone strikes keep your country safe. Extrajudicial killings of political opponents in foreign countries you are not at war with are illegal and immoral even if they have perceived or real positive side effects for your country.
That's just an example to illustrate that it matters a lot for which government you develop weapons and what track record your country has in terms of human rights, military aggressions against other countries or lack thereof, and so on. There's probably less of a problem if you develop weapons for the Swedish army than if you develop weapons for Russia or the US.
It also depends on the types of weapons, of course. Don't tell me it would be fine to develop chemical warfare agents, outlawed types of anti-person land mines, or autonomous killer robots, because they would 'keep your country safe'. Some technologies are just despicable. There's a reason why lasers that blind soldiers on the battlefield are outlawed.