java 创建实例 方式
介绍 (Introduction)
I developed this SingleRun application to address a business requirement. The requirement called for a method to allow only one instance of an application, taking arguments into account, when a user clicked on a shortcut.
我开发了此SingleRun应用程序来满足业务需求。 该要求要求一种方法,当用户单击快捷方式时,该方法仅允许应用程序的一个实例(考虑参数)。
In addition to this, when the application is already running, clicking on shortcut should bring the application into focus.
除此之外,当应用程序已经在运行时,单击快捷方式应该使应用程序成为焦点。
Although I frequently use the application, it is a bit of a niche solution so sharing it, hoping that someone will find it useful.
尽管我经常使用该应用程序,但它还是一个小众解决方案,因此可以共享它,希望有人会发现它有用。
实作 (Implementation)
(
)
步骤1)下载Visual Studio项目 (Step 1) Download Visual Studio Project )
https://bitbucket.org/svermaak/singlerun/downloads/ (Source Code)
https://bitbucket.org/svermaak/singlerun/downloads/ (源代码)
http://blog.ittelligence.com/wp-content/uploads/2018/02/SingleRun.zip (Binary)
http://blog.ittelligence.com/wp-content/uploads/2018/02/SingleRun.zip (二进制)
Step 2) Save to a convenient location (C:\Program Files\SingleRun in this article)
步骤2)保存到方便的位置(本文中的C:\ Program Files \ SingleRun)
Step 3) Create a SingleRun shortcut. You can create a SingleRun shortcut with by one of two ways:
步骤3)建立 SingleRun快捷方式。 您可以通过以下两种方式之一来创建SingleRun快捷方式:
Method 1) Drag and drop
方法1)拖放
Method 2) Command line
方法2)命令行
SingleRun supports the following command line arguments:
SingleRun支持以下命令行参数:
SingleRun.exe scope workingfolder target arguments
SingleRun.exe作用域工作文件夹目标参数
scope: Computer or User
范围:计算机或用户
workingfolder: Working folder to change context to
workingfolder :将上下文更改为的工作文件夹
target: The path the application to star
目标:应用程序启动的路径
arguments: Argument of the target
参数:目标参数
演示执行 (Demo execution)
I hope you found this tutorial useful. You are encouraged to ask questions, report any bugs or make any other comments about it below.
希望本教程对您有所帮助。 鼓励您在下面提出问题,报告任何错误或对此作出任何其他评论。
Please do not forget to press the "Thumb's Up" button if you think this article was helpful and valuable for EE members.
如果您认为本文对EE成员有用且有价值,请不要忘记按“ Thumb's Up”按钮。
It also provides me with positive feedback. Thank you!
它还为我提供了积极的反馈。 谢谢!
翻译自: https://www.experts-exchange.com/articles/30439/SingleRun-Create-single-instance-shortcuts.html
java 创建实例 方式