解决部分阻断问题

This commit is contained in:
zhoudaxia 2016-08-26 10:53:50 +08:00
parent 510f51c303
commit f8948118bd
1 changed files with 7 additions and 5 deletions

View File

@ -9,6 +9,7 @@ package net.sf.robocode.installer;
import javax.swing.*; import javax.swing.*;
import java.awt.*; import java.awt.*;
import java.awt.event.ActionEvent; import java.awt.event.ActionEvent;
import java.awt.event.ActionListener; import java.awt.event.ActionListener;
@ -33,13 +34,14 @@ public class AutoExtract implements ActionListener {
private static File installDir; private static File installDir;
private static final String javaVersion = System.getProperty("java.version"); private static final String javaVersion = System.getProperty("java.version");
private boolean acceptLicense() { private boolean acceptLicense() throws IOException {
String licenseText = ""; String licenseText = "";
InputStream is; InputStream is;
JarFile extractJar = null;
try { try {
JarFile extractJar = new JarFile("extract.jar"); extractJar = new JarFile("extract.jar");
is = extractJar.getInputStream(extractJar.getJarEntry("license/cpl-v10.html")); is = extractJar.getInputStream(extractJar.getJarEntry("license/cpl-v10.html"));
} catch (IOException e) { } catch (IOException e) {
@ -227,7 +229,7 @@ public class AutoExtract implements ActionListener {
} }
} }
public static void main(String argv[]) { public static void main(String argv[]) throws HeadlessException, IOException {
// Verify that the Java version is version 6 (1.6.0) or newer // Verify that the Java version is version 6 (1.6.0) or newer
if (javaVersion.startsWith("1.") && javaVersion.charAt(2) < '5') { if (javaVersion.startsWith("1.") && javaVersion.charAt(2) < '5') {
final String message = "Robocode requires Java 6 (1.6.0) or newer.\n" final String message = "Robocode requires Java 6 (1.6.0) or newer.\n"
@ -242,7 +244,7 @@ public class AutoExtract implements ActionListener {
// Set native look and feel // Set native look and feel
try { try {
UIManager.setLookAndFeel(UIManager.getSystemLookAndFeelClassName()); UIManager.setLookAndFeel(UIManager.getSystemLookAndFeelClassName());
} catch (RuntimeException t) {// For some reason Ubuntu 7 can cause a NullPointerException when trying to getting the LAF } catch (Throwable t) {// For some reason Ubuntu 7 can cause a NullPointerException when trying to getting the LAF
} }
File suggestedDir; File suggestedDir;