Hi, I am sending this message again, as the last thread went a little too far. I have developed a Java Application that runs lisp code at the back end, and I use ABCL for that. Before using the lisp commands, I load a few .lisp files so that I can call the functions defined in those files. Everything works fine as long as I run the application from Netbeans. When I run the application from the jar file, it throws 'File not found error'. as the lisp files are not a part of file system inside the project jar. I tried to follow the suggestions given by Mark (load “jar:file:/absolute/path/to/file.jar!/path/within/jar/setup.lisp”) It shows the same File not found error. Am i missing something here? As suggested by Ralph to use (load-system-file "path/to/resource.lisp"), I tried to use that, but I was unable to access sys package, please let me know how to do this.
I find the help documentation and tutorials very confusing, and difficult to understand. Any hints will be appreciated. Thanking in anticipation. Regards, Hamda NUIG, Ireland.
On 18 Aug 2015, at 11:45, Hamda Binte Ajmal hamda.binte.ajmal@gmail.com wrote:
Hi, I am sending this message again, as the last thread went a little too far. I have developed a Java Application that runs lisp code at the back end, and I use ABCL for that. Before using the lisp commands, I load a few .lisp files so that I can call the functions defined in those files. Everything works fine as long as I run the application from Netbeans. When I run the application from the jar file, it throws 'File not found error'. as the lisp files are not a part of file system inside the project jar. I tried to follow the suggestions given by Mark (load “jar:file:/absolute/path/to/file.jar!/path/within/jar/setup.lisp”) It shows the same File not found error. Am i missing something here?
Well, 1- did you include setup.lisp in the jar file? 2- did you substitute the paths in the suggestion given by Mark?
Yes, I placed the setup.lisp inside a folder inside the src folder, so I am assuming it is transferred to jar after building the project. Yes, of course I substituted the paths!
On Tue, Aug 18, 2015 at 11:38 AM, Pascal J. Bourguignon < pjb@informatimago.com> wrote:
On 18 Aug 2015, at 11:45, Hamda Binte Ajmal hamda.binte.ajmal@gmail.com wrote:
Hi, I am sending this message again, as the last thread went a little too far. I have developed a Java Application that runs lisp code at the back end, and I use ABCL for that. Before using the lisp commands, I load a few .lisp files so that I can call the functions defined in those files. Everything works fine as long as I run the application from Netbeans. When I run the application from the jar file, it throws 'File not found error'. as the lisp files are not a part of file system inside the project jar. I tried to follow the suggestions given by Mark (load “jar:file:/absolute/path/to/file.jar!/path/within/jar/setup.lisp”)
It shows the same File not found error. Am i missing something here?
Well, 1- did you include setup.lisp in the jar file? 2- did you substitute the paths in the suggestion given by Mark?
-- __Pascal J. Bourguignon__
A .jar file is just a glorified .zip file. You can inspect its contents and see whether the ‘setup.lisp’ file actually were there.
MA
On Aug 18, 2015, at 13:42 , Hamda Binte Ajmal hamda.binte.ajmal@gmail.com wrote:
Yes, I placed the setup.lisp inside a folder inside the src folder, so I am assuming it is transferred to jar after building the project. Yes, of course I substituted the paths!
On Tue, Aug 18, 2015 at 11:38 AM, Pascal J. Bourguignon pjb@informatimago.com wrote:
On 18 Aug 2015, at 11:45, Hamda Binte Ajmal hamda.binte.ajmal@gmail.com wrote:
Hi, I am sending this message again, as the last thread went a little too far. I have developed a Java Application that runs lisp code at the back end, and I use ABCL for that. Before using the lisp commands, I load a few .lisp files so that I can call the functions defined in those files. Everything works fine as long as I run the application from Netbeans. When I run the application from the jar file, it throws 'File not found error'. as the lisp files are not a part of file system inside the project jar. I tried to follow the suggestions given by Mark (load “jar:file:/absolute/path/to/file.jar!/path/within/jar/setup.lisp”) It shows the same File not found error. Am i missing something here?
Well, 1- did you include setup.lisp in the jar file? 2- did you substitute the paths in the suggestion given by Mark?
-- __Pascal J. Bourguignon__
-- Hamda Binte Ajmal +92 344 550 7680
-- Marco Antoniotti
[image: Inline image 1]
It is there, Yes I did check
On Tue, Aug 18, 2015 at 11:56 AM, Marco Antoniotti marcoxa@cs.nyu.edu wrote:
A .jar file is just a glorified .zip file. You can inspect its contents and see whether the ‘setup.lisp’ file actually were there.
MA
On Aug 18, 2015, at 13:42 , Hamda Binte Ajmal <
hamda.binte.ajmal@gmail.com> wrote:
Yes, I placed the setup.lisp inside a folder inside the src folder, so I am
assuming it is transferred to jar after building the project.
Yes, of course I substituted the paths!
On Tue, Aug 18, 2015 at 11:38 AM, Pascal J. Bourguignon <
pjb@informatimago.com> wrote:
On 18 Aug 2015, at 11:45, Hamda Binte Ajmal <
hamda.binte.ajmal@gmail.com> wrote:
Hi, I am sending this message again, as the last thread went a little too
far.
I have developed a Java Application that runs lisp code at the back
end, and I use ABCL for that.
Before using the lisp commands, I load a few .lisp files so that I can
call the functions defined in those files.
Everything works fine as long as I run the application from Netbeans. When I run the application from the jar file, it throws 'File not found
error'.
as the lisp files are not a part of file system inside the project jar. I tried to follow the suggestions given by Mark (load “jar:file:/absolute/path/to/file.jar!/path/within/jar/setup.lisp”) It shows the same File not found error. Am i missing something here?
Well, 1- did you include setup.lisp in the jar file? 2- did you substitute the paths in the suggestion given by Mark?
-- __Pascal J. Bourguignon__
-- Hamda Binte Ajmal +92 344 550 7680
-- Marco Antoniotti
To be more specific
The load statement looks like (load "jar:file:C:/Users/Administrator.NUIG-1Z7HN12/Documents/NetBeansProjects/Interface/dist/Profet.jar!/aima/quicklisp/setup.lisp")
and the error thrown is
"Unhandled lisp condition: Can't ensure directory #P"jar:file:C:/Users/Administrator.NUIG-1Z7HN12/Documents/NetBeansProjects/Interface/dist/Profet.jar!/./" ancestor of
#P"jar:file:C:/Users/Administrator.NUIG-1Z7HN12/Documents/NetBeansProjects/Interface/dist/Profet.jar!/cache/asdf-fasls/07y1rt/asdf.abcl"."
On Tue, Aug 18, 2015 at 11:42 AM, Hamda Binte Ajmal < hamda.binte.ajmal@gmail.com> wrote:
Yes, I placed the setup.lisp inside a folder inside the src folder, so I am assuming it is transferred to jar after building the project. Yes, of course I substituted the paths!
On Tue, Aug 18, 2015 at 11:38 AM, Pascal J. Bourguignon < pjb@informatimago.com> wrote:
On 18 Aug 2015, at 11:45, Hamda Binte Ajmal hamda.binte.ajmal@gmail.com wrote:
Hi, I am sending this message again, as the last thread went a little too far. I have developed a Java Application that runs lisp code at the back end, and I use ABCL for that. Before using the lisp commands, I load a few .lisp files so that I can call the functions defined in those files. Everything works fine as long as I run the application from Netbeans. When I run the application from the jar file, it throws 'File not found error'. as the lisp files are not a part of file system inside the project jar. I tried to follow the suggestions given by Mark (load “jar:file:/absolute/path/to/file.jar!/path/within/jar/setup.lisp”)
It shows the same File not found error. Am i missing something here?
Well, 1- did you include setup.lisp in the jar file? 2- did you substitute the paths in the suggestion given by Mark?
-- __Pascal J. Bourguignon__
-- Hamda Binte Ajmal +92 344 550 7680
Hmmmm. I smell a “Unix-only” file system naming issue in the jar extension.
Cheers — MA
On Aug 18, 2015, at 14:35 , Hamda Binte Ajmal hamda.binte.ajmal@gmail.com wrote:
To be more specific
The load statement looks like (load "jar:file:C:/Users/Administrator.NUIG-1Z7HN12/Documents/NetBeansProjects/Interface/dist/Profet.jar!/aima/quicklisp/setup.lisp")
and the error thrown is
"Unhandled lisp condition: Can't ensure directory #P"jar:file:C:/Users/Administrator.NUIG-1Z7HN12/Documents/NetBeansProjects/Interface/dist/Profet.jar!/./" ancestor of #P"jar:file:C:/Users/Administrator.NUIG-1Z7HN12/Documents/NetBeansProjects/Interface/dist/Profet.jar!/cache/asdf-fasls/07y1rt/asdf.abcl"."
On Tue, Aug 18, 2015 at 11:42 AM, Hamda Binte Ajmal hamda.binte.ajmal@gmail.com wrote: Yes, I placed the setup.lisp inside a folder inside the src folder, so I am assuming it is transferred to jar after building the project. Yes, of course I substituted the paths!
On Tue, Aug 18, 2015 at 11:38 AM, Pascal J. Bourguignon pjb@informatimago.com wrote:
On 18 Aug 2015, at 11:45, Hamda Binte Ajmal hamda.binte.ajmal@gmail.com wrote:
Hi, I am sending this message again, as the last thread went a little too far. I have developed a Java Application that runs lisp code at the back end, and I use ABCL for that. Before using the lisp commands, I load a few .lisp files so that I can call the functions defined in those files. Everything works fine as long as I run the application from Netbeans. When I run the application from the jar file, it throws 'File not found error'. as the lisp files are not a part of file system inside the project jar. I tried to follow the suggestions given by Mark (load “jar:file:/absolute/path/to/file.jar!/path/within/jar/setup.lisp”) It shows the same File not found error. Am i missing something here?
Well, 1- did you include setup.lisp in the jar file? 2- did you substitute the paths in the suggestion given by Mark?
-- __Pascal J. Bourguignon__
-- Hamda Binte Ajmal +92 344 550 7680
-- Hamda Binte Ajmal +92 344 550 7680
-- Marco Antoniotti
On Aug 18, 2015, at 14:35 , Hamda Binte Ajmal hamda.binte.ajmal@gmail.com wrote:
To be more specific
The load statement looks like (load "jar:file:C:/Users/Administrator.NUIG-1Z7HN12/Documents/NetBeansProjects/Interface/dist/Profet.jar!/aima/quicklisp/setup.lisp")
and the error thrown is
"Unhandled lisp condition: Can't ensure directory #P"jar:file:C:/Users/Administrator.NUIG-1Z7HN12/Documents/NetBeansProjects/Interface/dist/Profet.jar!/./" ancestor of #P"jar:file:C:/Users/Administrator.NUIG-1Z7HN12/Documents/NetBeansProjects/Interface/dist/Profet.jar!/cache/asdf-fasls/07y1rt/asdf.abcl"."
At last!
So the problem you have here is that when loading setup.lisp it tries to compile asdf.lisp and to save the fasl file INSIDE the jar, as per the cache directory determined by setup.lisp.
IIRC, quicklisp respects the XDG Base Directory Specification to find out the cache directory where to save the fasl. So one option could be to set the required XDG environment variables to direct it elsewhere than inside the jar.
$ export XDG_CACHE_HOME=$HOME/.cache $ abcl
could help.
You might want to send a feature request to Xach (quicklisp) so that it would detect this situation and adjust to a more convenient behavior.
"Pascal J. Bourguignon" pjb@informatimago.com writes:
On Aug 18, 2015, at 14:35 , Hamda Binte Ajmal hamda.binte.ajmal@gmail.com wrote:
To be more specific
The load statement looks like (load "jar:file:C:/Users/Administrator.NUIG-1Z7HN12/Documents/NetBeansProjects/Interface/dist/Profet.jar!/aima/quicklisp/setup.lisp")
and the error thrown is
"Unhandled lisp condition: Can't ensure directory #P"jar:file:C:/Users/Administrator.NUIG-1Z7HN12/Documents/NetBeansProjects/Interface/dist/Profet.jar!/./" ancestor of #P"jar:file:C:/Users/Administrator.NUIG-1Z7HN12/Documents/NetBeansProjects/Interface/dist/Profet.jar!/cache/asdf-fasls/07y1rt/asdf.abcl"."
At last!
So the problem you have here is that when loading setup.lisp it tries to compile asdf.lisp and to save the fasl file INSIDE the jar, as per the cache directory determined by setup.lisp.
IIRC, quicklisp respects the XDG Base Directory Specification to find out the cache directory where to save the fasl. So one option could be to set the required XDG environment variables to direct it elsewhere than inside the jar.
$ export XDG_CACHE_HOME=$HOME/.cache $ abcl
could help.
You might want to send a feature request to Xach (quicklisp) so that it would detect this situation and adjust to a more convenient behavior.
Quicklisp does not look at XDG environment variables. The intent is that if no sufficiently-new ASDF is already loaded, it will try to compile to a fasl file in ~/quicklisp/cache/asdf-fasls/<hash>/.
I was going to suggest loading a sufficiently new ASDF before trying to load the quicklisp/setup.lisp file.
However, now that I look at the Quicklisp setup code, I see that it *unconditionally* does (ensure-directories-exist ...) on the asdf fasl cache directory, even though it should only be done if Quicklisp needs to compile its own ASDF.
I think one option is to preload the asdf-fasl cache and put that in the jar.
I'll open a Quicklisp issue for the unconditional fasl cache directory creation problem and try to fix it soon.
Zach
The only reason I installed quicklisp was that I needed to use cl-ppcre package. This is the post I posted about months ago when I started with my application development http://stackoverflow.com/questions/28172357/run-an-abcl-code-that-uses-cl-cp...
On Tue, Aug 18, 2015 at 1:21 PM, Zach Beane xach@xach.com wrote:
"Pascal J. Bourguignon" pjb@informatimago.com writes:
On Aug 18, 2015, at 14:35 , Hamda Binte Ajmal <
hamda.binte.ajmal@gmail.com> wrote:
To be more specific
The load statement looks like (load
"jar:file:C:/Users/Administrator.NUIG-1Z7HN12/Documents/NetBeansProjects/Interface/dist/Profet.jar!/aima/quicklisp/setup.lisp")
and the error thrown is
"Unhandled lisp condition: Can't ensure directory
#P"jar:file:C:/Users/Administrator.NUIG-1Z7HN12/Documents/NetBeansProjects/Interface/dist/Profet.jar!/./"
ancestor of
#P"jar:file:C:/Users/Administrator.NUIG-1Z7HN12/Documents/NetBeansProjects/Interface/dist/Profet.jar!/cache/asdf-fasls/07y1rt/asdf.abcl"."
At last!
So the problem you have here is that when loading setup.lisp it tries to compile asdf.lisp and to save the fasl file INSIDE the jar, as per the cache directory determined by setup.lisp.
IIRC, quicklisp respects the XDG Base Directory Specification to find out the cache directory where to save the fasl. So one option could be to set the required XDG environment variables to direct it elsewhere than inside the jar.
$ export XDG_CACHE_HOME=$HOME/.cache $ abcl
could help.
You might want to send a feature request to Xach (quicklisp) so that it would detect this situation and adjust to a more convenient behavior.
Quicklisp does not look at XDG environment variables. The intent is that if no sufficiently-new ASDF is already loaded, it will try to compile to a fasl file in ~/quicklisp/cache/asdf-fasls/<hash>/.
I was going to suggest loading a sufficiently new ASDF before trying to load the quicklisp/setup.lisp file.
However, now that I look at the Quicklisp setup code, I see that it *unconditionally* does (ensure-directories-exist ...) on the asdf fasl cache directory, even though it should only be done if Quicklisp needs to compile its own ASDF.
I think one option is to preload the asdf-fasl cache and put that in the jar.
I'll open a Quicklisp issue for the unconditional fasl cache directory creation problem and try to fix it soon.
Zach
Hamda Binte Ajmal hamda.binte.ajmal@gmail.com writes:
The only reason I installed quicklisp was that I needed to use cl-ppcre package. This is the post I posted about months ago when I started with my application development http://stackoverflow.com/questions/28172357/run-an-abcl-code-that-uses-cl-cp...
Dave Cooper discusses on option for doing something like this, without Quicklisp (OR asdf):
http://gendl.blogspot.com/2013/03/saving-images-with-asdf3.html
I don't know how well it's supported in ABCL, though.
Zach
I have resolved the issue, I simply got rid of dependency on cl-ppcre as a very small portion of my lisp code was using that. So, No need of quicklisp, hence no error when running the .jar directly.
Java code now is : private static String GetFullPath(String relPath) { URL url= LispConnector.class.getResource(relPath); System.out.println(url.toString()); return url.toString(); } private static void Load_Aima() { String path = GetFullPath("aima/defpackage.lisp"); execute("(load " + """ + path + "")"); .....................
}
All is well now!
Thanks everyone, especially Mark for his help. Regards, Hamda
On Tue, Aug 18, 2015 at 2:18 PM, Zach Beane xach@xach.com wrote:
Hamda Binte Ajmal hamda.binte.ajmal@gmail.com writes:
The only reason I installed quicklisp was that I needed to use cl-ppcre package. This is the post I posted about months ago when I started with my application development
http://stackoverflow.com/questions/28172357/run-an-abcl-code-that-uses-cl-cp...
Dave Cooper discusses on option for doing something like this, without Quicklisp (OR asdf):
http://gendl.blogspot.com/2013/03/saving-images-with-asdf3.html
I don't know how well it's supported in ABCL, though.
Zach
On Aug 18, 2015, at 13:35, Hamda Binte Ajmal hamda.binte.ajmal@gmail.com wrote:
To be more specific
The load statement looks like (load "jar:file:C:/Users/Administrator.NUIG-1Z7HN12/Documents/NetBeansProjects/Interface/dist/Profet.jar!/aima/quicklisp/setup.lisp")
and the error thrown is
"Unhandled lisp condition: Can't ensure directory #P"jar:file:C:/Users/Administrator.NUIG-1Z7HN12/Documents/NetBeansProjects/Interface/dist/Profet.jar!/./" ancestor of #P"jar:file:C:/Users/Administrator.NUIG-1Z7HN12/Documents/NetBeansProjects/Interface/dist/Profet.jar!/cache/asdf-fasls/07y1rt/asdf.abcl"."
[On the road until later today so just a brief reply]
I think you *are* loading setup.lisp from the jar, and that it contains load-time code that is producing these errors. To verify that this is indeed the case, I would suggest creating a file with a very simple form, such as
(format t “Hello Jar World!~&”)
to see if that indeed loads. Then, you know you are successfully loading lisp code from a jar, so what remains is to figure out what the problem is when the rest of your code executes within the jar.
I believe that your error is the result of ASDF attempting to write a fasl in the jar, which is odd as ASDF has ABCL-specific code which should creates the necessary output translation from a jar (which is not a valid target of writes) to the local filesystem. What’s odd here is that you seem to be using a different version of “asdf.lisp” than what ships with ABCL. Or is this Quicklisp attempting to install ASDF?
Any chance of getting a build recipe for the JAR file you are creating here? Or, barring that, putting a binary up somewhere to inspect?
Setting CL:*LOAD-VERBOSE* to t in ~/.abclrc can also help you get idea of what is being loaded.
Back later, Mark
Thank you mark, I used quicklisp to install asdf, which is the cause of the problem here now. Any link on how to install asdf without using quicklisp?
More detailed response later, Regards, Hamda
On Tue, Aug 18, 2015 at 1:17 PM, Mark Evenson evenson@panix.com wrote:
On Aug 18, 2015, at 13:35, Hamda Binte Ajmal hamda.binte.ajmal@gmail.com wrote:
To be more specific
The load statement looks like (load "jar:file:C:/Users/Administrator.NUIG-1Z7HN12/Documents/NetBeansProjects/Interface/dist/Profet.jar!/aima/quicklisp/setup.lisp")
and the error thrown is
"Unhandled lisp condition: Can't ensure directory
#P"jar:file:C:/Users/Administrator.NUIG-1Z7HN12/Documents/NetBeansProjects/Interface/dist/Profet.jar!/./" ancestor of
#P"jar:file:C:/Users/Administrator.NUIG-1Z7HN12/Documents/NetBeansProjects/Interface/dist/Profet.jar!/cache/asdf-fasls/07y1rt/asdf.abcl"."
[On the road until later today so just a brief reply]
I think you *are* loading setup.lisp from the jar, and that it contains load-time code that is producing these errors. To verify that this is indeed the case, I would suggest creating a file with a very simple form, such as
(format t “Hello Jar World!~&”)
to see if that indeed loads. Then, you know you are successfully loading lisp code from a jar, so what remains is to figure out what the problem is when the rest of your code executes within the jar.
I believe that your error is the result of ASDF attempting to write a fasl in the jar, which is odd as ASDF has ABCL-specific code which should creates the necessary output translation from a jar (which is not a valid target of writes) to the local filesystem. What’s odd here is that you seem to be using a different version of “asdf.lisp” than what ships with ABCL. Or is this Quicklisp attempting to install ASDF?
Any chance of getting a build recipe for the JAR file you are creating here? Or, barring that, putting a binary up somewhere to inspect?
Setting CL:*LOAD-VERBOSE* to t in ~/.abclrc can also help you get idea of what is being loaded.
Back later, Mark
-- "A screaming comes across the sky. It has happened before but there is nothing to compare to it now.”
armedbear-devel@common-lisp.net