kill the java virtual machine with Runtime
Hi all
I m trying to set up something funny in my web site.
what I want to do is to let anyone stop the server, if someone sends a message on the site.
I tried the code below in a java application is and fedora. He did run, but did not kill the java process.
Could someone point out if I'm missing something?
Thank you.
{code}
String stopCmd = ' ps - ef | grep java | XARGS kill. "
System.out.println (stopCmd);
Duration rt = Runtime.getRuntime ();
RT.exec (stopCmd);
{/ code}
You must use the other form of exec() who accepts an array. You order must be
String[] stopCmd = {"/bin/bash", "-c", "ps -ef | grep java | xargs kill"};
Note the position of the citations - it is very important.
You should also read the article "Pitfalls" (when Runtime.exec () not - JavaWorld) and implement ALL the recommendations.
Tags: Java
Similar Questions
-
Could not create the Java virtual machine
Hello
I am using VM ware and installed Linux operating system.
In my MedRecDomain of Weblogic Admin Server to start and also to start MedRecSvr1.
But MedRecSvr2 & 3 do not stand up.
Details:
OS: Linux
Details of the JVM: JAVA memory arguments: -Xms512m-Xmx512m
WebLogic Version: 10.3.6
Please see the Journal as shown below,
[root@ram bin] #./startManagedWebLogic.sh MedRecSvr2 &
[1] 3194
[root@ram bin] #.
.
Arguments of memory in JAVA:-Xms512m-Xmx512m
.
Start mode of WLS = Production
.
CLASSPATH=/opt/labs/ows/wlshome/patch_wls1036/profiles/default/sys_manifest_classpath/weblogic_patch.jar:/opt/labs/ows/wlshome/patch_ocp371/profiles/default/sys_manifest_classpath/weblogic_patch.jar:/opt/labs/ows/wlshome/jrockit_160_29_D1.2.0-10/lib/tools.jar:/opt/labs/ows/wlshome/wlserver_10.3/server/lib/weblogic_sp.jar:/opt/labs/ows/wlshome/wlserver_10.3/server/lib/weblogic.jar:/opt/labs/ows/wlshome/modules/features/weblogic.server.modules_10.3.6.0.jar:/opt/labs/ows/wlshome/wlserver_10.3/server/lib/webservices.jar:/opt/labs/ows/wlshome/modules/org.apache.ant_ 1.7.1/lib/ant-all.jar:/opt/labs/ows/wlshome/modules/net.sf.antcontrib_1.1.0.0_1-0b2/lib/ant-contrib.jar:/opt/labs/ows/wlshome/wlserver_10.3/common/derby/lib/derbyclient.jar:/opt/labs/ows/wlshome/wlserver_10.3/server/lib/xqrl.jar
.
PATH=/opt/labs/ows/wlshome/wlserver_10.3/server/bin:/opt/labs/ows/wlshome/modules/org.apache.ant_1.7.1/bin:/opt/labs/ows/wlshome/jrockit_160_29_D1.2.0-10/jre/bin:/opt/labs/ows/wlshome/jrockit_160_29_D1.2.0-10/bin:/usr/lib/qt-3.3/bin:/usr/local/sbin:/usr/sbin:/sbin:/usr/local/bin:/usr/bin:/bin:/root/bin
.
***************************************************
* To start WebLogic Server, use a username and *.
* password assigned to an administrator-level user. For *.
* server administration, using the WebLogic Server *.
* console in http://hostname/ReportServer: port/console *
***************************************************
from weblogic with the Java version:
Java version "1.6.0_29".
Java (TM) SE Runtime Environment (build 1.6.0_29 - b11)
Oracle JRockit (R) (build R28.2.0-79-146777-1.6.0_29-20111005-1807-linux-ia32, update mode)
WLS starting with line:
/opt/labs/ows/wlshome/jrockit_160_29_D1.2.0-10/bin/java - jrockit-Xms512m-Xmx512m-Dweblogic.Name=MedRecSvr2-Djava.security.policy=/opt/labs/ows/wlshome/wlserver_10.3/server/lib/weblogic.policy-Dweblogic.ProductionModeEnabled=true-Dweblogic.security.SSL.trustedCAKeyStore=/opt/labs/ows/wlshome/wlserver_10.3/server/lib/cacerts-da-Dplatform.home=/opt/labs/ows/wlshome/wlserver_10.3-Dwls.home=/opt/labs/ows/wlshome/wlserver_10.3/server-Dweblogic.home=/opt/labs/ows/wlshome/wlserver_10.3/server-Dweblogic.management.discover=false-Dweblogic.management.server= http://10.0.2.15:7020 -Dwlw.iterativeDev=false-Dwlw.testConsole=false-Dwlw.logErrorsToConsole=false-Dweblogic.ext.dirs=/opt/labs/ows/wlshome/patch_wls1036/profiles/default/sysext_manifest_classpath:/opt/labs/ows/wlshome/patch_ocp371/profiles/default/sysext_manifest_classpath weblogic. Server
[ERROR] [memory] Could not commit 524288 KB memory heap at 0x95e09000.
Could not create the Java virtual machine.
Also, when the managed server stop also get the same question,
[root@ram bin] #./stopManagedWebLogic.sh MedRecSvr2
If you stop Weblogic Server...
[ERROR] [memory] Could not commit 524288 KB memory heap at 0x95e09000.
Could not create the Java virtual machine.
Fact
Stopping Server Derby...
Derby server stopped.
[root@ram ~] # cat/proc/meminfo
MemTotal: 511620 kB
MemFree: 5224 kB
Stamps: 760 kB
Caching: 20440 kB
SwapCached: 109492 kB
Active principles: 219424 kB
Inactive: 220788 kB
Active (Anon): 210272 kB
Inactive (Anon): 210408 kB
Active (leader): 9152 kB
Inactive (queue): 10380 kB
Unevictable: 0 kB
Mlocked: 0 kB
HighTotal: 0 kB
HighFree: 0 kB
LowTotal: 511620 kB
LowFree: 5224 kB
SwapTotal: 1048568 kB
SwapFree: 1516 KB
Sale: 12 KB
Writeback: 512 KB
AnonPages: 309740 kB
Mapped: 12684 kB
Shmem: 1628 kB
Slab: 48500 kB
SReclaimable: 12196 kB
SUnreclaim: 36304 kB
KernelStack: 2656 kB
PageTables: 9104 kB
NFS_Unstable: 0 kB
Bounce: 0 kB
WritebackTmp: 0 kB
CommitLimit: 1304376 kB
Committed_AS: 2210364 kB
VmallocTotal: 505912 kB
VmallocUsed: 5196 kB
VmallocChunk: 486476 kB
HugePages_Total: 0
HugePages_Free: 0
HugePages_Rsvd: 0
HugePages_Surp: 0
Hugepagesize: 2048 kB
DirectMap4k: 6080 kB
DirectMap2M: 518144 kB
Please help identify the problem.
Thnks in advance
Kind regards
Bouchra Arun
Web Site: http://www.industryvertical.co.in/
People,
This issue has been resolved,
Details of the problem:
RAM 512 MB only, use JVM parameters
"" Arguments of memory in JAVA: -Xms512m-Xmx512m ".
If WL struck to use more memory for the start and the stop MedRecSvr2, 3 (managed server)
Please read the following steps to correct,
1. open Oracle VM Virtual box
2. go to settings and select the system option (make sure that all OS turns off).
3. go in card mother in this window select Base memory previously is changed to 1920 MB (1.875 GB) 512 MB.
4. click on Ok.
Then the allocated RAM will be more, for Weblogic doesn't get knocked because of insufficient RAM memory.
Respect,
Bouchra Arun
Please Mark Helpful / good answer
-
Cannot create an instance of the java virtual machine
Hi when I try to launch my sql developer get this error
Cannot create an instance of the java virtual machine located in the path C:\Program Files\Java\jdk1.6.0_38\jre\bin\client\jvm.dll, but I do not have the file in the location
I'm trying to do
BI CHAOS: SQL Developer: cannot create an instance of the Virtual Machine Java
Cannot create an instance of the Virtual Machine Java
but am not able to locate file product.conf in my machine
OK, we lost time because you said never explicitly release of SQL Developer in use, and then, when I deduced this wrong, you went right with it, rather than correct me. Remember the line from Blade Runner when Harrison Ford hits Rutger Hauer in the head with a pipe? Than hurt!
Anyway, since the last post (because of the osgi references in the file ide.conf) I see that you are using a version 4.0.x of SQL Developer. You must update the file product.conf with the smallest Xmx value in order to create an instance of the JVM. If you have not yet found the product.conf file on your system, this might help: http://www.thatjeffsmith.com/archive/2013/12/oracle-sql-developer-4-windows-and-the-jdk/
Otherwise, ask someone in your organization COMPUTER help - keep in mind that AppData is one of those hidden Windows directories, so you'll have to tell explore to make it visible by the organize > Folder Options > view > hidden files and folders parameters. In addition, you should use Java 7, not Java 6 - try to get that upgrade to the latest version of jdk1.7.0_xx (currently 60, I think). Since you never said if your JDK is 32-bit or 64-bit, I can not say to use an AddVMOption, Add32VMOption or Add64VMOption.
Best wishes
Gary
Post edited by: Gary Graham
-
error osdm 'could not create the Java virtual machine.
Running Windows XP. Reports of SQL Developer Java (TM) Platform = 1.5.0_06
I downloaded and unpacked the liberation of the adopter early osdm, but when I double click on the osdm.exe, I get a dialog box titled "Java Virtual Machine Launcher" with the error:
could not create the Java virtual machine.
I don't know where to start to fix this problem.
Is there a newspaper, the trace file somewhere?
Need something specific in my path or environment variable set?Problem has been solved by reducing the maximum segment size Java (this parameter:-Xmx).
Xmx512M-Xms128M (Xms64M-Xmx512M-or)Published by: user736333 on October 31, 2008 08:52
-
is it a good idea to run the JAVA virtual machine inside the hypervisor?
If I want to write a global user inside the hypervisor platform and you want to reuse some java lib, it's a good idea to install and run the JAVA virtual machine as part of global programs of the user inside the hypervisor? Thank you.
Maybe you listen to the wrong people?
The ESXi hypervisor is pretty well stripped of the linux console you are talking about, there is a thin busybox linux like environment, but you are strongly advised not to run anything in there.
Performer of applications within this console may have all kinds of side effects such as severely affect the performance of your computer virtual guests.
Why the hell would you want to run the JAVA virtual machine inside the hypervisor? What is the reason why you want to do this? If it's because you get a better return, then you're wrong, the console becomes just a little bit of resources available on your host computer.
If this is to go directly to the features that the hypervisor provides then the VMA we're talking is the answer.
So getting back to your question initial for EACH use case that I can think it's a very bad idea.
--
Wil
-
Hello
Does anyone know of a document showing how to increase the number of the Java virtual machine for the oacore can be found in paragraph 12.1 EBS? I found a few google search dealer change the file opmn.xml but I would like to see a retailer who need references to changed.
Also it is often said that 1 jvm should be configured for each processor and best practices should be a 1 FMV must be configured for cpu 2. The effect of this rule processor type is valid for a risc processor and a processor intel.
Thank you
MikePlease see these documents.
Instructions for installation of the JVM in applications e-Business Suite 11i and R12 [362851.1 ID]
How to prevent idle connections JDBC Oracle applications [ID 427759.1]Thank you
Hussein -
CF 9.0.1 Solr does not have the Java virtual machine path
As part of the security of some of our machines for use of DoD, need to maintain the versions of Java. To do this, we install the latest JDK and use the server settings > Java and JVM > Machine way Java virtual to then tell CF to use it. We have done this since CF4 without any problems and when we moved to CF6 + we continued the process, but also after having what we then delete the folder of jre in runtime folder leave the CF is. Well I have just the program installation and installed my first CF9 + Win 2008 R2 server and after doing this the Solr service does not start. This had me so dig in its folder structure and it has its own folder of the jre in its folder structure as well. But using Sysinternals Process Monitor, I can see the service Solr uses NOT the folder of the jre from the inside it of own structure but is actually going up and 'try' to use the runtime\jre folder that I have deleted so it causes the service to fail. I can actually delete the solr\jre folder as long as the runtime\jre folder exist.
There are so many problems with this.
- SOLR has yet another installation of Java within itself
- SOLR does not use its own Java, even if there is a copy it
- SOLR does not respect the setting Java VM path together
Adobe has responded to my bug with the location of the solr configuration variable to point to the external JAVA virtual machine.
ColdFusion9\solr\solr.lax
Lax.nl.currentvm = JVM_PATH
It seems to work properly until now.
-
Deploy the new virtual machine with version 7 on vSphere HW 5
Hello
Is there a parameter / method of new virtual machines with the 7 deplpy (and NOT HW version 8) hardware on a vSphere host version 5?
We currently have a mixed cluster (vSphere 4.0 U2 & 5.0 U1 Hosts) with activated automatic DRS.
NB. I found that 1.5 vCloud Director boasts a version of VM HW (v7 or v8) framework that is useful for mixed clusters. I hope that vSphere itself may have a similar setting.
Yes, it is certainly possible. Simply select "Custom" in the "New VM" Wizard and you will be able to decide which version HW (7 or 8) you want to use for this virtual machine.
André
-
can not find the java virtual machine
I got an error message when you try to compile. At one point, he worked, but maybe I messed up one of the environment variables.
C:\Documents and Settings\jm > mxmlc
Error: could not find a JVM.To answer my own question and save people future pain. Under Windows, when Java is unable to find the virtual machine, you must do
Start > Control Panel > system > advanced > Environment Variables
and implement the variable user "java_home" to the JDK with oblique lines as follows:
C:/Program Files/Java/jdk1.6.0_06
You don't put ' / bin '. If you put Java into a different folder, you must change the java_home accordingly. Now I can move on with life.
-
Creation of the new virtual machine with DPM
I currently have DPM running on my cluster. I have a script that will automatically create VMS and deploy them for me. However, sometimes the implementation of the virtual machine is on a host that is on standby, and the script fails. How can I make sure that the script chooses a host that is powered on? I have the DrsAutomationLevel - value 'FullyAutomated' in my script. The code I use below, is what creates the virtual machine.
$vm= New-VM -name $Server_Name NumCPU - 1 -DiskMB 40960 -DrsAutomationLevel FullyAutomated MemoryMB - 2048 -ID 'winNetEnterpriseGuest' CD -:$true -data store $datastore -$vmhost $vmhost
I don't know what is the issue.
Hello, drwoodberry-
You can manage this first, getting a host that is in a connected state, then use this host for the parameter - VMHost to New - VM. So, as:
## get a VMHost that is connected$hostToUse = Get-Cluster myCluster | Get-VMHost | ?{$_.ConnectionState -eq "Connected"} | Get-RandomNew-VM -Name ..
.. -VMHost $hostToUse Enjoy.
-
How to install the files of the Java virtual machine for the macbook?
I want to know about the instalation of java Toolkit for macbook.
This is the place to learn about and download the JDK. http://www.Oracle.com/technetwork/Java/javase/downloads/index.html
-
How to change the path of the JAVA virtual machine for the domain?
Hello!
When I create a domain to use Sun JDK instead of BEA JRockit, it always uses the JRockit when I start the administration server.
I found that the problem is that the setDomainEnv.cmd after setting the JAVA_HOME to Sun JDK, he calls the % WL_HOME%\common\bin\commEnv.cmd.
The bumpers of commEnv.cmd the JAVA_HOME with BEA JRockit.
What should I do to use Sun JDK?
I don't want to manually edit the cmd file.
All entries would be appreciated.
Thank you
ShaikTry setting JAVA_VENDOR to 'Sun', before calling the startup script.
-
How to activate or install the java virtual machine?
http://www.Java.com/en/download/help/download_options.XML
-
I'm trying to start OUD 11.1.2.2.0 after a new installation on Windows 2008 Server (oud - setup.bat) and I see the following error. Any ideas?
[18/Apr / 2014:13:34:04-0600] category = gravity CORE = INFORMATION msgID = 132 msg = The Directory Server starts the configuration of the boot process
[18/Apr / 2014:13:34:05-0600] category = gravity CORE VIEW msgID = 458886 msg = directory = unified Oracle 11.1.2.2.0 (build 20131115153045Z, R1311150604) commissioning
[18/Apr / 2014:13:34:08-0600] category gravity = RUNTIME_INFORMATION = VIEW msgID = 20381717 msg = installation directory: C:\Oracle\Middleware\Oracle_OUD
[18/Apr / 2014:13:34:08-0600] category gravity = RUNTIME_INFORMATION = VIEW msgID = 20381719 msg = Instance directory: C:\Oracle\Middleware\asinst_1\OUD
[18/Apr / 2014:13:34:08-0600] category gravity = RUNTIME_INFORMATION = VIEW msgID = 20381713 msg = Information FMV: 1.8.0_05 - b13 by Oracle Corporation, architecture 32 bits, the size of the heap 652476416 bytes
[18/Apr / 2014:13:34:08-0600] category gravity = RUNTIME_INFORMATION = VIEW msgID = 20381714 msg = JVM Host: slc00dbh.us.oracle.com, running Windows Server 2008 6.0 x 86, size of 8177541120 bytes of physical memory, the number of available processors 2
[18/Apr / 2014:13:34:08-0600] category gravity = RUNTIME_INFORMATION = VIEW msgID = 20381715 msg = JVM Arguments: ' - Dorg.opends.server.scriptName = start - ds. "
Exception in thread "main" java.lang.ExceptionInInitializerError: a safety class is not found in this JAVA virtual machine for the following reason: sun.security.x509.CertAndKeyGen
to org.opends.server.util.Platform$ PlatformIMPL. < clinit > (Platform.java:132)
to org.opends.server.util.Platform. < clinit > (Platform.java:85)
at org.opends.server.util.CertificateManager.generateSelfSignedCertificate(CertificateManager.java:283)
at org.opends.server.admin.AdministrationConnector.createSelfSignedCertifIfNeeded(AdministrationConnector.java:703)
at org.opends.server.admin.AdministrationConnector.initializeAdministrationConnector(AdministrationConnector.java:182)
at org.opends.server.core.ConnectionHandlerConfigManager.initializeAdministrationConnectorConfig(ConnectionHandlerConfigManager.java:356)
at org.opends.server.core.DirectoryServer.initializeAdministrationConnector(DirectoryServer.java:2872)
at org.opends.server.core.DirectoryServer.startServer(DirectoryServer.java:1539)
at org.opends.server.core.DirectoryServer.main(DirectoryServer.java:9930)
C:\Oracle\Middleware\Oracle_OUD > java-version
Java version "1.8.0_05".
Java (TM) SE Runtime Environment (build 1.8.0_05 - b13)
The Client Java VM (build 25, 5 - b02, mixed mode, sharing)
I used the following jdk based on the matrix and it worked fine:
C:\Oracle\Middleware\Oracle_OUD>Java-version
Java version "1.6.0_24".
Java (TM) SE Runtime Environment (build 1.6.0_24 - b07)
The Client Java VM (build 19.1 - b02, mixed mode, sharing)
-
Create the new virtual machine using Java API vCloud
Hi guys,.
I am trying to create the new virtual machine in TIME, but I've stuck here. The API I'm using is vcloud-java-sdk - 1.0.jar.
Could you please show me a code snippet how to do this?
For now I do it like this:
RecomposeVAppParamsType recomposeVAppParamsType = new RecomposeVAppParamsType();
List the items < CompositionItemParamType > = recomposeVAppParamsType.getItem ();
ReferenceType vappTemplateVMRef = new ReferenceType();// ??? seems that new reference to the new virtual machine should be here. But how to create this VM
CompositionItemParamType compositionItemParamType = new CompositionItemParamType();
compositionItemParamType.setSource (vappTemplateVMRef);Items.Add (compositionItemParamType);
ReferenceType vAppRef is Vdc.getVdcByReference (vcloudClient, vdcRef) .getVappRefByName ("vApp_Websrv");.Vapp.getVappByReference (vcloudClient, vAppRef) .recomposeVapp (recomposeVAppParamsType);
One day before I played with Web Services SDK, which is much easier to understand. I was able to create the vApp and VMs in vSphere. Is it possible to import machines virtual vSphere to vCloud? Should what API I use for this?
Thank you
Hello
You cannot add a new empty virtual machine in a paralytic.
Instead, you can add a virtual machine from an existing vapp, vapptemplate.
To import a vsphere vm to vcloud.
Import vsphere vm as VAPP in vcloud. VMWVimserver-> importVmAsVApp()
The importation of vsphere vm, as vAppTemplate, in vcloud. VMWVimserver-> importVmAsVAppTemplate()
See also the example of ImportVmAsvAppTemplate.java, which is part of the vcloudjavasdk group.
Kind regards
Rajesh Kamal.
Maybe you are looking for
-
My username and password are filled correctly, but fail to enter the site. Why?
Gites explainatory!
-
How can I burn my pictures of my old yahoomail on a disc?
original title: burning photos I had files copied from my windows xp on my windows vista pc. How can I burn my pictures of my old yahoomail on a disc? My old photos are in a folder in yahoomail on my new vista pc.
-
Why the mouse keys does not work?
I would use MouseKeys in windows to use my keyboard as a mouse, but I was not able to get the function runs. I am able to activate the MouseKeys without any problem, but by pressing the keys on the numeric keypad does not move the pointer of the mous
-
How to get the current timestamp in C++ to the BB10 project
Please help me how to get the current timestamp in C++. Thanks for your help!
-
Site Studio contributor - friendly links
HelloI use Web folders mapped Url to expose my Contribution files as/content server / *.However, when I create the hyperlink, it uses the ID of the document to generate URLs from the side server. I would like to use the content instead of the file na