Reminding for Stupid Admin

Many poeple don’t like to read decription, documentation and other notes from developers which was wrote for their. This code blocks any runs the application if Java specification version is not the same that required. Also, for Game Server case added notification about Java model x32/x64 for avoid problems with memory overflow.

### Eclipse Workspace Patch 1.0
#P aCis_gameserver
Index: java/net/sf/l2j/gameserver/GameServer.java
===================================================================
--- java/net/sf/l2j/gameserver/GameServer.java	(revision 100500)
+++ java/net/sf/l2j/gameserver/GameServer.java	(working copy)
@@ -123,6 +123,12 @@
 	
 	public GameServer() throws Exception
 	{
+		if (!System.getProperty("java.specification.version").equals("1.8"))
+		{
+			System.out.println("This application require Java 8. Please update your Java version.");
+			System.exit(1);
+		}
+		
 		// Create log folder
 		new File("./log").mkdir();
 		new File("./log/chat").mkdir();
@@ -138,6 +144,12 @@
 			LogManager.getLogManager().readConfiguration(is);
 		}
 		
+		if (!System.getProperty("sun.arch.data.model").equals("64"))
+		{
+			StringUtil.printSection("Notification");
+			_log.info("This application require Java 8 64-Bit. Please update your Java model to avoid memory overflow errors.");
+		}
+		
 		StringUtil.printSection("aCis");
 		
 		// Initialize config
Index: java/net/sf/l2j/loginserver/LoginServer.java
===================================================================
--- java/net/sf/l2j/loginserver/LoginServer.java	(revision 100500)
+++ java/net/sf/l2j/loginserver/LoginServer.java	(working copy)
@@ -38,6 +38,12 @@
 	
 	public LoginServer() throws Exception
 	{
+		if (!System.getProperty("java.specification.version").equals("1.8"))
+		{
+			System.out.println("This application require Java 8. Please update your Java version.");
+			System.exit(1);
+		}
+		
 		// Create log folder
 		new File("./log").mkdir();
 		new File("./log/console").mkdir();

This example was written for last aCis sources, but can adapt for any L2J. Have fun!

Note: If you copy/paste info from my blog to the another resource, then add link to this page.

Advertisements

Leave a Reply

Please log in using one of these methods to post your comment:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s