Docker container didn't work after the <java> command - java

I start and attach a docker container, but nothing working after setting JDK.
Docker container didn’t work after the command.
ken#namenode:~$ docker start peaceful_babbage
peaceful_babbage
ken#namenode:~$ docker attach peaceful_babbage
root#1477050f192a:/#
root#1477050f192a:/# java -version
bash: java: command not found
root#1477050f192a:/# source /etc/profile
root#1477050f192a:/# echo $PATH
/usr/lib/jdk1.7.0_60/bin:/usr/lib/jdk1.7.0_60/jre/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin
root#1477050f192a:/# java -version
java version "1.7.0_60"
Java™ SE Runtime Environment (build 1.7.0_60-b19)
Java HotSpot™ 64-Bit Server VM (build 24.60-b09, mixed mode)
root#1477050f192a:/#
root#1477050f192a:/# java
Usage: java [-options] class [args…]
(to execute a class)
or java [-options] -jar jarfile [args…]
(to execute a jar file)
where options include:
-d32 use a 32-bit data model if available
-d64 use a 64-bit data model if available
-server to select the “server” VM
The default VM is server.
...
See http://www.oracle.com/technetwork/java/javase/documentation/index.html for more details.
^C
At this moment, I can’t do anything with this container. can’t kill the Java process either. Who can help me with this?

You can simply stop the container from the host :
docker stop peaceful_babbage

Related

"Client" Java Virtual Machine with jsvc [duplicate]

This question already has answers here:
Real differences between "java -server" and "java -client"?
(11 answers)
Closed 3 months ago.
jsvc has a -client option but it isn't available on my system:
/usr/bin/jsvc -help ...
...
-jvm <JVM name>
use a specific Java Virtual Machine. Available JVMs:
'server'
-client
use a client Java Virtual Machine.
-server
use a server Java Virtual Machine.
...
This seem to boil down to having library files in directory lib/client under JAVA_HOME -- but all I have is lib/server.
This directory does not exist on Arch Linux ARM aarch64 or macOS. Is that some separate install, or is jsvc simply wrong about the existence of such a VM in that place?
This is a lab box I haven't updated for awhile ... but it looks like recent JREs only have the "server" option:
C:\> java version "1.8.0_121"
Java(TM) SE Runtime Environment (build 1.8.0_121-b13)
Java HotSpot(TM) 64-Bit Server VM (build 25.121-b13, mixed mode)
c:\>java -help
Usage: java [-options] class [args...]
(to execute a class)
or java [-options] -jar jarfile [args...]
(to execute a jar file)
where options include:
-d32 use a 32-bit data model if available
-d64 use a 64-bit data model if available
-server to select the "server" VM
The default VM is server.
Also:
c:\Program Files\java\jdk-11.0.1>tree lib
Folder PATH listing for volume OS
Volume serial number is 00000051 4C32:5A1F
C:\PROGRAM FILES\JAVA\JDK-11.0.1\LIB
├───jfr
├───security
└───server
<= Look Ma! No "client"!

installation error for elasticsearch on windows7

I have been trying to setup elasticsearch in windows7 machine by following https://www.elastic.co/guide/en/elasticsearch/reference/current/_installation.html
I was able to download, unzip but when running ./elasticsearch, I get the below error,
Error: Could not find or load main class
org.elasticsearch.tools.JavaVersionChecker
Elasticsearch requires at least Java 8 but your Java version from C:\Program
Files\Java\jdk1.8.0_131/bin/java does not meet this requirement
I have verified Java versions installed and they look fine,
$ java -version
java version "1.8.0_131"
Java(TM) SE Runtime Environment (build 1.8.0_131-b11)
Java HotSpot(TM) 64-Bit Server VM (build 25.131-b11, mixed mode)
$ javac -version
javac 1.8.0_131
Can someone point out where I am wrong ?
In run Elasticsearch in Windows, you should run with elasticsearch.bat not ./elasticsearch directly:
And now we are ready to start our node and single cluster (Windows users should run the elasticsearch.bat file):
Seems like you don't have right permissions. Try to set them to 774 and check again:
sudo chmod 774 -R elasticsearch-6.3.2/

java 7 command usage issue

