@@ -51,21 +51,15 @@ public class Main {
5151 * @param args
5252 */
5353 public static void main (String [] args ) {
54- // Process application level properties file
55- // Update properties from Maven at build time:
56- // https://stackoverflow.com/questions/3697449/retrieve-version-from-maven-pom-xml-in-code
57- try {
58- InputStream iStream = Main .class .getClassLoader ().getResourceAsStream (PROPERTIES_FILE );
59- Properties prop = new Properties ();
60- prop .load (iStream );
61- VERSION = prop .getProperty ("Application.version" );
62- COPYRIGHT = "Copyright " + prop .getProperty ("Application.inceptionYear" ) + "-" + org .fross .library .Date .getCurrentYear () + " by Michael Fross" ;
63- } catch (IOException ex ) {
64- Output .fatalError ("Unable to read property file '" + PROPERTIES_FILE + "'" , 3 );
65- }
66-
6754 // Force JLine to assume the terminal supports ANSI color and movement
6855 System .setProperty ("org.jline.terminal.type" , "xterm-256color" );
56+
57+ // Suppress JLine warnings when running in confined environments (like snaps)
58+ // JLine can't access /dev/tty in strict confinement, so it falls back to dumb terminal
59+ // Colors still work fine via ANSI codes, so just suppress the warning
60+ if (System .getenv ("SNAP" ) != null || System .getenv ("SNAP_NAME" ) != null ) {
61+ java .util .logging .Logger .getLogger ("org.jline" ).setLevel (java .util .logging .Level .SEVERE );
62+ }
6963
7064 // Create a terminal used for output with JLine
7165 try {
@@ -82,7 +76,18 @@ public static void main(String[] args) {
8276
8377 } catch (IOException ex ) {
8478 // Note: Since terminal failed, we use System.out as a fallback
85- Output .println ("Unable to create a terminal. Visuals will be impacted" );
79+ Output .println ("Unable to create a terminal. Visuals may be impacted" );
80+ }
81+
82+ // Process application level properties file
83+ try {
84+ InputStream iStream = Main .class .getClassLoader ().getResourceAsStream (PROPERTIES_FILE );
85+ Properties prop = new Properties ();
86+ prop .load (iStream );
87+ VERSION = prop .getProperty ("Application.version" );
88+ COPYRIGHT = "Copyright " + prop .getProperty ("Application.inceptionYear" ) + "-" + org .fross .library .Date .getCurrentYear () + " by Michael Fross" ;
89+ } catch (IOException ex ) {
90+ Output .fatalError ("Unable to read property file '" + PROPERTIES_FILE + "'" , 3 );
8691 }
8792
8893 // Process the command line arguments and switches
@@ -147,4 +152,4 @@ public static void main(String[] args) {
147152 break ;
148153 }
149154 }
150- }
155+ }
0 commit comments