Get current running class name - Java java.lang

Java examples for java.lang:Exception

Description

Get current running class name

Demo Code


//package com.java2s;

public class Main {


    public static boolean bootFromJunit() {
        StackTraceElement[] stacks = Thread.currentThread().getStackTrace();
        return stacks[stacks.length - 1].getClassName().contains("junit");
    }/*from   www.jav a 2s .  c o m*/
}

Related Tutorials