classpath

Eclipse classpath entries only used for tests

霸气de小男生 提交于 2019-11-27 09:25:05
In Maven, you can have compile-time dependencies and test dependencies. This is a feature I love, and the M2Eclipse plugin makes this available in Eclipse, too, which is great. So if I add jmock.jar to my project as a test dependency, it will show up on the classpath for JUnit tests, but won't be present when I'm debugging the application itself. This is exactly what I'd like to achieve now, but without M2Eclipse or Maven. Is there a way to do this in plain Eclipse? (Possibly without installing any plugins.) I'm afraid the answer is that you can't. There are 2 open issues which were postponed

List of dependency jar files in Maven

我是研究僧i 提交于 2019-11-27 09:24:42
问题 Using Maven 2, is there a way I can list out the jar dependencies as just the file names? mvn dependency:build-classpath can list the jar files, but that will include the full path to their location in my local repository. What I need is essentially just a list of the file names (or the file names that the copy-dependencies goal copied). So the list I need would be something like activation-1.1.jar,antlr-2.7.6.jar,aopalliance-1.0.jar etc... ideally as a maven property, but I guess, a file

I am getting “java.lang.ClassNotFoundException: com.google.gson.Gson” error even though it is defined in my classpath

别来无恙 提交于 2019-11-27 09:24:00
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 the JSON object, I get the titular error. I've looked through the other questions with this error, but I couldn't find a solution that didn't involve something that I've tried or something unrelated. I import it near the top using: import com.google.gson.Gson; Then use it later in a static function

CLASSPATH, Java Buld Path (eclipse), and WEB-INF\LIB : what to use, when, and why?

独自空忆成欢 提交于 2019-11-27 09:20:26
问题 I recently switched to J2EE from .NET, and am confused about where to put JAR files. I know that the CLASSPATH, WEB-INF, and Eclipse's Java Web Path are all places where JARs can be stored, but I'm confused about which folder to use, when, and why. First off, we have the CLASSPATH. I usually set this by going into "Environment Variables" inside "My Computer." I know that this is the default place where the Java compiler looks for JAR files. When I add a folder or a JAR to my CLASSPATH

Java Class.forName() from distant directory

非 Y 不嫁゛ 提交于 2019-11-27 09:19:37
I am currently loading Java classes using Class.forName() to load it. clazz = Class.forName("interfaces.MyClass"); But now I want to load classes from different directory, I have tried to set classpath by clazz = Class.forName("-cp \"C:/dir\" distantinterfaces.DistantClass"); With no success and ClassNotFoundException . Full path to distant class is: C:/dir/distantinterfaces/DistantClass.class Use an URLClassLoader for this. The code might be something along the lines of: File f = new File("C:/dir"); URL[] cp = {f.toURI().toURL()}; URLClassLoader urlcl = new URLClassLoader(cp); Class clazz =

Including jar files in class path

这一生的挚爱 提交于 2019-11-27 08:56:30
I m running a java program from a batch file which refences some external jar files .How do i include those jar files in my batch file.Please help Look at the Sun's official documentation: Setting the class path to understand your options. A quick way would be just to include your JAR(s) after the -cp : on Windows java -cp C:\java\MyClasses\myclasses.jar;C:\java\MyClasses\myclassesAnother.jar utility.myapp.Cool on Linux/Unix java -cp /opt/thirdparty/myclasses.jar:/opt/thirdparty/myclassesAnother.jar utility.myapp.Cool You need to set classpath http://download.oracle.com/javase/1.3/docs

How do I get my Eclipse-Maven project to automatically update its classpath when I change a dependency in my pom.xml file?

谁说我不能喝 提交于 2019-11-27 08:56:05
I’m using Eclipse Mars with Maven (v 3.3). When I update a dependency in my pom (change the version), my Eclipse-Maven project doesn’t pick it up, even when I right click my project, and select “Maven” -> “Update Project.” I know this because I do not see compilation errors in the Eclipse Java editor that I see when I build the project on the command line using mvn clean install When I remove the project from the workspace and re-import it, then things get back to normal. However this is a cumbersome process. How do I get my Maven-Eclipse project to automatically detect changes in my pom and

Java - setting classpath

て烟熏妆下的殇ゞ 提交于 2019-11-27 08:54:04
My sample application tells me: No 'qtjambi-deployment.xml' found in classpath, loading libraries via 'java.library.path' I wish for my application to use the qtjambi-deployment.xml , but unfortunately can't find the appropriate setting in IntelliJ IDEA 10.5 . Could someone help me? You can right click on any directory in your IntelliJ project, select "Mark Directory As...", and choose "Source Root". That director folder will change color from yellow to blue; IntelliJ considers all those directories to be in your CLASSPATH. From the top menu click 'Run' => 'Edit Configurations' Choose the

Can I force the order of dependencies in my classpath with Gradle?

拟墨画扇 提交于 2019-11-27 08:21:11
问题 A project runs on Google App Engine. The project has dependency that uses a class that can't be invoked on App Engine due to security constraints (it's not on the whitelist). My (very hacky) solution was to just copy a modified version of that class into my project (matching the original Class's name and package) that doesn't need the restricted class. This works on both dev and live, I assume because my source appears in the classpath before my external dependencies. To make it a bit cleaner

Getting a java.lang.ClassNotFoundException even though i've specified the correct jar with -cp

假如想象 提交于 2019-11-27 07:55:12
问题 java.lang.ClassNotFoundException: com.hazelcast.core.Hazelcast This bit is strange though, because i've added hazelcast-1.8.5.jar to the classpath when i'm running java: java -cp hazelcast-1.8.5.jar -jar myapp.jar So i cannot understand why i'm getting the ClassNotFoundException, when the hazelcast jar is well and truly present, and specified in the command line. Any ideas please? By the way, hazelcast is pretty fricking sweet! 回答1: From the -jar option docs: When you use this option, the JAR