I need to compile and run simple code using the gson library, but I can’t use Maven, Gradle or the IDE. The directory contains Main.java and gson-2.9.0.jar javac -cp gson-2.9.0.jar Main.java works correctly and creates Main.class But when I run java -cp ./*: Main, I get I also tried the following commands: But all these commands give the same result.
Tag: classpath
In Java, verify all methods in a class path that are called actually exist within that classpath [closed]
Given a classpath (e.g. a set of jar files) I would like to know, do any of these jar files make a method call (ignoring reflection) to a method which doesn’t exist within the class path. For example …
cmd window does not recognize the classpath option
when I enter like java -classpath .;mariadb-java-client-2.7.1.jar MusicMain error occurs like this Usage: java [options]
Resource won’t load when exported as a JAR
Using the following code to set a system property: ClassLoader classLoader = StartMain.class.getClassLoader(); URL resource = classLoader.getResource(“com/myname/lib/chromedriver/…
How can I import a custom package in IntelliJ IDEA (Java)?
There is such term like CLASSPATH which is using that JVM could find custom classes or jar files to import them to another packages (Am I right?). So, I created a few custom classes and placed them …
Is it possible to mix –class-path and –module-path in javac (JDK 9)?
When I compile a module that depends on other modules I’ve compiled previously I have to specify the –module-path
Concatenate list of paths in bash-script, with colon as separator
I have the following difficult to read script consisting of a single command: As slight readability improvement I would like to list all the paths after the -classpath in a separate variable, each aligned after the other: This way I can easier add and remove the paths, and sort them in Vim. My question is: how to join them back
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 …
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 (not containing MyClass, of course). Am I about to
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 …