On Windows 7 (64-bit) and Office 2010, in a Word VBA macro, I make a call Shellfor java to execute a .jar file. The code is part of a distribution that supposedly works in Office 2007 (which I don't have).
ShellCommand = "java -classpath ..."
TaskID = Shell(ShellCommand, ShellWindowState)
In any case, the command Shellreturns the process identifier, but the process immediately exits without Err.Number. In fact, I canβt get a lot of information about why.
However, I suspected that I could not find the team java. I confirmed that my PATH is correct by manually opening a window CMD.exeand running ShellCommand(which I printed using Debug.Print). In fact, my PATH variable is configured to indicate where the last JRE is installed, which is also evidenced by input java -versionand viewing the correct output.
So, still not trusting Shellfrom VBA, I hard-coded ShellCommand as follows:
ShellCommand = "c:\Program Files\Java\jdk1.7.0_72\jre\bin\java -classpath ..."
In my (un) suprise, the Shell command works, and my .jar was executed as it should.
, , system PATH ShellCommand , , VBA, , JRE Windows 7 (java.exe - ), java.exe?