2

I am trying to run there own example of LegacyLibrary on http://code.google.com/p/javacpp/

when I try to compile code with following command mentioned at site only (basically compiling code with javacpp.jar) I am getting following exception

D:\Java Workspace\POC\JavaCPP\bin>java -jar javacpp.jar LegacyLibrary
Generating source file: D:\Java Workspace\POC\JavaCPP\bin\jniLegacyLibrary.cpp
Building library file: D:\Java Workspace\POC\JavaCPP\bin\windows-x86\jniLegacyLibrary.dll
cl "/IC:\Program Files (x86)\Java\jdk1.6.0_03\include" "/IC:\Program Files (x86)\Java\jdk1.6.0_03\include\win32" "D:\Java Workspace\POC\JavaCPP\bin\jniLegacyLibrary.cpp" /W3 /Oi
 /O2 /EHsc /Gy /GL /MD /LD /link "/OUT:D:\Java Workspace\POC\JavaCPP\bin\windows-x86\jniLegacyLibrary.dll"
Exception in thread "main" java.io.IOException: Cannot run program "cl": CreateProcess error=2, The system cannot find the file specified
        at java.lang.ProcessBuilder.start(ProcessBuilder.java:459)
        at com.googlecode.javacpp.Builder.build(Builder.java:189)
        at com.googlecode.javacpp.Builder.generateAndBuild(Builder.java:234)
        at com.googlecode.javacpp.Builder.main(Builder.java:479)
Caused by: java.io.IOException: CreateProcess error=2, The system cannot find the file specified
        at java.lang.ProcessImpl.create(Native Method)
        at java.lang.ProcessImpl.<init>(ProcessImpl.java:81)
        at java.lang.ProcessImpl.start(ProcessImpl.java:30)
        at java.lang.ProcessBuilder.start(ProcessBuilder.java:452)
        ... 3 more

what the remedy for this ?

skaffman
  • 381,978
  • 94
  • 789
  • 754
Dhruv Bansal
  • 8,907
  • 17
  • 71
  • 118

1 Answers1

2

The error message is pretty clear: it's not finding the cl executable, which is the name of the Visual Studio compiler.

You should run that command from a Visual Studio command prompt (there's an entry in the start menu for that, usually), to get the right environment variables loaded.

Mat
  • 188,820
  • 38
  • 367
  • 383