All Downloads are FREE. Search and download functionalities are using the official Maven repository.

com.ociweb.FogLight Maven / Gradle / Ivy

Go to download

FogLight is a lightweight runtime that enables makers of all ages and skill levels to create highly performant apps for embedded devices like Raspberry Pi's.

The newest version!
package com.ociweb;

import java.io.IOException;
import java.io.InputStream;
import java.util.Properties;

import com.ociweb.iot.maker.FogRuntime;
import com.ociweb.iot.maker.FogApp;

public class FogLight {
	
	public static void main(String[] args) {
		
		InputStream stream = Thread.currentThread()
		      .getContextClassLoader()
		      .getResourceAsStream("FogLight.props");
		if (null==stream) {
			System.err.println("unable to launch FogLight, can not find launch properties resource");
		} else {
			
			try {
				Properties p = new Properties();
				p.load(stream);

				String className = p.getProperty("main");
				if (null==className) {
					System.err.println("unable to launch FogLight, can not find main in launch properties resource");
				} else {
				
					try {
						
						Class clazz = Class.forName(className);					
						FogRuntime.run((FogApp) clazz.newInstance(),args);
						
					} catch (ClassNotFoundException e) {
						System.err.println("unable to launch FogLight, can not find class listed in launch properties resource");
						e.printStackTrace();
					} catch (InstantiationException e) {
						e.printStackTrace();
					} catch (IllegalAccessException e) {
						e.printStackTrace();
					}
				}
				
			} catch (IOException e) {
				System.err.println("unable to launch FogLight, can not read launch properties resource");
				e.printStackTrace();
			}
			
			
		}
		
	}

}




© 2015 - 2025 Weber Informatics LLC | Privacy Policy