Sign in to follow this  
Followers 0
dleigh

"Run" to launch java app seems to be architecture dependant (32/64 bit)

2 posts in this topic

Hello - I've got a situation for which I'd like to get some insight from those more knowledgeable than I:

  • I have an Autoit application that I deploy as an executable. 
  • I can be deployed (I hope) to any level of Windows (2K - 8) both 32 and 64 bit. 
  • I has a sub-component that is a java app (BaseX XML database). 
  • I develop on a Win 7 Pro 64bit machine.

Just recently (last 4 months), I had not touched it since its last version and I started coding/testing again for another release.  It no longer worked!  I'd not changed the code but both the compiled and non-compiled versions now failed on my development machine.  Banged my head for quite a while to figure out what the deal was! :mad2:

I finally narrowed it all down to:

This command:

Local $pid = run(@ComSpec & " /c " & "java -cp BaseX.jar org.basex.BaseXServer","C:\Users\David\DOCUME~1\OPENSO~3\TESTIN~1\OPENSO~1\BaseX",@SW_HIDE,$STDERR_MERGED) ;starts the basex server to facilitate queries

worked when I commented out:

#AutoIt3Wrapper_UseX64=n

when it was NOT commented out (I had it uncommented to create 32bit executables for multi-architecture deployment) I received this message from the run command:

 

'java' is not recognized as an internal or external command, operable program or batch file.

I've uninstalled ALL of java and then just reinstalled the most recent version to see what that would do - same behavior.  I'm guessing that perhaps java, in more recent versions, has changed the way it is deployed for distinguishing between 32 and 64 bit machines.

So it would appear that my tactic to develop and deploy as a single 32-bit application that would cover all 32 and 64 bit machines will no longer work.  Is my only choice to create/use an installer that installs EITHER the 32 bit or 64 bit executable? Or is there some way to change my Run command such that it finds "java" no matter how it is intalled on my machine?

Thanks!


Share this post


Link to post
Share on other sites



Ok - edit of the situation. 

I found that I wasn't at the latest AutoIt version.  I then updated to 3.3.8.1 and then it didn't work at all! :

I had updated to make the simplesort work in x64 but it broke my call to java.  So I went and looked into the help file about x64 issues and found this piece of code:

DllCall("kernel32.dll", "int", "Wow64DisableWow64FsRedirection", "int", 1)

So I added it to my script.  Now the java call works AND the simplesort works.  Next step will be the compile and testing under 32 bit systems.

So, we're good for now - more testing to do!


Share this post


Link to post
Share on other sites

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 account

Sign in

Already have an account? Sign in here.


Sign In Now
Sign in to follow this  
Followers 0

  • Similar Content

    • BlazerV60
      By BlazerV60
      Hello all,
      I've written the code below which launches chrome in incognito mode and then proceeds to go to the autoit website.
      From my understanding, the Run() command is also supposed to output the PID number related to the application that got launched from the Run command.
      However when I run the below lines, it outputs a PID number that is different from the newly launched chrome browser's PID number, does anyone know why and possibly explain how I could retrieve the accurate PID number associated with the newly launched browser?
      Global $iPid = Run(@ComSpec & ' /c start chrome.exe https://www.autoitscript.com/forum/ -incognito' ,"", "") msgbox(0,"",$iPid) Thank you,
      Brian
    • rootx
      By rootx
      I need help to understand why the run function does not work, but if i use it directly inside cmd shell the command works. $where is the name of the jpg file
      ShellExecute(@ComSpec ," /k C:\Users\root\Desktop\test\exiftool.exe -p $FileName "&'"'&$where&'"'&" > "&'"'&@ScriptDir&"\out.txt"&'"',@ScriptDir);<----- work Run("C:\Users\root\Desktop\test\exiftool.exe -p $FileName "&$where&" > "&@ScriptDir&"\out.txt",@ScriptDir);<--- doesn't work I would use the run command!
      Thx
    • nacerbaaziz
      By nacerbaaziz
      Hello
      How are you
      I have a question, please.
      I've created a window and i need
      when i run the script if it detect an other copy from the same script was runing
       the script close the first copy Automatically and run a new copy
      I want an example to understand it
    • kawliga751
      By kawliga751
      I am attempting to run an Autoit.exe with schtasks every weekday @ 9:05 am.
      I have the below
      C:\>SchTasks /Create /TN "P10Run" /TR "O:\AUTOIT\P40 Run.au3" /SC WEEKLY /D MON, TUE,WED,THU,FRI /ST 09:05:00 SUCCESS: The scheduled task "P10Run" has successfully been created. I also did a "test" run :
      C:\>Schtasks /Run /TN "P10Run SUCCESS: Attempted to run the scheduled task "P10Run". But when I run my query to verify success my "Last Result" seems to indicate that the script did not run:
      C:\>SCHTASKS /QUERY /FO LIST /V /TN "P10RUN" Folder: \ HostName: xxxxxxxxxxxxxxxx TaskName: \P10RUN Next Run Time: N/A Status: Could not start Logon Mode: Interactive only Last Run Time: 6/14/2017 9:08:56 AM Last Result: -2147024894 Author: xxxxxxx Task To Run: O:\AUTOIT\P40 Run.au3 Start In: N/A Comment: N/A Scheduled Task State: Enabled Idle Time: Disabled Power Management: Stop On Battery Mode, No Start On Batterie s Run As User: xxxxxxxxx\xxxxxxxx Delete Task If Not Rescheduled: Enabled Stop Task If Runs X Hours and X Mins: 72:00:00 Schedule: Scheduling data is not available in this f ormat. Schedule Type: Weekly Start Time: 9:05:00 AM Start Date: 6/14/2017 End Date: N/A Days: MON, TUE, WED, THU, FRI Months: Every 1 week(s) Repeat: Every: Disabled Repeat: Until: Time: Disabled Repeat: Until: Duration: Disabled Repeat: Stop If Still Running: Disabled C:\> Is there something missing in my command? Also is there a better way to make sure that the script does in fact sun successfully?
      Thanks In Advance! 
    • iXX
      By iXX
      Hi!
      Looking for working code to  get full path of process  - both 32 & 64 bit.
      I tryed this bellow, but it works only for 32-bit processes, even if compiled for x64...
      Thanx for suggestions!
       
      Func _ProcessGetPath($vProcess) ;get the program path done by MrCreatoR Local $iPID = ProcessExists($vProcess) If NOT $iPID Then Return SetError(1, 0, -1) Local $aProc = DllCall('kernel32.dll', 'hwnd', 'OpenProcess', 'int', BitOR(0x0400, 0x0010), 'int', 0, 'int', $iPID) If NOT IsArray($aProc) OR NOT $aProc[0] Then Return SetError(2, 0, -1) Local $vStruct = DllStructCreate('int[1024]') Local $hPsapi_Dll = DllOpen('Psapi.dll') If $hPsapi_Dll = -1 Then $hPsapi_Dll = DllOpen(@SystemDir & '\Psapi.dll') If $hPsapi_Dll = -1 Then $hPsapi_Dll = DllOpen(@WindowsDir & '\Psapi.dll') If $hPsapi_Dll = -1 Then Return SetError(3, 0, '') DllCall($hPsapi_Dll, 'int', 'EnumProcessModules', _ 'hwnd', $aProc[0], _ 'ptr', DllStructGetPtr($vStruct), _ 'int', DllStructGetSize($vStruct), _ 'int_ptr', 0) Local $aRet = DllCall($hPsapi_Dll, 'int', 'GetModuleFileNameEx', _ 'hwnd', $aProc[0], _ 'int', DllStructGetData($vStruct, 1), _ 'str', '', _ 'int', 2048) DllClose($hPsapi_Dll) If NOT IsArray($aRet) OR StringLen($aRet[3]) = 0 Then Return SetError(4, 0, '') Return $aRet[3] EndFunc