Loading a file gives a "Class not found" error - clojure

Basically I'm trying to load a file with functions, to a file thats gonna do the test, both of which are in the same folder on Desktop. However, this line gives an error.
(load-file “file2.clj”)
clojure.lang.Compiler$CompilerException: java.lang.ClassNotFoundException: “file2.clj”, compiling:(C:\..\...\...\...\testfile.clj:1:1)

You seem to have typographic quotes there: (load-file “file2.clj”). Replace them by ASCII quotes: (load-file "file2.clj").

I think you may need to use relative or absolute path to load the file. relative path is recommended... src/{app-name}/filename

Related

ballerina: error while loading built-in package 'ballerina/lang/errors/'

I tried to run a sample .bal file in Ballerina Samples folder which I downloaded from www.ballerinalang.org and I got this error.
This issue seems to be caused by a URI encoding issue owing to the space in the file path (Program Files). Can you try from a different location with no spaces in the file path? Refer Illegal character in path at index 16 for more details on this error.

Error: network 'Scenario' not found

I have installed veins-4.5 and I can run the Erlangen example.
However, when I try to run the example in the subprojects/veins_inet folder it gives "Error: Network 'Scenario' not found, check .ini and .ned files"
However the Scenario.ned is in the same folder as omnetp.ini.
How do I solve this problem?
Many thanks.
If you are using the interface graphic, do it: click in subprojects/veins_inet and next in omnet ++ project -> build all.
Another cause for that error is that the .ini isn't correct.
In particular, if you wish to simulate using Gui (Tkenv), your .ini file should include something like:
[Config MyNetwork]
However, for a command-line simulation (Cmdenv), the .ini file should read instead:
cmdenv-config-name = MyNetwork
in the latter case, you should also add "-u Cmdenv" to your run command.
Confusing between the 2 options above raises the error ""Error: Network '...' not found, check .ini and .ned files".

Get leiningen project root directory

How do I get leiningen project's root directory at runtime?
My problem is that I want to place my sqlite file at the root directory, and access it via source code at different source file.
I don't like to use relative path, so how should I do?
Here are two ways to get the full path of the current working directory, which will be the project's home directory when you start Clojure using lein repl or lein run:
(System/getProperty "user.dir")
and
(.getCanonicalPath (clojure.java.io/file "."))
In the second method, you can insert any path string instead of ".", and it will be interpreted relative to Clojure's current working directory if the string doesn't contain an initial backslash. (I'm not sure whether the behavior is exactly the same on a Windows system.)
(The first method comes from this question; the answers there might be useful for your situation.)
Can you put the sqlite file in the resources folder and then you could use clojure.java.io/resource to retrieve it at run time?

How do you specify the classpath with Leiningen?

In Clojure, I have a Leiningen project with my source in
/src/project/core.clj
I want to add a subdirectory to this. Eg.
/src/project/examples/example-one.clj
In my core.clj file I try to pull in from
project.examples.example-one
But lein compile still tells me
Could not locate project/examples/example_one__init.class or project/examples/example_one.clj on classpath:
Do you have to explicitly update project.clj file if you add a subdirectory to your main code directory? (I don't see that the main code directory itself is given there explicitly.)
if your namespace contains dashes, the corresponding file should contain underscores instead of those dashes. You can read about the reason in here:
why-does-clojure-convert-dashes-in-names-to-underscores-in-the-filesystem
Unless you add different source codes like Java, Groovy etc... by default lein will include all the namespaces in the src folder.
Ah ... seems I can't have a hyphen in file name?
Kind of weird for a Lisp dialect, now I've got used to using hyphens as the default separator in my function names.

emacs cannot open load file make-regexp

I was searching for a bison mode for emacs. I found one implementation (rather old, as it turns out). I have copied it to my .emacs file, (require 'font-lock) and (require 'cc-mode) as suggested on the emacs wiki page. But, the bison-mode.el file has the following line (require 'make-regexp) which gives the error
Cannot open load file: make-regexp
Has the name of the library changed or do I need to install something else to make the file work?
Google "make-regexp.el" (with the double-quotes). You will see that you can download that file separately. Then put it in your load-path.
(I am not a Bison user --- just doing what seems reasonable to find the file you need. But it might be that you already have that file somewhere on your disk. So search your disk first for it. Once you have it, ensure that its location is in your load-path.)