Linux command to get current value of java.io.tmpdir - unix

I need a Linux command to get current value of java.io.tmpdir
Also can you tell me the command to get all the system propeties.

JDK provides tools with which you can achieve your goal. Using the specified command, you can display the value of a system variable java.io.tmpdir.
jinfo <process id> | grep "java.io.tmpdir"
The <process id> is the number of the java process for which you want to display the value of the system variable. Id of the java process you can get by using the jps tool, which list all java processes running on your machine.
To see all system variables of the java process, please use this command
jinfo <process id>
All JDK tools are located in $JAVA_HOME/bin directory.
java.io.tmpdir is one of java system properties, so its value exists only inside jvm. To find out what is the value of java.io.tmpdir property you can also write a simple program in java. It may look something like this piece of code:
public class JSystemProperties {
public static void main(String[] args) {
System.getProperties().list(System.out);
}
}
The code above will print all java system properties, but you can modify this to print only one system property with name you pass through args array (using System.getProperty(key) method). After you compile this class you can create script (which will run compiled java class) that can be treated as Linux command to get current values of java system properties.

For black box Java applications I've deployed in the past, I have sometimes been able to find the value of java.io.tmpdir by executing the following command:
ps -ef | grep java.io.tmpdir
Particularly with tomcat apps, you may get an output like this:
-Djava.io.tmpdir=/usr/local/tomcat/temp

For temp dir: there is a good answer here.
For all environment variable, try env command.

Recommended tool now is jcmd, use it like :
jcmd $pid VM.system_properties | grep java.io.tmpdir

Related

Why does deno's exec package execute commands without outputting messages to the terminal?

import { exec } from "https://deno.land/x/exec/mod.ts";
await exec(`git clone https://github.com/vuejs/vue.git`)
when i use git clone https://github.com/vuejs/vue.git in .sh file, It has message in terminal,
but don't have in deno
First, I think it is important to echo what jsejcksn commented:
The exec module is not related to Deno. All modules at https://deno.land/x/... are third-party code. For working with your shell, see Creating a subprocess in the manual.
Deno's way of doing this without a 3rd party library is to use Deno.run.
With that said, if you take a look at exec's README you'll find documentation for what you're looking for under Capture the output of an external command:
Sometimes you need to capture the output of a command. For example, I do this to get git log checksums:
import { exec } from "https://deno.land/x/exec/mod.ts";
let response = await exec('git log -1 --format=%H', {output: OutputMode.Capture});
If you look at exec's code you'll find it uses Deno.run under the hoods. If you like exec you can use it but you might find you like using Deno.run directly instead.

Setting environment variables in jupyter hub

I followed approach in this thread. I can easily set env variable in jupyter hub using the %env VAR = 5. However, when I try to print out this variable in the terminal I get only a blank line, as if the variable did not exist at all. Is it somehow possible to be able to print in terminal the env var defined in the notebook?
Setting environment variables from the notebook results in these variables being available only from that notebook.
%env VAR=TEST
import os
print(os.environ["VAR"])
...
>>> TEST
If you want to persist the variable, you need to put it either in the kernel.json file, or in systemd service file for jupyterhub, or in something like ~/.bashrc.
JupyterHub has a jupyterhub_config.py file (e.g. located in /etc/jupyterhub/jupyterhub_config.py) which can be used to control various aspects of the hub and the notebook environment.
In order to make a specific environment variable available to all notebooks on the hub, add the following lines to it:
c.Spawner.environment = {
'VAR': 'Test'
}
and restart the JupyterHub service (something like sudo service jupyterhub restart).
P.S. If you would just like to forward an environment variable from the user's environment, there is also
c.Spawner.env_keep = ['VAR']
Following from #leopold.talirz's answer, for those wanting to modify an environment variable without overwriting it (i.e. append a path to the PATH variable), I found you can do something like the following,
import os
original_path = os.environ['PATH']
c.Spawner.environment = {
'PATH': '/path/to/foo:{}'.format(original_path)
}
NOTE: In my case, I'm working with The Littlest JupyterHub, so I put the above in /opt/tljh/config/jupyterhub_config.d/environment.py.

IDLTOJAVA compiler

I am working on an assignment and I believe that the teacher has provided us with outdated instructions because myself and another student are unable to complete steps 1-2 and I was wanting to see if anyone could maybe provide some help with this? Thank you.
Here are the instructions for steps 1-2:
Step 1: Create an IDL Interface
In this step you will map the IDL to Java in order to define the contract between the server and client for your application. The code for this is language independent and will not look like your traditional Java code. Create a new IDL file using your downloaded IDLTOJAVA compiler. Name the file, “Liberty.idl” and enter the following code:
module LibertyApp
{
interface Liberty
{
String libertyU();
};
};
This Liberty U application will only have a single operation. This is all the code that you will need for this step.
Step 2: Mapping Liberty.idl to Java
In this step you will create the required java files through the IDLTOJAVA tool. Open up your command line prompt. Change the directory to the location of your Liberty.idl file. Enter the compiler command:
idltojava Liberty.idl
You will see that a directory called LibertyApp has been created and it will contain 5 files. Open up Liberty.java. I will contain these lines of code:
/* Liberty.java as generated by idltojava */
package LibertyApp;
public interface Liberty
extends org.omg.CORBA.Object {
String libertyU();
}
I went into visual studio and created a blank file and gave it the Liberty.idl name is that the correct way to create an idl file?
Thank you again!

