I have created a desktop application in JAVA using NetBeans IDE. Application can write data to a file. I use Arabic characters in my application and When i Run the Application directly from NetBeans, I can write The Arabic characters to a file without any issue. But when i run the .jar file in dist folder outside NetBeans, it shows '????' instead of Arabic font. I will be grateful if some one can help me to find a solution.
This is my Custom Logger Class:
public class MLogger {
private static final Logger log = Logger.getLogger( MLogger.class.getName() );
private static FileHandler fh;
private static SimpleFormatter sf;
public static synchronized void writeLogToFile(String message){
try {
fh = new FileHandler("D://wblogs/wblog.txt", true);
// true forces append mode
sf= new SimpleFormatter();
fh.setFormatter(sf);
log.addHandler(fh);
log.log( Level.INFO,message);
} catch (IOException ex) {
Logger.getLogger(MLogger.class.getName()).log(Level.SEVERE, null, ex);
} catch (SecurityException ex) {
Logger.getLogger(MLogger.class.getName()).log(Level.SEVERE, null, ex);
}
}
}
and I use the method :
MLogger.writeLogToFile("محمد اقبال");