Skip to content

Commit

Permalink
Merge pull request #2358 from sepinf-inc/#2357_MsgPossiblyCorruptedJRE
Browse files Browse the repository at this point in the history
Warn the user about possibly corrupted JRE (#2357)
lfcnassif authored Nov 7, 2024
2 parents 7a08ee5 + d2860d6 commit 5e26e64
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
@@ -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;

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
@@ -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;
@@ -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();
}

0 comments on commit 5e26e64

Please sign in to comment.