简体   繁体   English

当我从Netbeans运行JFrame程序时,印地语字体是可见的,但运行.jar文件时,则看不见

[英]Hindi font is visible when I am running JFrame program from Netbeans but not visible when running .jar file

I am using Hindi fonts in my project and when I am running it on Netbeans it works fine, but when I am run its .jar file it does not load Hindi font, but shows some garbage things. 我在项目中使用印地语字体,当我在Netbeans上运行它时,它工作正常,但是当我运行其.jar文件时,它不会加载印地语字体,但会显示一些垃圾内容。 I am using UTF-8 encoding in Netbeans, and Arial Unicode MS font. 我在Netbeans中使用UTF-8编码,并使用Arial Unicode MS字体。

When running from Netbeans: 从Netbeans运行时:

从Netbeans运行时

When running .jar file: 运行.jar文件时:

运行.jar文件时

There are no issues in English. 英文没有问题。 Thanks in advance. 提前致谢。

I have solved my problem, it was happening because I was using UTF-8 in NetBeans, but .jar file was using some other encoding. 我已经解决了我的问题,这是因为我在NetBeans中使用UTF-8,但是.jar文件正在使用其他编码。 So when reading the file I gave CharSet UTF-8. 因此,在读取文件时,我给了CharSet UTF-8。

List<String> s=  Files.readAllLines(Paths.get(langPath + "\\" + ExcerciseList.getSelectedValue() + ".txt"),Charset.forName("UTF-8"));

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 在Eclipse中运行Java应用程序时,为什么JFrame不可见? - Why is my JFrame not visible when running my Java application in eclipse? 从NetBeans项目的命令行运行jar时找不到文件 - File not found when running jar from command line of a NetBeans project 在 netBeans 中运行程序时,字体看起来非常奇怪 - When running the program in netBeans the font looks extremely weird 从jar运行程序时的绝对文件路径? - Absolute file paths when running program from jar? Java程序在Netbeans中可以正常运行,但是从内置的JAR运行时,它不起作用 - Java program runs fine within Netbeans, but when running from a built JAR it does not work 将JFrame设置为可见时出现JFace错误:可可AWT:在非预期的情况下在AppKit线程0上运行 - JFace error when setting JFrame visible: Cocoa AWT: Running on AppKit thread 0 when not expected 在Netbeans外部运行jar文件时无法访问映像文件 - Not able to access the image file when running jar file outside Netbeans 从命令提示符运行JAR文件时,为什么会出现异常? - Why am I getting an exception when running a JAR file from the command prompt? 从CMD运行JAR文件时,为什么会收到NoClassDefFoundError? - Why am I receiving a NoClassDefFoundError when running a JAR file from CMD? 在netbeans上运行但在运行jar时没有错误? - No errors when runs on netbeans but not when running the jar?
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM