Start line:  
End line:  

Snippet Preview

Snippet HTML Code

Stack Overflow Questions
  * Copyright (c) SiteWhere, LLC. All rights reserved.
  * The software in this package is published under the terms of the CPAL v1.0
  * license, a copy of which has been included with this distribution in the
  * LICENSE.txt file.
 package com.sitewhere.version;
Used to access implementation class which is only included after Maven build.

public class VersionHelper {

Classname for Community Edition version information
	private static final String CE_CLASSNAME = "com.sitewhere.Version";

Classname for Enterprise Edition version information
	private static final String EE_CLASSNAME = "";

Hacky method of accessing a version file that is created at build time.

	public static IVersion getVersion() {
		Class<?> clazz;
		try {
			clazz = Class.forName();
catch (ClassNotFoundException e) {
			try {
				clazz = Class.forName();
catch (ClassNotFoundException ex) {
				throw new RuntimeException("Neither EE or CE version information was found on classpath.");
		try {
			IVersion version = (IVersionclazz.newInstance();
			return version;
catch (InstantiationException e) {
			throw new RuntimeException(e);
catch (IllegalAccessException e) {
			throw new RuntimeException(e);
New to GrepCode? Check out our FAQ X