dimanche 23 août 2020

Starting python script from Java class

I have random number generetor in Python script and now I am writing a DES algorithm, which should use this python script. There will be 2 modes: DES and 3DES, so I need to specify how many keys it should generate (1, or 3). Keys will be generated to file and from this file I will load these keys to DES algorithm.

For know I am using Python script with this line:

python rng.py --sequence [size of sequence] [range of random numbers]

I have found kind of solution like this:

String command = "python /c start python path\to\script\script.py";
Process p = Runtime.getRuntime().exec(command + param );

But this one doesn't work for me and I do not know how to solve this. Program compiles succesfully, but I don't have any generated numbers in output.txt file inside Python script folder.

String command = "python /c start python C:\\Users\\danie\\PycharmProjects\\RNG\\rng.py --sequence 3 10000000";
Process p = Runtime.getRuntime().exec(command);



Aucun commentaire:

Enregistrer un commentaire