- How To Enable Javascript In Mac
- An Executable Bash Script In Mac For Running A Java Program In Terminal
Active5 years, 10 months ago
Java is meant to be cross platform, and running a shell script would limit its use to just UNIX. With that said, it's definitely possible to run a shell script from within Java. You'd use exactly the same syntax you listed (I haven't tried it myself, but try executing the shell script directly, and if that doesn't work, execute the shell itself. Replace /path/to/srcds by the path where you installed the program (the directory where the srcds_run executable is). If you use a Windows editor to edit the script, make sure to tell it to use Unix (LF) line endings; Windows (CRLF) line endings won't work. Edit Article How to Compile & Run Java Program Using Command Prompt. In this Article: Article Summary Compiling and Running Troubleshooting Community Q&A While many programming environments will allow you to compile and run a program within the environment, you can also compile and run using Command Prompt.
I want to launch a java program (server program) at computer startup. I can run it from the command line perfectly.
- Hello, World in Java on Mac OS X This documents instructs you on how to setup a Java programming environment for your Mac OS X computer and provides a step-by-step guide to creating, compiling, and executing a Java program. We assume you are running at least OS X 10.2.3. Try running your program with the command line.
- To run a shell script, you need to make the file executable, which you can do with chmod +x In Ubuntu, the current directory is not the program search path, so you need to run./, not.
I created
/Library/Server/startFS.sh
. The file is executable by root and contains:I can't get my
launchd .plist
included here, the formatting is all off. I can run it fine from the command line:
./startFS.sh
, but when I put create the plist (via Lingon), nothing happens.Now, when run, it outputs a few lines to the console. Might that be problem?
I have tried prepending
Jawanohup
and appending &
, but no combination seems to work.3,21988 gold badges2424 silver badges3535 bronze badges
![Mac Mac](/uploads/1/2/4/8/124803276/802600813.jpg)
emdemd
1 Answer
How To Enable Javascript In Mac
Save a property list like this as /Library/LaunchAgents/some.label.plist:
Make sure the file is owned by root. If it is not, it can be loaded without sudo, but it is not loaded automatically at login. Then log out and back in to test if the program was started.
For more information, see
LriLriman launchd.plist
, the Daemons and Agents tech note, or http://osxnotes.net/launchd.html.An Executable Bash Script In Mac For Running A Java Program In Terminal
32.6k55 gold badges9595 silver badges135135 bronze badges