I'm using the following code to set my Java Swing application's title in Gnome 3's top bar. However, when I run it, I get the warnings shown below the code. Is there a better way to set the application title in code? Please note that this not a question about setting the title of the window itself.
try
{
Toolkit toolkit = Toolkit.getDefaultToolkit();
Field awtAppClassNameField = toolkit.getClass().getDeclaredField("awtAppClassName");
awtAppClassNameField.setAccessible(true);
awtAppClassNameField.set(toolkit, "FNDice");
}
catch (NoSuchFieldException | IllegalAccessException e)
{
e.printStackTrace();
}
Here are the warnings I see when I run my application.
WARNING: An illegal reflective access operation has occurred
WARNING: Illegal reflective access by com.gmail.fishnet37222.fndice.App (file:/home/dave/IdeaProjects/fndice/target/classes/) to field sun.awt.X11.XToolkit.awtAppClassName
WARNING: Please consider reporting this to the maintainers of com.gmail.fishnet37222.fndice.App
WARNING: Use --illegal-access=warn to enable warnings of further illegal reflective access operations
WARNING: All illegal access operations will be denied in a future release