Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Process.start() odd behavior

Tags:

java

c#

process

dll

I am trying to use code to run a popular bitcoin miner.

https://dl.dropboxusercontent.com/u/92716895/DiabloMiner.zip

If you guys know if it, it might be helpful. The thing is that it is a java bitcoin miner. Which needs some dlls to run. The way I manually run it works... which is via cmd going into the directory and typing,

DiabloMiner-Windows.exe -u user -p pass -o server

But when I use the below code to do the same it doesn't work it gives me cannot locate java library path lwjgl.

diabloMinerExe = Path.Combine(storageLocation, "DiabloMiner", "DiabloMiner-Windows.exe");
miner = new Process();
miner.StartInfo.FileName = diabloMinerExe;
miner.StartInfo.Arguments = "-u " + this.user + " -p " + this.password + " -o " + this.server;
miner.Start();

To clarify...

" It's a C# Project that starts a Process which is a .exe which starts a Java based bitcoin miner. "

like image 417
Ya Wang Avatar asked Mar 14 '26 00:03

Ya Wang


1 Answers

        System.Diagnostics.Process process = new System.Diagnostics.Process();
        System.Diagnostics.ProcessStartInfo startInfo = new System.Diagnostics.ProcessStartInfo();
        startInfo.FileName = "cmd.exe";
        startInfo.Arguments = "/K java -cp libs\\*;DiabloMiner.jar -Djava.library.path=libs\\natives com.diablominer.DiabloMiner.DiabloMiner -u youruser -p yourpassword -o server";
        process.StartInfo = startInfo;
        process.Start();

This is a working example... I've made it run. If you need help with it, give me a shout ;)

You will need libs folder and DiabloMiner.jar in the directory of your C# app

like image 53
Ubica Avatar answered Mar 16 '26 13:03

Ubica



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!