I have a Java program that runs a batch file on Windows with Runtime.getRuntime().exec() using the following command:  cmd /C start "Title" "C:\Folder\file.bat"   The Java program ends quickly since cmd /C carries out the command and then terminates (1) and start "Title" "C:\Folder\file.bat" starts the batch script (2). Thus the process (the batch file) will continue running independently.  Now, suppose that I have an shell script (e.g. file.sh), which I want to launch from Java and has a similar behavior. How could it be the equivalent command (3) in Linux?     Notes   See  See  The title ("Title") is not required.
123729
I am trying to add terminal as external tool to compile javascript with node.js. I am following this  which is based on windows , and i am stuck at figuring out location of terminal application.  Where is the terminal located in Ubuntu?
12229
How can I check if an application is running from a batch (well cmd) file?  I need to not launch another instance if a program is already running. (I can't change the app to make it single instance only.)  Also the application could be running as any user.
10858
I'm firing off a Java application from inside of a C#  console application. It works fine for the case where the Java application doesn't care what the "default" directory is, but fails for a Java application that only searches the current directory for support files.  Is there a process parameter that can be set to specify the default directory that a process is started in?
27331
I looking into writing my own init.d scripts to control several services running on my Linux server. I came across an example online which contained:  nohup $EXEC_SCRIPT 0&lt;&amp;- &amp;&gt; $LOG_FILE &amp; echo $! &gt; $PID_FILE   From what I understand:   nohup Catches the hangup signal  $EXEC_SCRIPT is a variable containing the command to be run  0&lt;&amp;- &amp;&gt; Not come across this before $LOG_FILE similar to $EXEC_SCRIPT but contains the log file path &amp; starts logging to $LOG_FILE in the background? $! is the PID of the most last background command &gt; writes the result of $! to the $PID_FILE   I can work through it with this knowledge but the 0&lt;&amp;- &amp;&gt; is completely throwing me off. I don't like to include things that I don't at least partially understand first.
89847
I have a setup.bat file which install some applications and i want to execute it.  This is content of .bat file :  @echo off cls Rip_7z.exe x Rip0.7z cls del Rip0.7z cls Rip_7z.exe x Rip1.7z cls del Rip1.7z   I think the Rip_7z.exe file extracts the Rip0.7z and Rip1.7z files and builds the app.   How can I do this in the Ubuntu 11.04 Terminal?
119201
Can a Java application be loaded in a separate process using its name, as opposed to its location, in a platform independent manner?  I know you can execute a program via ...  Process process = Runtime.getRuntime().exec( COMMAND );   ... the main issue of this method is that such calls are then platform specific.   Ideally, I'd wrap a method into something as simple as...  EXECUTE.application( CLASS_TO_BE_EXECUTED );   ... and pass in the fully qualified name of an application class as CLASS_TO_BE_EXECUTED.
69550
I'm trying to find a way to get my own PID from a command prompt (for later use in bat scripts).  So far the only useful way I found was to use getpids.exe from here : , but I'm looking for a command that's "built in" to Windows.  I'm looking for a "bullet proof" way. No assumptions about my process being the only cmd.exe or anything.
87353
There's suppose any application installed in c:\program files\program.exe  How do I run this program by simply going to Start --> Run --> program.exe  I tried setting environment variable but that didn't help  I know programs like notepad and cmd run from Start --> Run cause they are there in the system32 folder. But how do I run an app which is not there?   EDIT:  This is what I did on windows xp:  Right click My Computer --> Properties --> advanced --&gt;environment variables--&gt;user variables for administrator--&gt;new--&gt;"variable name"&amp;"variable value"`. In variable value I put the path and in variable name I put an alias for the program Is what I did correct?
7089
I often find myself opening an SSH session to run the same single command. I have everything setup to login without entering a password (Via SSH Key-Based Auth), so I wondered if there was a way to create a shortcut or a batch file in Windows that would load PuTTY or a similar program, then fire off that command (and likely exit if result is good).
35006
I wrote a bash script that executes a Java jar for a n number of times.  In practice, I defined e foo() function, containing the invocation of the jar, and then I run this script:  for RUN in $(seq 1 $RUNS)  do      foo &amp;  done   Now, I would like to not execute runs times in parallel the jar. There is a wait to limit the number of parallel execution (like a wait every 10 process for instance)?
92098
When a java based application starts to misbehave on a windows machine, you want to be able to kill the process in the task manager if you can't quit the application normally. Most of the time, there's more than one java based application running on my machine. Is there a better way than just randomly killing java.exe processes in hope that you'll hit the correct application eventually?  EDIT: Thank you to all the people who pointed me to Sysinternal's Process Explorer - Exactly what I'm looking for!
96977
Say I have a file called calc.exe ( for example).  When I go to CMD and I run calc.exe it runs  because Windows has PATH settings in its environment variables.  Path information is  also accessible via typing path in cmd. ( as we all know).  Question  But - Is there any command in cmd that shows me information like this :   c:\&gt; locate_Where_It_Will_run_From calc.exe   Response :   c:\windows   I mean , the only solution which I see now is to run :   dir /s  calc.exe   And then to match results with the PATH information .  Is there any such command which will show me the information of my example above ?
98860
I have a batch file which I use to create an .apk file on my Windows machine. Now I need to be able to create the .apk file in Ubuntu but I don't know how translate my .bat file to a script to be able to run it on Ubuntu.  Below is the batch file which works fine on Windows.  Will you please give me some hints on how I can run it on Ubuntu?  @echo off set PAUSE_ERRORS=0 :user_configuration  :: Path to Flex SDK  set FLEX_SDK=C:\sdk\flex_sdk_4.5.1.21328  :: Path to Android SDK set ANDROID_SDK=C:\sdk\android  :validation if not exist "%FLEX_SDK%\bin" goto flexsdk if not exist "%ANDROID_SDK%\platform-tools" goto androidsdk goto succeed  :validation if not exist "%FLEX_SDK%\bin" goto flexsdk if not exist "%ANDROID_SDK%\platform-tools" goto androidsdk goto succeed  :flexsdk echo. echo ERROR: incorrect path to Flex SDK echo. if %PAUSE_ERRORS%==1 pause exit  :androidsdk echo. echo ERROR: incorrect path to Android SDK in 'bat\SetupSDK.bat' echo.  if %PAUSE_ERRORS%==1 pause exit  :succeed set PATH=%PATH%;%FLEX_SDK%\bin set PATH=%PATH%;%ANDROID_SDK%\platform-tools  :: Android packaging set AND_CERT_NAME="PeymanApp" set AND_CERT_PASS=fd set AND_CERT_FILE=cert\SampleApp.p12 set AND_ICONS=icons/android  set AND_SIGNING_OPTIONS=-storetype pkcs12 -keystore "%AND_CERT_FILE%" -storepass     %AND_CERT_PASS%  :: Application descriptor set APP_XML=application.xml  :: Files to package set APP_DIR=bin set FILE_OR_DIR=-C %APP_DIR% .  :: Your application ID (must match &lt;id&gt; of Application descriptor) set APP_ID=air.com.doitflash.SampleApp  :: Output packages set DIST_PATH=dist set DIST_NAME=PeymanApp  :validation %SystemRoot%\System32\find /C "&lt;id&gt;%APP_ID%&lt;/id&gt;" "%APP_XML%" &gt; NUL if errorlevel 1 goto badid goto end_validation  :badid echo. echo ERROR: Application ID (APP_ID) does NOT match Application descriptor '%APP_XML%'     (id)  echo.  :end_validation  set TARGET= set PLATFORM=android  ::call bat\Packager.bat if "%PLATFORM%"=="android" goto android-config  :android-config set CERT_FILE=%AND_CERT_FILE% set SIGNING_OPTIONS=%AND_SIGNING_OPTIONS% set ICONS=%AND_ICONS% set DIST_EXT=apk set TYPE=apk goto start  :start if not exist "%CERT_FILE%" goto certificate :: Output file set FILE_OR_DIR=%FILE_OR_DIR% -C "%ICONS%" . if not exist "%DIST_PATH%" md "%DIST_PATH%" set OUTPUT=%DIST_PATH%\%DIST_NAME%%TARGET%.%DIST_EXT% :: Package  echo true echo. call adt -package -target %TYPE%%TARGET% %OPTIONS% %SIGNING_OPTIONS% "%OUTPUT%"     "%APP_XML%" %FILE_OR_DIR% -extdir lib/ echo. if errorlevel 1 goto failed goto end  :certificate echo Certificate not found: %CERT_FILE% echo.  if %PAUSE_ERRORS%==1 pause exit  :failed echo APK setup creation FAILED.  if %PAUSE_ERRORS%==1 pause exit  :end
97449
I want to write the Ubuntu analogue of a "batch file" (a shell script). But I don't know how to use chmod +x filename command to make it so that the script can be run. Nor do I know where to use it.
5205
My problem is that in Windows, there are command line windows that close immediately after execution. To solve this, I want the default behavior to be that the window is kept open. Normally, this behavior can be avoided with three methods that come to my mind:   Putting a pause line after batch programs to prompt the user to press a key before exiting Running these batch files or other command line manipulating tools (even service starting, restarting, etc. with net start xy or anything similar) within cmd.exe(Start - Run - cmd.exe) Running these programs with cmd /k like this:  cmd /k myprogram.bat   But there are some other cases in which the user:   Runs the program the first time and doesn't know that the given program will run in Command Prompt (Windows Command Processor) e.g. when running a shortcut from Start menu (or from somewhere else), OR Finds it a little bit uncomfortable to run cmd.exe all the time and doesn't have the time/opportunity to rewrite the code of these commands everywhere to put a pause after them or avoid exiting explicitly.   I've read  about changing default behavior of cmd.exe when opening it explicitly, with creating an  and manipulating its content in these locations:  HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Command Processor\AutoRun HKEY_CURRENT_USER\SOFTWARE\Microsoft\Command Processor\AutoRun   (The AutoRun items are _String values_...)  I put cmd /d /k as a value of it to give it a try, but this didn't change the behaviour of the stuffs mentioned above at all... It just changed the behaviour of the command line window when opening it explicitly (Start-Run-cmd.exe).   So how does it work? Can you give me any ideas to solve this problem?
65023
how to create a shortcut for a exe from a batch file.  i tried   call link.bat "c:\program Files\App1\program1.exe" "C:\Documents and Settings\%USERNAME%\Desktop" "C:\Documents and Settings\%USERNAME%\Start Menu\Programs" "Program1 shortcut"   but it did not worked.  link.bat can be found at
24998
I would like to know how to write the Exec command of a .desktop file to open a new terminal and execute a shell script in it. The shell script is working and accessible by all users. When launching the script from the terminal everything works, but it doesn't when trying to launch the script from a .desktop file.  Here are some combinations I have already tried:  Exec=gnome-terminal -x sh -c 'echo hello' Exec=sh -c 'gnome-terminal echo hello' Exec=sh -c 'echo hello' Exec=echo hello   The .desktop terminal option is set to true.