Depending on what you are accused for and where, maybe you could try to get a therapy instead of jail and if this "succeeds", the sentence will be replaced by probation. Around here (Western Europe) it's afaik possible for sentences up to 1 year, sometimes more when it is an addiction related crime.
I know in some cases court can decide about medicine but that is utter bullshit and should be possible to avoid / changed to something more humane than invega. Second the questions of OpiateKiller, did you have a lawyer / try to get one paid, and did he attack the case and medicine?
I didn't have jail sentence yet but lived for 18 months with the fear of having to go for 9+ months. Now it's there again, am on probation and they say I damaged some glass in a train. Doc wants antipsychotic, but told them (more or less truthfully) that I have had pardox reactions to a bunch of them, dysphoria and anhedonia (heavy restlessness), from one even acoustic hallucinations and panic so he tried a lighter one, cariprazine which I don't feel much from but is also open to that methadone stabilizes me much more than these antipsychotics and if I prove to be stable now, he might argument to have me on it instead..
Running really seems like a good option yet usually it's not - you'd have to hide not only for the sentence's length but for 7 years or so, until your case hits limitation. You'd need a good fake ID and all for this, and specially nerves made out of steel ... I developed psychosis, real psychosis with hallucinations for the first time in my life, when I was travelling across Germany aiming for the border when I was thinking of being hunted by police (which wasn't true probably, as it was non-violent and not yet sentenced). You are not me of course, some people survive the street and pressure for long time but on the other hand, many people will face the sentence sooner or later.
... and, as has been said, if you go by yourself, you probably won't have to sit the whole time, but if they need to hunt you, things will be worse. Also depending on your location and other factors, probably jail itself is less horrible than detention. In jail people can (need to) work, do sports, talk with other inmates etc. - my absolute horror is isolation, followed by violence.
OT: Anybody knowing from first- or second hand how it really is in prison? Do you really need to be physically strong and 'prove' yourself or are under pressure/beaten by the bosses in there? Or depends on which section you're in. Would hope that these having 'only' some months to 1-2 years just want to go through their time and avoid additional problems..