Thursday, June 5, 2008

Batch File Issue

If anyone has an answer to why it's doing this, please let me know. I'm not too concerned about it, so I haven't gone digging, but figured I'd put it out there for all to see.

So I've got this batch file I've been using to build these simple JNI projects. Nothing fancy:

[make.bat]

call clean.bat
javac javaclass.java
javah -jni javaclass
call "C:\Program Files (x86)\Microsoft Visual Studio 9.0\VC\vcvarsall.bat" amd64
cl -I"c:\program files\java\jdk1.6.0_06\include" -I"c:\program files\java\jdk1.6.0_06\include\win32" -I"." -MD -LD javanative.cpp -Fejavanative.dll user32.lib
mt -manifest javanative.dll.manifest -outputresource:javanative.dll;2


Every, say, 12 builds in the same console window, and I get this error message:


The input line is too long.
The syntax of the command is incorrect.


The message comes from the Visual Studio batch file or the compiler, not sure which - the batch file prints out a message saying it's configured as normal, and that's when it dies.

Anyway, from then on it fails to build, and the only way to fix it is to open a new console window. Nothing big, just annoying sometimes.

2 comments:

Anonymous said...

The bat file:

C:\Program Files (x86)\Microsoft Visual Studio 9.0\VC\vcvarsall.bat

adds a set of paths to the %PATH% environment variable every time it gets called.

Right at the end of the paths it is adding is any existing info via the %PATH% statement.

By calling it multiple times you're adding the same set of paths to what already exists, and eventually the %PATH% variable is just too long.

tofutim said...

Yup, that's what is happening to me too. One fix is to reset the %PATH% when you are done.