I am getting:
java version "1.7.0_55" Java(TM) SE
Runtime Environment (build 1.7.0_55-b13)
Java HotSpot(TM) 64-Bit Server VM (build 24.55-b03, mixed mode)
Usage: java [-options] class [args...]
(to execute a class) or java [-options] -jar jarfile [args...]
(to execute a jar file)
where options include:
-d32 use a 32-bit data model if available
e.t.c
Can someone please tell me if you see some java options/arguments that don't belong in the java 7 command (options placed in new line for perspicuity):
"C:\Program Files\Java\jdk1.7.0_55\bin\java"
-server
-XX:+AggressiveOpts
-showversion
-XX:MaxPermSize=256m
-XX:+HeapDumpOnOutOfMemoryError
-Xmx512m
-Dcom.sun.jini.reggie.initialUnicastDiscoveryPort=4169
-Dcom.gs.deploy=C:\gigaspaces-xap-premium-9.7.1-ga-b10800/deploy
-DagentId=
-DgsaServiceID=
-DenableDynamicLocators=
-Xbootclasspath/p:"C:\gigaspaces-xap-premium-9.7.1-ga-b10800\tools\groovy\bin\..\..\..\\lib\platform\xml\*"
-cp ;"C:\gigaspaces-xap-premium-9.7.1-ga-b10800\tools\groovy\bin\..\..\..\";"C:\gigaspaces-xap-premium-9.7.1-ga-b10800\tools\groovy\bin\..\..\..\\lib\platform\sigar\*;";"C:\gigaspaces-xap-premium-9.7.1-ga-b10800\tools\groovy\bin\..\..\..\\lib\platform\boot\gs-boot.jar";
-Dsun.rmi.dgc.client.gcInterval=36000000
-Dsun.rmi.dgc.server.gcInterval=36000000
-Djava.rmi.server.hostname=""SOMEONE-PC""
-Djava.rmi.server.RMIClassLoaderSpi=default
-Djava.rmi.server.logCalls=false
-Dcom.gs.jini_lus.locators=null
-Dcom.gs.jini_lus.groups=me
-Dcom.gs.logging.debug=false
-Djava.util.logging.config.file="C:\gigaspaces-xap-premium-9.7.1-ga-b10800\tools\groovy\bin\..\..\..\/config/gs_logging.properties"
com.gigaspaces.start.SystemBoot
com.gigaspaces.start.services=\"GSA\"
gsa.gsc 0 gsa.global.gsm 0 gsa.lus 1
It was some issue with this part in the path:
\tools\groovy\bin\..\..\..\
changing those arguments made it possible to run the command in java 7.
Cheers!

How I can play with EC2 API tools?

I'm getting the error to run the script "ec2-describe-regions"
$ec2-describe-regions
/usr/local/ec2/ec2-api-tools-1.6.14.1/bin/ec2-cmd: line 62: /usr/lib/jvm/java-7-openjdk-amd64/jre/bin/java/bin/java: Not a directory
Before it, I did followings:
Open a terminal on my personal computer.
Install Java.
Create security credentials (an X.509 certificate and private key).
Set up a few environment variables.
Run my first command.
Here is the information I did:
$which java
/usr/bin/java
$echo $EC2_HOME
/usr/local/ec2/ec2-api-tools-1.6.14.1
$echo $JAVA_HOME
/usr/lib/jvm/java-7-openjdk-amd64/jre/bin/java
$java -version
java version "1.7.0_55"
OpenJDK Runtime Environment (IcedTea 2.4.7) (7u55-2.4.7-1ubuntu1)
OpenJDK 64-Bit Server VM (build 24.51-b03, mixed mode)
Try the following:
mv /usr/bin/java /usr/bin/java.orig
ln -s /usr/lib/jvm/java-7-openjdk-amd64/jre/bin/java /usr/bin/java
You may have two or more java instances on your server. Make sure you use the same java executable where your JAVA_HOME points to.
This command uses the old CLI tools, i'd recommend you use the new, unified and greatly improved CLI:
https://aws.amazon.com/cli/

Run remote java server in linux script

I have a Server implemented in Java named Provider, and linux script to start it.
#!/bin/bash
echo "Provider"
$JAVA_HOME/bin/java -cp /tmp Provider&
$JAVA_HOME/bin/java -version
rm /tmp/pid
echo "$!"> /tmp/pid
echo "Provider-finish"
exit 0
When I want to execute the following script at different machine (machine2)
root#machine1:/tmp# ssh machine2/tmp/runScript.sh
Provider
java version "1.6.0_29"
Java(TM) SE Runtime Environment (build 1.6.0_29-b11)
Java HotSpot(TM) Client VM (build 20.4-b02, mixed mode, sharing)
Provider-finish
Waiting for connection
The problem is that after running above script, it does not return console, it hang-up though Provider gets started.
I have analized similar concepts like Glassfish domain starting. by executing
ssh machine2 asadmin start-domain
it returns console without any problem so I can get execution status "$?"
I think that the problem is that the remote sshd won't close the ssh session because there is still a java process running in the background that might try to write output.
Try redirecting the background processes stdout and stderr to "/dev/null"; e.g.
$JAVA_HOME/bin/java -cp /tmp Provider > /dev/null 2>&1 &

Categories