All Questions
21
questions
4
votes
1
answer
6k
views
Equivalent of Java's String.getBytes() in Unix Shell (Cygwin)
Let's say I convert my string into byte array.
byte[] byte sUserID.getBytes(“UTF-8”); //Convert User ID String to byte array
Now I need to write a script on Shell that will have exactly the ...
4
votes
3
answers
2k
views
Monitoring progress/liveness of background jobs
I have started a background job. Is there a way to know how it is progressing, and whether it has stopped?
My command line is like:
java weka.classifiers.trees.J48 -t data.arff J48-data.model >&...
4
votes
1
answer
703
views
How do I execute in background / return early?
For reference, I'm using phpseclib to control a remote SSH server using the 'root' account.
I have to start/stop a java process which is ran in the background. Stopping works fine with killall java ...
3
votes
3
answers
3k
views
grep on a Java Method
Lets say I have a java class called DirectAction
some of the methods in the class have the word "action" or "Action"
What is the grep command to get the names of all the methods who have "Action" or ...
3
votes
2
answers
19k
views
Messed up bash.bashrc file, commands not working anymore
Trying installing Java, I tried to add it to the executable path with the line:
export PATH=/usr/lib/jvm/jdk1.7.0_60/bin:$PATH
in the system-wide /etc/bash.bashrc file.
For some reason this ...
2
votes
1
answer
2k
views
How to get binary representations of strings in Shell?
I'm using openssl dgst -sha1 -binary to get hash values of my strings in binary format.
(I'm using -binary flag because my version of openssl adds "stdout" before each hash value on default output, ...
1
vote
2
answers
967
views
Run jar on startup in all *nix based systems
I have a jar file which I need to run at startup in all distros of Linux. My previous question here, gave me an idea a rough idea on X-servers. Since I wasn't able to perform startup, I moved on to ...
1
vote
1
answer
154
views
How to output only required parameters in jstat command?
When running the following jstat command on a linux server, we get the following output.
$ jstat -gc $(pidof java)
S0C S1C S0U S1U EC EU OC OU MC MU ...
1
vote
1
answer
7k
views
Interactive Shell Session from Java
I want to run a series of commands from Java. I came across few forums that explain how to execute multiple commands using getRuntime().exec(command) and defining command as String[]. But I want to ...
1
vote
1
answer
106
views
How to kill an orphan Terminal process
I have a java program that executes several shell files (one by each iteration).
The shell file only has one command, start cross-gdb with a path to a gdbinit file.
The program works fine, but (from ...
1
vote
1
answer
4k
views
How to set a path variable without root acess? [duplicate]
My college currently uses a very old (like 3 years old) openJDK 1.7 distribution. And being a student, obviously I don't have root privileges. I wanted to use a much later version downloaded a much ...
1
vote
0
answers
39
views
Is it possible to create aliases that affect services starting?
Currently I have a custom service that executes java in multiple places.
I want to be able to add an option to any executions of java this service will spawn (I'm specifying the error log location, ...
0
votes
1
answer
367
views
bash file contain executable/binary code
I found this tool and when I downloaded it is a bash executable that contains binary code.
First of all I didn't know this is possible. Does anyone know who this can be done? Also I am not sure how ...
0
votes
1
answer
26
views
Which shell command returns Java's home path?
I'm aware of the which command but when I run it on Java, I get the following path:
$ which java
/bin/java
What I'm looking for, I think, is the Java path I get when I run the following Maven command:...
0
votes
2
answers
2k
views
systemd cannot find PID file after YAJSW wrapper startup
I have a systemd startup script for a forking service (let's call it foo) based on YAJSW (Yet Another Java Service Wrapper). The relevant part of the .service file looks like this:
ExecStart=/opt/foo/...
0
votes
1
answer
224
views
Which way is safer to read data from /sys
I am attempting to write a program that will monitor the temperature of various hardware components.
The language I chose for it is Java. Now there are two ways I could read the temperatures:
a) Do ...
0
votes
1
answer
2k
views
ansible and expect problem
I want to use expect tools in bash script by ansible. first, step my shell script. Checking for $JAVA_HOME variable. I set $JAVA_HOME but in Ansible, I get an error.
My env for $JAVA_HOME:
[root@...
0
votes
1
answer
17k
views
Any possibility to execute shell script from java file?
I have one Java file named app.java which extracts the servers in my application.
I need to connect to every server in that list and extract the logs. In loop, I have to call script for connecting to ...
0
votes
1
answer
422
views
how to get error from running shell script in java?
i'am using java to run shell script
it works great .
now i want to get errors from this script
for example i have a script and there is an error i want to get the line and a message of that error
...
0
votes
0
answers
294
views
Use FindBugs in Eclipse from terminal on Ubuntu
Is there any way I could use Findbugs from terminal to get all the bugs in my Java code and print it out to a text file?
I want to write a script that goes through 100 java files ( this is already ...
-1
votes
2
answers
155
views
How to get all the contents of df -h command as string
I want to have a CRON job which calls a Java program to send a mail if disk space is more than 80%.
Along with it, I want to send the contents of the df -h command also. What I did was create a ...