Guest RocTx Posted June 8, 2004 Posted June 8, 2004 Well, I've been busting my head trying to get the following code to work.All of the code works fine (I've tested it by > to a .log file). But the second to thelast line (code) simply does not work and the error message flashes by so quicklyI can't capture it and it won't ( > ) output to a txt/log file to see what it's doing.Anyone have any ideas? I've read through almost all the faqs and topics but havenot found anything similar to it. Any help would be appreciated.Environment:XP Pro (as server)Dell 640512M RamJava 1.4.2._04Java Path: C:\Program Files\Java\j2re1.4.2_04\bin (it is in %PATH% also)Program Path: C:\Program Files\Lucane\serverProgram name: server.bat (trying to convert to app.exe)The two (in bold) at the end of the code, RunWait(@Comspec I cannot get to run.Is this maybe a problem with java?How can I capture the erro output? When I try to capture it with ">" all I get is anempty file..bat Code:echo offecho.set TMPCLASSPATH=%%1;%%TMPCLASSPATH%%>~tmp.batset TMPCLASSPATH=for %%i in (lib\*.jar) do call ~tmp.bat "%CD%\%%i"del /F ~tmp.batjava -classpath %TMPCLASSPATH% org.lucane.server.Serverset TMPCLASSPATH=app.exe Code:; Script Function: Startup Lucane Server; Create a temporary file called "~Tmp.txt"; This file will contain all the files in; the ./lib folderRunWait(@comspec & " /c Dir .\lib > ~Tmp.txt")$file = FileOpen("~Tmp.txt", 0); Check if file opened for reading OKIf $file = -1 Then MsgBox(0, "Error", "Unable to open file.") ExitEndIfDim $Nline = ""; Read in lines of text until the EOF is reachedWhile 1 $line = FileReadLine($file) if @error = -1 Then ExitLoop If StringInStr($line, "jar") Then $line=StringTrimLeft($line,39) $Nline = $Nline & "C:\Program Files\Lucane\server\lib\" & $line & ";"; MsgBox(4096, "Line read:", $Nline) EndIfWendFileClose($file); Done with the file. Delete it.FileDelete("~Tmp.txt"); Set TMPCLASSPATH environment variableEnvSet("TMPCLASSPATH", $Nline)$Env = EnvGet("TMPCLASSPATH"); MsgBox(4096, "Environment Path:", $Env);Start the ServerRunWait(@Comspec & " /c echo %TMPCLASSPATH% > TMPCLASS.LOG", "",)RunWait(@Comspec & " /c java -classpath %TMPCLASSPATH% org.lucane.server.Server", "", ); Run("java", "-classpath %TMPCLASSPATH% org.lucane.server.Server")I have the above line Run( commented out on purpose.
Josbe Posted June 8, 2004 Posted June 8, 2004 RunWait(@Comspec & " /c java -classpath %TMPCLASSPATH% org.lucane.server.Server", "", ) $_error= @error ;backup Msgbox(0, "Error output", $_error) What about this? AUTOIT > AutoIt docs / Beta folder - AutoIt latest beta
Guest RocTx Posted June 8, 2004 Posted June 8, 2004 I added that code: $_error= @error ;backup Msgbox(0, "Error output", $_error) and the error is " 0 ". Blank like when I send output to txt/log file. I've looked closely at the " and , and ' and syntax. Maybe I'm missing something? Been at it for 2 days and trying every which way syntax wise but nothing. I get the feeling it's really something simple and I'm just missing it. Thank for the quick response and tip though.
Josbe Posted June 8, 2004 Posted June 8, 2004 Ok. When you run this java -classpath %TMPCLASSPATH% org.lucane.server.Serverin a Shell, normally this show a output? AUTOIT > AutoIt docs / Beta folder - AutoIt latest beta
Josbe Posted June 8, 2004 Posted June 8, 2004 Or: RunWait(@Comspec & ' /c java -classpath ' & EnvGet("TMPCLASSPATH") & ' org.lucane.server.Server', '', @SW_HIDE) AUTOIT > AutoIt docs / Beta folder - AutoIt latest beta
Valik Posted June 8, 2004 Posted June 8, 2004 Use /k to keep the command window open so you can read the error.
Guest RocTx Posted June 8, 2004 Posted June 8, 2004 Yes.. when the server.bat is run.. java -classpath %TMPCLASSPATH% org.lucane.server.Server it does output to the DOS window shell screen. It lists the services that it starts and then sits there with "Server is Ready" and no interaction is required and no input is necessary. To stop it you do a "Ctrl-C" and "yes" to terminate the batch job. I am trying to convert this to .exe so that I can try and see if I can use "SrvAny" to start is as a service at boot time. I will try your suggestion when I get back in the office tomorrow morning. Thanks again for the tip... RocTx
RocTx Posted June 9, 2004 Posted June 9, 2004 Valik, thanks.. the /k worked so I can see what the error message is. And it is: Exception in thread "main" java.lang.NoClassDefFoundError: Files\Lucane\server\l ib\activation-1/0/2/jar;C:\Program josbe, I tried your code: RunWait(@Comspec & ' /c java -classpath ' & EnvGet("TMPCLASSPATH") & ' org.lucane.server.Server', '', @SW_HIDE) but still got the same error as above. The working server.bat Starts up like: C:\Program Files\Lucane\server>echo off Jun 9, 2004 9:03:22 AM org.lucane.server.store.Store <init> INFO: Using database backend writeScript Jun 9, 2004 9:03:23 AM org.lucane.server.Server loadInternalServices INFO: Service 'org.lucane.applications.administrator' loaded. Loads other services... Ends like: Jun 9, 2004 9:03:23 AM org.lucane.server.Server generateKeys INFO: Generating keypair Jun 9, 2004 9:03:24 AM org.lucane.server.Server main INFO: Server is ready. Thanks for the tips... I appreciate your help. The search continues... RocTx
Valik Posted June 9, 2004 Posted June 9, 2004 You likely need to surround the path with quotes. Try something like: RunWait(@Comspec & ' /c java -classpath "%TMPCLASSPATH%" org.lucane.server.Server', "", )
RocTx Posted June 9, 2004 Posted June 9, 2004 Valik!!! That did it!! It works like a charm now. Those single (') and double (") quotes. I need to understand them more and how and when to use which. But that seems to have done the trick! Thanks a bunch!! RocTx
Josbe Posted June 9, 2004 Posted June 9, 2004 hmmm.....check FAQ Q#7 AUTOIT > AutoIt docs / Beta folder - AutoIt latest beta
RocTx Posted June 9, 2004 Posted June 9, 2004 Hey there josbe!! I understand Faq #7. It's the examples in the help file that turned me all around and confused me. In the examples in the help files it clearly shows double quotes. It doesn't explain them. Looking at the codes on here I can see how they're used and understand them. You guys have been a great help and I'm learning. Thanks again for your time and patience and your experience. RocTx P.S. I've only been using AutoIt3 for the first time on this project.. I'm new to it.
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now