I am using the following code to execute an SH file in Linux
Runtime.getRuntime().exec(new String[] { "/bin/sh", "-c", file.getPath() });
This code works however I can't use the screen command in the SH file when executing it from Java, I get this error
Must be connected to a terminal.
So is it possible to "connect" java to a terminal?
I'm trying to just execute the java command and it's saying it cannot be found, even though it is there.
I have this command inside a Bash shell script, the intention of which is to apply a java command, htmlcompressor, to each HTML file found in a directory:
find $DIR -type f -name '*.html' -exec java -jar $BASEDIR/Upload/htmlcompressor-1.5.3.jar --remove-intertag-spaces {} \;
However, while the output at the command line seems to indicate that it is finding each file and doing something with it,
I have a Java application I am deploying with Chef. I would like it to start, and allow the Chef client to exit.
I've created a package for my application that depends on openjdk-7-jre, problem is I also need to ensure it's launched with Java 7 (chances are Java 6 is still the default.) At present I have
Exec=java -jar Application.jar
...which will obviously just take the default Java install.
I am a newbie to linux. I am trying for a command which displays
pid, java class. I tried
ps -C java -o pid
but it only showed me pid but not java classes. I used another command
ps -ef | grep java"
It showed me full library JAR files and java classes associated with it.. But I don't need this.. I need only to display pid and java class.
so I started reading up on how to program in C++ yesterday, and at the end of the first section you end up with a hello world program.
I wrote the program in emacs and saved it as a .cpp file
I went to open it through the terminal and tried to change the CD to get to the folder it was saved in, the terminal returned that the directory didn't exist which is a complete load.
now, from the h
I know that to execute a file, I use the . command, then the file name with a space between them. But I'm trying to execute a .jar file using the . and it does not work. I went into the properties and marked it as executable and made it run with Java.
Is there a way to execute a file with Java in the Bash Terminal?
I am trying to execute the Minecraft.jar file.
I am creating a java software on linux ubuntu. I want to to open linux terminal from inside java, set commands to the terminal, execute the commands and then close the terminal. All these by clicking on a button in java. So in short, the user of my application will not need to know any linux commands. In fact my software consists of configuring linux ubuntu 12.04 as server from java.