how to post and accept long text to ASP.net web api?

I am trying to figure out the parameters and class fields to post and accept "build notes"(example text below) info,I am trying to design my controller as follows?would the following work for accepting a long text?
Controller:
public IEnumerable<class name> GetBuildNotes([FromBody] Buildnotes buildNotes>)
{
...........
........
}
Buildnotes class:
public class buildnotes
{
public string build_notes. --> this goes to a database column build_notes of type longtext
.....
}
Long text:
CHECKOUT POINT
cld3 - 1855314
cmn - 1855287
Known issue
[testsuite: STA_5G_VHT]: COMDEBUG-276224: consistent crash : APPS Crash - Kernel BUG at ffffff82dc55994c [PC at reg_todo+0x1dc/0x260] [LR at reg_todo]
if you observe build loading issue.please use fastboot.exe path : \\\8998_adb_drivers
Latest META only supported on BIN1 MTP. With BINA sometimes its works. but observed random boot-up crash
BIN B MTP doesn't boot up with latest target meta
Expected behavior :Bootloader UI updated with Boot verify feature in UEFI where the signing of the images is verified.
You can use below script to determine the Bin / Sub BIN type and IDDq leakage values thru adb.
Bring up device in adb mode
Source : \\location\team\LA\8998_hw_type\FinalScript
Usage : python bining.py
Please run "adb disable-verity" to avoid "adb remount/push" related issue
Sl4a/ PMC/ Acts/ Comms:Google_testing
$[apps_crm]\source\google_testing
WAPI build
CCX build location
e
HOT FIX
HW used for BIT sanity
Recommendation to use MPT with chipname 2.0 card. please replace chipname card on MTP having MCN ends with 001/003/005
CDT programming forV2 HW
http://qwiki.company.com/qct-drvsw/8998
Pre-built wiki
http://qwiki.company.com/com_wCOM/com-CBI/Build_With_External_AU#BUILDING_DRIVER_POINTING_TO_APPS_CRM
http://qwiki.company.com/com_wCOM/com-CBI/Build_With_External_AU#Build_ROME_and_chip_for_SP_:_com1234.LA.0.1
Build loading procedure
Load BIT (CI) Meta
ENGG WLAN FW load on top of BIT META
adb root
adb remount
adb shell mount -o rw,remount /firmware
adb push wlanmdsp.mbn /firmware/image
adb reboot
ENGG BT FW load on top of BIT META
adb root
adb remount
adb shell mount -o rw,remount /bt_firmware
adb push * /bt_firmware/image
adb reboot
Yes you can, I'm guessing you just need to ensure that the object you're passing from your client application matches your Buildnotes class structure.
Try this:
How to pass json POST data to Web API method as object

Using KeyczarTool to create new keyset

Following the documentation noted in the wiki, I'm trying to use the KeyczarTool to generate new keyset. Anyone else come across this FileNotFoundException? The KeyczarTool.jar has rwx permissions and tried running via sudo.
From docs
Command Usage:
create --location=/path/to/keys --purpose=(crypt|sign) [--name="A name"] [--asymmetric=(dsa|rsa|ec)]
Creates a new, empty key set in the given location.
This key set must have a purpose of either "crypt" or "sign"
and may optionally be given a name. The optional version
flag will generate a public key set of the given algorithm.
The "dsa" and "ec" asymmetric values are valid only for sets
with "sign" purpose.
Cmd:
$ java -jar KeyczarTool-0.71f-060112.jar create --location=/keys --purpose=crypt -name="first key" --asymmetric=rsa
output:
org.keyczar.exceptions.KeyczarException: Unable to write to: /keys/meta
at org.keyczar.KeyczarTool.create(KeyczarTool.java:366)
at org.keyczar.KeyczarTool.main(KeyczarTool.java:123)
Caused by: java.io.FileNotFoundException: /keys/meta (No such file or directory)
at java.io.FileOutputStream.open(Native Method)
at java.io.FileOutputStream.<init>(FileOutputStream.java:194)
at java.io.FileOutputStream.<init>(FileOutputStream.java:145)
at org.keyczar.KeyczarTool.create(KeyczarTool.java:362)
... 1 more
With the current version of java keyczar the directory "keys" needs to be created first before running the program.
This is a known issue KeyczarTool should create directories automatically.
As #jbtule kindly pointed out you must create the keys dir first. But also include . before the slash.
Correct working command is:
$ java -jar KeyczarTool-0.71f-060112.jar create --location=./keys --purpose=crypt -name="first key" --asymmetric=rsa

Resources