newLISP Fan Club

Forum => newLISP Graphics & Sound => Topic started by: mostlywrong on January 16, 2009, 07:05:21 PM

Title: starting java using process
Post by: mostlywrong on January 16, 2009, 07:05:21 PM
looking at the problem i have with running the demo programs newlisp is not starting java with the process function.

I have been trying to get Java to start from newlisp for several days now and pretty much out of ideas.

I can pretty much run any none java program with any arguments that i want using process to start them, except for java.

On another note I can start the java guiserver and pass in a newlisp source file using python..



Would i get different results using the console rather than newLISP Edit? That's where i have been working from so far.





Looking in the Tips and tricks section i found this:
QuoteRun a Win32 shell and hide window

and after a little fumbling it works.

what is the difference  between process and the the win32 shell function?
Title:
Post by: Lutz on January 17, 2009, 05:26:17 AM
Please try the following things from newLISP started in a command shell window (not the bottom part of the editor).



> !dir


The exclamation mark should be the first character and the word: dir should immediately follow it.



If this works try the following:



> (process "cmd /c dir")


and last:



> (exec "dir")


Tell me if these things work. If these things work, try the same in the bottom shell windows of the newLISP-GS editor. If it works or not, in either case tell me what happens.


Quotewhat is the difference between process and the the win32 shell function?


The win32 shell is a program running as a process. In the (process "cmd /c dir") example, newLISP starts the win32 shell as a new process and executes the "dir" command in it.
Title:
Post by: mostlywrong on January 17, 2009, 07:21:45 AM
!dir

From cmd shell in the newlisp folder:

gives a dir listing of the "newlisp" folder.



From the lower pain of newLISP edit:

gives a dir listing of "C:Documents and Settingsfred" which is the root of my login folder for my windows settings.



----------------------

(process "cmd /c dir")

From cmd shell in the newlisp folder:

gives nil



From the lower pain of newLISP edit:

gives nil



----------------------

(exec "dir")

From cmd shell in the newlisp folder:

gives an "extended" dir listing of the "newlisp" folder



From the lower pain of newLISP edit:

gives a "extended" dir listing of "C:Documents and Settingsfred" which is the root of my login folder for my windows settings.


> (main-args)
("C:\newlisp\newlisp.exe" "-C" "-w" "C:\Documents and Settings\fred")
From the lower pain of newLISP edit

---------------------------------------------------------------

I think my problem might have something to do with the arg passing to the program being called.



I was able to start guiserver with win32shell and pass in the newlisp file and have them both start. I wasn't able to do that with process. win32shell has a arg for cmd args.



Thanks for the help. It looks interesting and simple enough for a beginner to learn.
Title:
Post by: xytroxon on January 17, 2009, 12:12:31 PM
Quote from: "mostlywrong"
> (main-args)
("C:\newlisp\newlisp.exe" "-C" "-w" "C:\Documents and Settings\fred")



Is there a conflict with your newLISP not being installed in "C:Program Filesnewlisp"???



-- xytroxon
Title:
Post by: mostlywrong on January 17, 2009, 12:52:34 PM
no. its the same problem. I moved new lisp folder to where you see it now and changed all the shortcuts and env settings tring to see if it was a "space in the path" problem.



thanks for asking though. bugging me to death.
Title:
Post by: Lutz on January 18, 2009, 04:52:15 AM
It should work in custom-chosen install directories too, as long as NEWLISPDIR and the executable path point to the correct location.



But back to what we were doing:



The 'process' function should display a directory listing too, but doesn't.  Lets try the following in a cmd shell, to check if the shell program "cmd.exe" exists at all and is in the executable path with that name:


cmd /c dir

if this still works, lets see if the newLISP 'process' function works with some other known program:


> (process "notepad.exe")


This should pop up the Win32 notepad.exe editor. Try this in both the cmd shell and the the lower pane of newLISP edit.



Also what is this? C:Program FilesAltirisSoftware Virtualization Agent
Title:
Post by: mostlywrong on January 18, 2009, 06:36:13 AM
from a cmd prompt ( just happens to be in newlisp dir)
cmd /c dirgave me a dir listing of the current dir.

changed to c: and repeated and gave me dir listing of current dir.



from newlisp:
(process "notepad.exe")returned nil. no notepad.


(process "c:/windows/system32/notepad.exe")works and opens a notepad.



