java - Font doesn't load correctly when running from jar -


i have problem java. load new font using code:

graphicsenvironment ge = graphicsenvironment.getlocalgraphicsenvironment(); ge.registerfont(font.createfont(font.plain, getclass().getresourceasstream("/some/packages/fonts/font.ttf"))); 

when debug in netbeans, works correctly, here's screenshot: http://i.imgur.com/ohj4xrw.png

correct font

but, once compile game font doesn't load (or @ least doesn't display correctly), this: http://i.imgur.com/ou1k9ow.png

wrong font

and there's 1 more thing - when run jar terminal (java -jar app.jar) - font works! have no idea why , how fix it. can me?

if app runs correctly when running command, try this:

process proc = runtime.getruntime().exec("java -jar app.jar"); // make sure provide path inputstream in = proc.getinputstream(); inputstream err = proc.geterrorstream(); outputstream out = proc.getoutputstream(); // in/out/err streams of proc 

Comments

Popular posts from this blog

javascript - How to get current YouTube IDs via iMacros? -

c# - Maintaining a program folder in program files out of date? -

emulation - Android map show my location didn't work -