View Full Version : Batch files
shelbygt
10-29-2003, 05:47 AM
My batch file doesn't seem to work within the AMS distribution folder. The batch file runs a java script (jar) file from within the same folder. All works fine when the folder is on the desktop, but from within the distro directory (in AMS), it cannot find the java file. Any ideas?
Corey
10-29-2003, 05:59 AM
Hi. I believe a .jar file is a java file, not a javascript file.
Anyhow open your .bat file in a text editor and make sure the link is yourfile.jar with no folder path and then make sure you put the .bat file and .jar file side by side in the distribution folder and the batch file should find the file just fine...
That being said, be careful, you can't just run a .jar file on any computer. I think they are companion files to applets but further than that machines such as mine do not execute .jar files, there's no application associated with that extension over here... My guess is that will be somewhat common for .jar extension since I haven't really heard of that being used as a deployment extension such as .exe... So in my case the .bat file would fail to do anything even if it finds the ,jar file...
Corey Milner
Creative Director, Indigo Rose Software (http://www.indigorose.com)
shelbygt
10-29-2003, 06:26 AM
Hi Corey,
There isn't a path, and they are within the same folder. It can run from any directory on the computer, except from within AMS. I can even run it from start>RUN .
This is the batch:
@echo off
rem double-click this file to launch DocsDiag with parameters
java -cp docsdiag.jar docsdiag -vv -log -community public
pause
BTW, Sun's Java will be installed on computers that can't run it.
Thx.
Corey
10-29-2003, 06:47 AM
Nope. No Java runs here. If it tries my antivirus squashes it silently...
Corey Milner
Creative Director, Indigo Rose Software (http://www.indigorose.com)
cchian
10-29-2003, 08:18 AM
I don't know if this is the solution, but have you tried setting your Working Directory to the location you are running the batch file from? IE %SrcDir% or %SrcDrv% (add a folder afterwards if file is within a folder ie %SrcDir%\data ).
shelbygt
10-30-2003, 03:24 AM
Originally posted by cchian
I don't know if this is the solution, but have you tried setting your Working Directory to the location you are running the batch file from? IE %SrcDir% or %SrcDrv% (add a folder afterwards if file is within a folder ie %SrcDir%\data ).
Yes, but still no bat file. I think I would have to point to "java.exe" in the windows directory to get it to work that way, or something.
I'm just going to forget the batch file and go straight command line. The batch file was only used so that you wouldn't have to go command line.:
File.execute %SysDir%\cmd.exe
with the command line:
/c java -cp "%SrcDir%\docsdiag\docsdiag.jar" docsdiag -vv -log -community public
This also worked:
copy.file "docsdiag.jar"
destination %TempDir%
file.execute "cmd.exe"
/c jview /cp docsdiag.jar docsdiag -vv -log -community public
I don't have to point to the directory with this one. I used a copy.file action to drop the docsdiag file into the %TempDir%, though. I'm wondering if I should go this route instead. Does this mean it's using Microsoft's JVM instead of Sun's?
As long as I get the same results either way, I don't care.
Thanks for the help.
vBulletin® v3.8.4, Copyright ©2000-2010, Jelsoft Enterprises Ltd.