Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Warn the user about possibly corrupted JRE (#2357) #2358

Merged
merged 1 commit into from
Nov 7, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
Loading