5

I am trying to run a java file that is sitting on my web server from c code. When I load the webpage, a perl script calls a c file which then calls the java file.

I have the call set up like in my c file:

System(java -cp <path> MyClass);

But this System() call returns 256 - (file not found I think).

I have also tried:

System(cd /<path> && java MyClass);

And get the same results.

If I run the exact same command from the terminal via ssh, it works fine, it is just when I try running the code from my browser that it gives this error.

Any ideas if my syntax is incorrect? Or am I doing something else wrong? Does it have something to do with the perl > c > java chain I am forced to use?

EDIT It appears that the c runtime was not looking at $PATH. I added the absolute path to java.exe, and it worked! Wooo

tldr

solution:

System("/opt/jdk1.6.0_43/bin/java -cp <path> MyClass");
Toadums
  • 2,772
  • 8
  • 44
  • 67

0 Answers0