Combination View Flat View Tree View
Threads [ Previous | Next ]
toggle
AUTOPDP
Answer
8/31/16 3:20 PM
Hello,

I'm planing to built a standalone version soon. I've written a small executable jar which is currently in the filestroage. I've added a small Procedurece in AppInitalized which copies the jar into the temp dir (I've had right problems with cwd) and executes it via SYSTEM. This works good!
I've read that you can add your extension for building your standalone software. Point 1.1.3 in
https://www.adoxx.org/live/documents/10157/4213f6ff-1b8a-4d25-92df-0b8649f0a7b4

But I don't understand how to access them via AdoScript to execute the jar?

My current apporoach:
 1CC "AdoScript" GET_TEMP_FILENAME
 2#--> RESULT filename:strValue
 3SETG jar_file:(copy(filename, 0, (bsearch(filename,"\\", LEN filename))+1) + "JavaExport.jar")
 4
 5
 6# ---------------------------------------------------
 7# Execute the jar.
 8# @in_args        string        Arguments for Java call
 9# @in_message        string        Message which occour during execution
10# @in_debug        integer        1 = show Java call, else not
11# @out_out_file    string        absolute path to out file
12# @out_error_file    string        absolute path to err file
13# ---------------------------------------------------
14PROCEDURE global EXECUTE_JAVA in_args: string
15                            in_message: string
16                            in_debug: integer
17                            in_out_file_format: string
18                            out_out_file: reference
19                            out_error_file: reference
20{
21   
22    CC "AdoScript" MSGWIN (in_message)
23   
24    # set stream files
25    CC "AdoScript" GET_TEMP_FILENAME
26    SETL out_out_file:(filename + "." + in_out_file_format)
27            
28    CC "AdoScript" GET_TEMP_FILENAME
29    SETL out_error_file:(filename + ".txt")   
30   
31    CC "AdoScript"  FILE_EXISTS file: (jar_file)
32    # -->RESULT exists: 1|0
33   
34    #do the file exists?
35    IF (exists = 0) {
36        CC "AdoScript" FILE_COPY from:(skriptPath + "JavaExport.jar") to:(jar_file)
37    }
38
39    SETL statement: ("java -jar " + jar_file  + " -out_file " + out_out_file + " -error_file " + out_error_file + " " + in_args)
40   
41    IF (in_debug = 1) {
42        CC "AdoScript" EDITBOX text:(statement)
43    }
44    SYSTEM (statement)
45   
46    CC "AdoScript" MSGWIN hide
47}

RE: AUTOPDP
Answer
9/3/16 10:28 AM as a reply to Swante.
Dear Swante,

the approach you describe here is a feasible way to get your executable running.
Another way is to have it directly in the installation folder and get it to work without the need to copy things. The GET_PATH AdoScript command would return the installation directory and you can the execute from there (similar as the CWD returns the install dir of the tool).

It is up to you how you would like the build engine to have the file, as part of the library you have more control as it is part of the configuration rather than the build job. Please let us know in a small read me as part of the autopdp build job how you would like us to handle the extension when configuring the job.

Thanks, wilfrid

RE: AUTOPDP
Answer
9/4/16 9:44 AM as a reply to Wilfrid Utz.
Thank you Wilfrid