I can launch my app as standalone app (for example from command line) or one specific way -- it is directly "from" source code, i.e. using IntelliJ.
Is there a way to detect if app was launched from IntelliJ or not? Only this, binary decision.
Workarounds are plenty, adding extra option when launching, however I am looking for direct solution, like this for C# How to know that the application is launched by debugger (VisualStudio) C#
The solution can be valid for any IDE, but must be valid at least for IntelliJ.
Little update
For those (including me) seeking ready to use code (Scala code):
object ProgramInfo
{
val isStandaloneApp = sun.management.ManagementFactory.getRuntimeMXBean().getInputArguments.isEmpty
val isDebugMode = scala.collection.JavaConversions.iterableAsScalaIterable(sun.management.ManagementFactory.getRuntimeMXBean().getInputArguments).exists(it => it.startsWith("-agentlib"))
}
It won't work in complex cases, but if you don't pass ton of parameters to JVM, it's just fine.