-
Notifications
You must be signed in to change notification settings - Fork 3
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
aborting startup when JAVA_HOME is not set. addresses issue #44
- Loading branch information
1 parent
566c8c0
commit 4d4d412
Showing
22 changed files
with
349 additions
and
65 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
6 changes: 6 additions & 0 deletions
6
backend/src/main/java/com/github/eostermueller/snail4j/DefaultJdkTools.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
package com.github.eostermueller.snail4j; | ||
|
||
public class DefaultJdkTools implements JdkTools { | ||
|
||
|
||
} |
11 changes: 11 additions & 0 deletions
11
backend/src/main/java/com/github/eostermueller/snail4j/DocumentationLinks.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
package com.github.eostermueller.snail4j; | ||
|
||
import java.net.MalformedURLException; | ||
import java.net.URL; | ||
|
||
public class DocumentationLinks { | ||
public URL getJdkInstallAdvice() throws MalformedURLException { | ||
return new URL("https://github.com/eostermueller/snail4j/wiki/JDK-Setup"); | ||
} | ||
|
||
} |
46 changes: 46 additions & 0 deletions
46
backend/src/main/java/com/github/eostermueller/snail4j/InstallAdvice.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,46 @@ | ||
package com.github.eostermueller.snail4j; | ||
|
||
import java.io.File; | ||
import java.net.MalformedURLException; | ||
import java.nio.file.Paths; | ||
|
||
import org.slf4j.Logger; | ||
import org.slf4j.LoggerFactory; | ||
|
||
import com.github.eostermueller.snail4j.launcher.CannotFindSnail4jFactoryClass; | ||
import com.github.eostermueller.snail4j.launcher.Messages; | ||
|
||
public class InstallAdvice { | ||
private final Logger LOGGER = LoggerFactory.getLogger(this.getClass()); | ||
|
||
/** | ||
* | ||
* @return | ||
* @throws CannotFindSnail4jFactoryClass | ||
* @throws MalformedURLException | ||
*/ | ||
public boolean isJavaHomeEnvVarOk() throws CannotFindSnail4jFactoryClass, MalformedURLException { | ||
boolean rc = false; | ||
|
||
Messages m = DefaultFactory.getFactory().getMessages(); | ||
|
||
String javaHome = System.getenv("JAVA_HOME"); | ||
if (javaHome == null) { | ||
LOGGER.error( m.javaHomeEnvVarNotSet() ); | ||
} else { | ||
File javaHomeFolder = Paths.get(javaHome).toFile(); | ||
if (!javaHomeFolder.exists() || !javaHomeFolder.isDirectory()) { | ||
LOGGER.error( m.javaHomeFolderDoesNotExist(javaHomeFolder) ); | ||
} else { | ||
rc = true; | ||
} | ||
} | ||
|
||
if (!rc) { | ||
LOGGER.error( new DocumentationLinks().getJdkInstallAdvice().toString() ); | ||
} | ||
|
||
return rc; | ||
} | ||
|
||
} |
5 changes: 5 additions & 0 deletions
5
backend/src/main/java/com/github/eostermueller/snail4j/JdkTools.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
package com.github.eostermueller.snail4j; | ||
|
||
public interface JdkTools { | ||
|
||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.