Link to home
Start Free TrialLog in
Avatar of allelopath
allelopath

asked on

Windows cannot find '.\jre\bin\javaw'

I run a batch file and get the error " Windows cannot find '.\jre\bin\javaw' "

The directory/file structure is:

[MyDirectory]
   [jre]
        [bin]
            javaw.exe
    my.bat

(ie my.bat is in MyDirectory, same level as [jre])

Where my.bat is:
start .\jre\bin\javaw -Xmx1024M <more stuff>

I've set the PATH and CLASSPATH to include C:\...\MyDirectory\jre\bin
JAVA_HOME is C:\Program Files\Java\jdk1.6.0_18. This is the 'main' java so to speak. I want to run a particular jre with this batch file.

What do I need to do?
ASKER CERTIFIED SOLUTION
Avatar of Bryan Butler
Bryan Butler
Flag of United States of America image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of allelopath
allelopath

ASKER

>>MyDirectory" is same level as jre, then wouldn't it be:
no, I said my.bat is in MyDirectory, same level as [jre].
jre is in MyDirectory
SOLUTION
Avatar of CEHJ
CEHJ
Flag of United Kingdom of Great Britain and Northern Ireland image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Doh!  I was off on that.  

What about removing the "start" or specifiying the 'path' option for the directory to start in.
Can this work by explicitly defining the path without setting any environment variables?
My suggestion doesn't involve setting any
start .\jre\bin\javaw -Xmx1024M /D"<complete_path>\jre\bin\"
Actually:
start javaw -Xmx1024M /D"<complete_path>\jre\bin\"
>>My suggestion doesn't involve setting any
It does require JAVA_HOME
My problem appears to be that .\jre\bin goes one directory up.
If I move the bat file like so:
[MyDirectory]
   [jre]
        [bin]
            javaw.exe
    [anotherDir]
        my.bat

It works.
So i don't understand the .\
I thought . said "start where I am"
>>It does require JAVA_HOME

That would simply be a parameter
You should keep your batch files out of the Java tree altogether btw
What is the motivation of the batch file btw? Why, for instance are you not running an executable jar?
>>What is the motivation of the batch file btw?
Just does some other stuff.