Desktop.getDesktop.open() doesn't exit JVM after the call - java-8

I am opening a directory in Ubuntu 18.04 using Java 8 with the following code
Desktop.getDesktop().open(new File("\usr\local\share\mydir"));
It opens the directory but the program doesnt terminate unless I close mydir. Is this expected behaviour ? Can we terminate the program after the call to open() ?
Ive tried System.exit(0) right after the statment but it doesnt work.
I'm running the program from Eclipse .

Related

TortoiseSVN Hook Scripts No Longer Run

A while a go we set up a post_commit hook script in TortoiseSVN, this is a simple batch file, and this worked fine. We are running Windows 10.
Recently (around the beginning of 2023) this stopped working. TortoiseSVN now reports:
The hook script returned an error:
The process cannot access the file because it is being used by another process.
The script executes fine when run manually.
Changing the script to execute to another batch file or a program, results in the same message.
Does anyone have any suggestions?
Thanks,
Chris
Edit:
The hook script is client side and is configured as:
Working Copy Path:
C:\Temp\Repo
Command Line To Execute:
C:\Users\chris\SVNFeeder\testrepo_sync.bat
Wait for script to finish: True
Hide the script while running: False
Always execute the script: True
The batch file contains the following:
java -jar %USERPROFILE%/SVNFeeder/SvnFeeder.jar -c %USERPROFILE%/SVNFeeder/testrepo_configFile
The java file updates our Jira server with commit messages.
Changing the command line to execute the java file directly results in the same error, even a simple batch file that only creates a folder doesn't execute.
There is nothing wrong with the batch file or the java file as both execute fine outside of TSVN.
I have just found out that Sophos was blocking the execution of the script.
There was no mention of this in the events page, which didn't help track it down.

Virtual Studio Code - Getting the Terminal to pause after execute the program

I'm running my code in the external Terminal. When I get to the end of my program, the Terminal automatically closes.
Is there a way to keep it open, like the "pause" command on Windows?
Working on Windows as well
Thanks for the help

How to terminate a batch file

While this question has been asked before, I have not found the solution to my particular problem. I am trying to launch the windows calculator from a bat file. It launches the program but the console window remains open. Typing exit or exit /b, does not help. This is what the file looks like:
C:\Windows\System32\calc.exe
exit
I tried typing exit before the launch command. It works and the program is not launched. It is as though the very act of launching the program renders all succeeding instructions null and void.

when I run mongod --config "C:\Program files\MongoDB\Server\3.0\bin\mongodb.config" it repeats endlessly

mongod --config "C:\Program files\MongoDB\Server\3.0\bin\mongodb.config"
I don't know what else to say... I am startled and frustrated because that's something I've never seen before. Usually when there's error you get some message that you can analize and make it right. But I hit Enter and the line I typed gets looped and it looks like if I would press arrow-up key and Enter subsequently, except I don't. After a while I have to stop this and press ctrl + c to kill the job. Have anyone seen this behaviour? I am on windows 7 64bit.
Mongod.exe is in C:\Program files\MongoDB\Server\3.0\bin\ and this folder is in my PATH.
That happened today first time when I run the command from webstorm built-in terminal. When I run it in cmd it gets executed normally BUT when i put the command in .bat file and try to execute it - same sh*t happens even in cmd. ? I wish I would never switched back to Windows.
Your batch file is calling itself (remember that in windows the current active directory is implicitly included in the list of folders to search for executable files)
Rename the batch file to something different to mongod.bat or mongod.cmd or change the reference to the program to execute from mongod to mongod.exe. Any of this changes will avoid the batch file to call itself.

How to return an error code from a process that runs in another cmd window (windows)

I'm running a script from the cmd prompt. This script opens another cmd prompt and runs another batch file there. I want to wait for the error code and then send it back to the original cmd window. Is there a nice way to do this without writing the error code to a file?
Thanks,
Li
If I inderstand you correctly, you want this solution. It solves the problem of returning error level to the calling script from the script that was run in a separate cmd session.

Resources