2012-01-10 3 views
1

을 내가 Windows에서 다음 디렉토리에있는 파일 male_female.clj 있습니다로드 파일 수 없습니다

C:\Documents and Settings\vreinpa\My Documents\Books\ProgrammingClojure\code\src\examples 

을 REPL을 시작하기 전에 그 디렉토리로 전환 :

U:\>c: 
C:\>cd C:\Documents and Settings\vreinpa\My Documents\Books\ProgrammingClojure\code\src\examples 

나는 그

C:\Documents and Settings\vreinpa\My Documents\Books\ProgrammingClojure\code\src\examples>lein repl 
Warning: classpath not declared dynamic and thus is not dynamically rebindable, but its name suggests otherwise. Please either indicate ^:dynamic classpath or change the name. 
REPL started; server listening on localhost:13278. 

내가 다음 파일을로드하려고하지만, 다음과 같은 오류 얻을 :

을 REPL을 시작합니다
user=> (load-file "male_female.clj") 
user=> FileNotFoundException male_female.clj (The system cannot find the file specified) java.io.FileInputStream.open (:-2) 

여기서 내가 뭘 잘못하고 있니? 파일은 REPL을 시작하기 전에 내가 바꾼 디렉토리에 있습니다.

답변

3

Programming Clojure repo으로 작업하고 계십니까? 난 그냥 복제하고 같은 일을 시도 (맥에도 불구하고) 및 동일한 오류가 발생했습니다.

Git repo의 루트에서 lein repl을 실행 한 다음 (load "examples/male_female")을 사용하십시오. 그런 다음 (in-ns 'examples.male-female)으로 네임 스페이스로 전환하거나 examples.male-female/m 등 완전히 정규화 된 이름으로 완전히 바꾸면이 파일의 정의에 액세스 할 수 있습니다. 이는 저에게 도움이되었습니다.

내가 어디 load-file 보이는지 모르겠지만, load 자바 클래스 경로에서 찾을 것입니다. (System/getProperty "java.class.path")을 사용하여 Clojure REPL에서 클래스 경로를 검사 할 수 있습니다.

내가 load-filedocs을 읽은 후에 그 실험이 너무 일을 발견

편집에 관계없이 내가 프로젝트에 어디의, (load-file "src/examples/male_female.clj"). 이것은 Leiningen과 관련이 있으며 프로젝트 루트로 간주되는 것일 수 있습니다.