path problems? I'm not sure. I had done some testing of the pate before trying to rule it out.



I know this is comparing apples to oranges but...

using python prompt: import subprocess, os, sys
subprocess.Popen('notepad.exe',shell=True)
works. notepad opens.



If it is a path problem I'm not see it. Maybe a frese set of eyes could see it.> (env)
(("ADMINTOOLS" "C:\Documents and Settings\fred\Start Menu\Programs\Administrative Tools")
 ("ALLUSERSPROFILE" "C:\Documents and Settings\All Users")
 ("APPDATA" "C:\Documents and Settings\fred\Application Data")
 ("CACHE" "C:\Documents and Settings\fred\Local Settings\Temporary Internet Files")
 ("CDBURNING" "C:\Documents and Settings\fred\Local Settings\Application Data\Microsoft\CD Burning")
 ("COMMONADMINTOOLS" "C:\Documents and Settings\All Users\Start Menu\Programs\Administrative Tools")
 ("COMMONAPPDATA" "C:\Documents and Settings\All Users\Application Data")
 ("COMMONDESKTOP" "C:\Documents and Settings\All Users\Desktop")
 ("COMMONDOCUMENTS" "C:\Documents and Settings\All Users\Documents")
 ("COMMONFAVORITES" "C:\Documents and Settings\All Users\Favorites")
 ("COMMONFILES" "C:\Program Files\Common Files")
 ("COMMONMUSIC" "C:\Documents and Settings\All Users\Documents\My Music")
 ("COMMONPICTURES" "C:\Documents and Settings\All Users\Documents\My Pictures")
 ("CommonProgramFiles" "C:\Program Files\Common Files")
 ("COMMONPROGRAMS" "C:\Documents and Settings\All Users\Start Menu\Programs")
 ("COMMONSTARTMENU" "C:\Documents and Settings\All Users\Start Menu")
 ("COMMONSTARTUP" "C:\Documents and Settings\All Users\Start Menu\Programs\Startup")
 ("COMMONTEMPLATES" "C:\Documents and Settings\All Users\Templates")
 ("COMMONVIDEO" "C:\Documents and Settings\All Users\Documents\My Videos")
 ("COMPUTERNAME" "USER")
 ("ComSpec" "C:\WINDOWS\system32\cmd.exe")
 ("COOKIES" "C:\Documents and Settings\fred\Cookies")
 ("DEFAULTUSERPROFILE" "C:\Documents and Settings\Default User")
 ("DESKTOP" "C:\Documents and Settings\fred\Desktop")
 ("FAVORITES" "C:\Documents and Settings\fred\Favorites")
 ("FONTS" "C:\WINDOWS\Fonts")
 ("FP_NO_HOST_CHECK" "NO")
 ("HISTORY" "C:\Documents and Settings\fred\Local Settings\History")
 ("HOMEDRIVE" "C:")
 ("HOMEPATH" "\Documents and Settings\fred")
 ("LOCALAPPDATA" "C:\Documents and Settings\fred\Local Settings\Application Data")
 ("LOCALSETTINGS" "C:\Documents and Settings\fred\Local Settings")
 ("LOGONSERVER" "\\USER")
 ("MEDIAPATH" "C:\WINDOWS\Media")
 ("MSSHAREDTOOLS" "C:\Program Files\Common Files\Microsoft Shared")
 ("MYMUSIC" "C:\Documents and Settings\fred\My Documents\My Music")
 ("MYPICTURES" "C:\Documents and Settings\fred\My Documents\My Pictures")
 ("MYVIDEO" "C:\Documents and Settings\fred\My Documents\My Videos")
 ("NETHOOD" "C:\Documents and Settings\fred\NetHood")
 ("NEWLISPDIR" "C:\newlisp")
 ("NUMBER_OF_PROCESSORS" "1")
 ("OS" "Windows_NT")
 ("Path" "PATH=C:\WINDOWS;C:\WINDOWS\system32;C:\WINDOWS\System32\Wbem;C:\Program Files\UltraEdit-32;C:\Program
 Files\Altiris\Software Virtualization Agent\;C:\Program Files\ATI Technologies\ATI.ACE\Core-Static;C:\Program F
iles\ActiveState Komodo Edit 5\;C:\Program Files\Java\jre6\bin;C:\newlisp")
 ("PATHEXT" ".COM;.EXE;.BAT;.CMD;.VBS;.VBE;.JS;.JSE;.WSF;.WSH;.jar")
 ("PERSONAL" "C:\Documents and Settings\fred\My Documents")
 ("PRINTHOOD" "C:\Documents and Settings\fred\PrintHood")
 ("PROCESSOR_ARCHITECTURE" "x86")
 ("PROCESSOR_IDENTIFIER" "x86 Family 15 Model 12 Stepping 0, AuthenticAMD")
 ("PROCESSOR_LEVEL" "15")
 ("PROCESSOR_REVISION" "0c00")
 ("PROFILESDIRECTORY" "C:\Documents and Settings")

 ("PROGRAMFILES" "C:\Program Files")
 ("PROGRAMS" "C:\Documents and Settings\fred\Start Menu\Programs")
 ("PROMPT" "$P$G")
 ("RECENT" "C:\Documents and Settings\fred\Recent")
 ("SENDTO" "C:\Documents and Settings\fred\SendTo")
 ("SESSIONNAME" "Console")
 ("STARTMENU" "C:\Documents and Settings\fred\Start Menu")
 ("STARTUP" "C:\Documents and Settings\fred\Start Menu\Programs\Startup")
 ("SystemDrive" "C:")
 ("SystemRoot" "C:\WINDOWS")
 ("TEMP" "C:\DOCUME~1\fred\LOCALS~1\Temp")
 ("TEMPLATES" "C:\Documents and Settings\fred\Templates")
 ("TMP" "C:\DOCUME~1\fred\LOCALS~1\Temp")
 ("USERDOMAIN" "USER")
 ("USERNAME" "fred")
 ("USERPROFILE" "C:\Documents and Settings\fred")
 ("windir" "C:\WINDOWS"))
>
Ok thats stright from the cmd prompt running newlisp with no editing.
Title:
Post by: DrDave on January 18, 2009, 01:05:25 PM
From what I was able to extract form your earlier posts, you did not install newLISP to the default settings. So, perhaps when you were moving things around, not all your paths match where your target files reside. For example, on my installation using the default settings, I have

 ("NEWLISPDIR" "C:\Program Files/newlisp")

but you have

 ("NEWLISPDIR" "C:\newlisp")



The first thing that I would have done when encountering such a problem is simply uninstall and then reinstall using the default settings.
Title:
Post by: mostlywrong on January 18, 2009, 02:57:44 PM
sorry I wasn't clear before.



I installed to the default dir at first.



Then moved to the root folder.



I will delete and reinstall to the default folder.
Title:
Post by: Lutz on January 18, 2009, 03:01:22 PM
lets continue with out experiments, in case you reinstalled, just check that NEWLIDPDIR and executable path are fine.



We have a problem with process not finding the path in (process "cmd /c dir"), Which is strange because the path environment variable seems to be fine. Same as on my XP-SP2 system, where both cmd and notepad are found using 'process'.



Lets try the following:


(process "c:\WINDOWS\system32\cmd.exe /c dir")



As you tried the same with notepad.exe it should work. If this works I will give you a modified guiserver.lsp. Where cmd.exe is called with its's full path
Title:
Post by: mostlywrong on January 18, 2009, 03:06:08 PM
Quote(process "c:\WINDOWS\system32\cmd.exe /c dir")
works just fine.
Title:
Post by: Lutz on January 18, 2009, 03:26:21 PM
Put guiserver.lsp line 750 back to the original content; this assumes that your .jar -> javaw.exe association is working.



Then change line 1813 from:


(process (string "cmd /c " server-path " " portIn))


to:


(process (string "c:\WINDOWS\system32\cmd.exe  /c " server-path " " portIn))


Now you should be able to do in a Win32 cmd shell:


newlisp c:newlispguiserverbuttom-demo.lsp
Title:
Post by: mostlywrong on January 18, 2009, 05:10:38 PM
you got me Lutz. and it was painful. my eyes are not as good as they use to be. newlisp c:newlispguiserverbuttom-demo.lsp That m in buttoM killed me!  :)



