Commit 1114b79e authored by R.W.Majeed's avatar R.W.Majeed

Determine version number if running from jar

parent cbca8daf
......@@ -26,11 +26,15 @@ import java.io.File;
import java.io.IOException;
import java.io.InputStream;
import java.util.ArrayList;
import java.util.List;
import java.util.Properties;
import java.util.function.Consumer;
import java.util.logging.Logger;
import javax.swing.JOptionPane;
import de.sekmi.histream.Extension;
import de.sekmi.histream.Observation;
import de.sekmi.histream.ObservationFactory;
......@@ -126,8 +130,19 @@ public class RunConfiguration implements Closeable{
return p;
}
private static final String readVersion() throws IOException{
InputStream inputStream = RunConfiguration.class.getClassLoader().getResourceAsStream("META-INF/maven/de.sekmi.histream/histream/pom.properties");
Properties props = new Properties();
props.load(inputStream);
return props.getProperty("version","[unknown]");
}
public static void main(String args[])throws Exception{
System.out.println("HIStream starting");
if( System.console() == null ){
JOptionPane.showMessageDialog(null, "This program should be run with a console", "HIStream "+readVersion(), JOptionPane.WARNING_MESSAGE);
return;
}
System.out.println("HIStream "+readVersion()+" starting");
long millis = System.currentTimeMillis();
Configuration conf = Configuration.fromFile(new File("src/test/resources/histream.xml"));
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment