Skip to content

Commit

Permalink
'#2357: Warn the user about possibly corrupted JRE.
Browse files Browse the repository at this point in the history
  • Loading branch information
wladimirleite committed Nov 7, 2024
1 parent 7a08ee5 commit d2860d6
Show file tree
Hide file tree
Showing 2 changed files with 27 additions and 1 deletion.
2 changes: 1 addition & 1 deletion iped-app/src/main/java/iped/app/ui/AppMain.java
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ public class AppMain {

private static final String BUNDLED_JRE_VERSION = "11.0.13";

private static final String HOME_JRE_FOLDER = ".iped/jre-" + BUNDLED_JRE_VERSION;
public static final String HOME_JRE_FOLDER = ".iped/jre-" + BUNDLED_JRE_VERSION;

File casePath;

Expand Down
26 changes: 26 additions & 0 deletions iped-app/src/main/java/iped/app/ui/splash/SplashScreenManager.java
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,9 @@
import java.awt.RenderingHints;
import java.awt.SplashScreen;
import java.awt.geom.Rectangle2D;
import java.io.File;

import iped.app.ui.AppMain;
import iped.engine.Version;
import iped.engine.config.ConfigurationManager;
import iped.engine.config.SplashScreenConfig;
Expand Down Expand Up @@ -157,6 +159,30 @@ public void run() {
}
} catch (IllegalStateException e) {
// Splash was already closed, just ignore this exception.
} catch (NoClassDefFoundError | UnsatisfiedLinkError e) {
// Maybe JRE is corrupted
e.printStackTrace();

// Check if the OS is Windows
String os = System.getProperty("os.name");
if (os != null && os.toLowerCase().startsWith("windows")) {

// Check if user home is valid
File userHome = new File(System.getProperty("user.home"));
if (userHome != null && userHome.exists() && userHome.isDirectory()) {

// Check if the is a JRE in user home
File userJrePath = new File(userHome, AppMain.HOME_JRE_FOLDER);
if (userJrePath.exists()) {

// Warn the user about possibly corrupted JRE
System.err.println("\n\nERROR: User JRE may be corrupted!");
System.err.println("Please, try to delete \"" + userJrePath.getAbsolutePath()
+ "\" folder and run IPED again.");
System.err.println("");
}
}
}
} catch (Exception e) {
e.printStackTrace();
}
Expand Down

0 comments on commit d2860d6

Please sign in to comment.