Things seem t work as expected now. Thank you for your Patience.



What it different about my machine that the path to CMD does not work like others ?
Title:
Post by: Lutz on January 18, 2009, 05:19:41 PM
QuoteWhat it different about my machine that the path to CMD does not work like others ?


no idea, and sorry for the 'm' in button; I am glad it works now ;-)
Title:
Post by: mostlywrong on January 18, 2009, 05:26:19 PM
what is your path and maybe the (env) from newlisp.

programming is a hobby but PC troubles is like an itch.
Title:
Post by: mostlywrong on January 18, 2009, 05:39:42 PM
i found it. i think let me make sure im using the original guiserver.lsp



copied from above:
Quote("Path" "PATH=C:\WINDOWS;C:\WINDOWS\system32;C:\WINDOWS\System32\Wbem;C:\Program Files\UltraEdit-32;C:\Program

 Files\Altiris\Software Virtualization Agent\;C:\Program Files\ATI Technologies\ATI.ACE\Core-Static;C:\Program F

iles\ActiveState Komodo Edit 5\;C:\Program Files\Java\jre6\bin;C:\newlisp")


the problem probably has been floating around for a year or 2 waiting to bite me. I went back to the environment window and looked again. something about the system vs user pain was bugging me. finally i saw that the environment had the word path 2 times. once as a lable and once with an equal. i cant tell you how many time i have seen path=%path%;something in config files. somewhere mine lost the %path% and left the path= hanging in value side. took it out and all is well.



I'd like to thank you again for helping me solve this.
Title:
Post by: Lutz on January 18, 2009, 05:46:56 PM
On my XP-SP2 installation:



> (env)

(("ALLUSERSPROFILE" "C:\Documents and Settings\All Users") ("APPDATA" "C:\Documents and Settings\lutz\Application Data")

 ("CLIENTNAME" "Console")

 ("CommonProgramFiles" "C:\Program Files\Common Files")

 ("COMPUTERNAME" "WINDOWS")

 ("ComSpec" "C:\WINDOWS\system32\cmd.exe")

 ("FP_NO_HOST_CHECK" "NO")

 ("HOMEDRIVE" "C:")

 ("HOMEPATH" "\Documents and Settings\lutz")

 ("LOGONSERVER" "\\WINDOWS")

 ("NEWLISPDIR" "C:\Program Files\newlisp")

 ("NEWLISPLIB_INIT" "c:\lib-init.lsp")

 ("NUMBER_OF_PROCESSORS" "1")

 ("OS" "Windows_NT")

 ("Path" "C:\WINDOWS\system32;C:\WINDOWS;C:\WINDOWS\System32\Wbem;C:\Program Files\newlisp")

 ("PATHEXT" ".COM;.EXE;.BAT;.CMD;.VBS;.VBE;.JS;.JSE;.WSF;.WSH")

 ("PROCESSOR_ARCHITECTURE" "x86")

 ("PROCESSOR_IDENTIFIER" "x86 Family 6 Model 15 Stepping 6, GenuineIntel")

 ("PROCESSOR_LEVEL" "6")

 ("PROCESSOR_REVISION" "0f06")

 ("ProgramFiles" "C:\Program Files")

 ("PROMPT" "$P$G")

 ("SESSIONNAME" "Console")

 ("SystemDrive" "C:")

 ("SystemRoot" "C:\WINDOWS")

 ("TEMP" "C:\DOCUME~1\lutz\LOCALS~1\Temp")

 ("TMP" "C:\DOCUME~1\lutz\LOCALS~1\Temp")

 ("USERDOMAIN" "WINDOWS")

 ("USERNAME" "lutz")

 ("USERPROFILE" "C:\Documents and Settings\lutz")

 ("windir" "C:\WINDOWS"))

>
Title:
Post by: mostlywrong on January 18, 2009, 06:01:06 PM
just in case you missed it. i edited my last post to say i found the trouble and the original guiserver.lsp now works like a champ.
Title:
Post by: xytroxon on January 19, 2009, 12:01:26 PM
Quote from: "mostlywrong"just in case you missed it. i edited my last post to say i found the trouble and the original guiserver.lsp now works like a champ.


Great!



Proving once again that there is no such thing as a stupid question. Your thread helped me to understand a few things more about enviroment vars and paths and to clean up somethings on my machine :)



And by posting this thread, your PATH variable will live on forever**



In my browser, I highlighted and copied your PATH variable to check it out in my editor. (That period in "\ATI.ACE" looked strange to me, but is legal.) Forgetting, I accidentally opened a Google search with it. And to my surprise, Google found this thread!



-- xytroxon



** Forever. or until Google purges it!
Title:
Post by: mostlywrong on January 19, 2009, 01:13:39 PM
wow! Google indexed the pages very quickly. i would not have thought it would be so quick.