Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
Javaコードからプログラムで絶対java.exeパスを見つけるに関連して、実行中のJavaプロセスが「java.exe」と「javaw.exe」として開始されたかどうかを知る方法はありますか?
ありがとう
VMに使用可能なコンソールがない場合(たとえば、javaw.exeで起動したため)、を呼び出すとSystem.console()nullが返されます。
System.console()
編集:すなわち、
final boolean amRunningJavaW = System.console() == null;