My application requires that a config directory be available on the classpath when it looks for configurations files under the directory. I currently have dependencies configured like so, though this is probably not the correct way to make a directory available to my application: I am using the application pl…
Tag: classpath
Spring Boot classpath
In the Spring Boot’s docs here, about serving static content, it says: By default Spring Boot will serve static content from a directory called /static (or /public or /resources or /META-INF/resources) in the classpath. I found that all the content in the directory: will be copied inside the classpath, …
How to share code between two projects?
I have two Java projects called A and B. Both of them are web apps deployed as war files. I created them in Eclipse workspace separately. Project B uses a class in project A named MusicMapper. I added the project A to project B’s build path in Eclipse as suggested in this post. So now project B can comp…
classpath – running a java program from the command line
My code compiled fine with the following command: javac -cp “../lib/*” AvroReader.java (lib is where i put my jar files) At run time I get a ClassNotFoundException on the following line: DatumReader<?> dtmrdr = new GenericDatumReader(); It says it can’t find org.apache.avro.generic.Gen…
Cannot find class even when jar file is in working directory
I am struggling to get my Java program to run on AIX. I used Eclipse on Windows to create a runnable Jar file, jRams.jar below. I kept on getting a class not found error, until finally I put all the external libraries in the same directory. Still, I get the class not found error. jremote.jar definitely contai…
How to run a java class with a jar in the classpath?
So, I can do this very well: if ./mypackage/MyClass.class exists. I can also happily do this: if the class file exists in the appropriate part of the jar. Easy stuff. But I can’t for the life of me manage to do something like this: where ./mypackage/MyClass.class exists, and where ./utilities.jar exists…
I am getting “java.lang.ClassNotFoundException: com.google.gson.Gson” error even though it is defined in my classpath
I’m trying to parse some JSON object strings that I’m getting using gson-1.6.jar I have placed it in the same location as my other .jars and have added it to my buildpath in eclipse. The other libraries worked fine when I added them and I can use them without any issues, but when I try to create t…
Java error: Only a type can be imported. XYZ resolves to a package
I get the error: “Only a type can be imported. XYZ resolves to a package.” Someone has explained the cause here but I am not sure what I supposed to do to fix this. FYI: I am using Eclipse. I have added the code that does the importing below. The java.util.* import works fine. Edit: the actual err…