classpath

Eclipse : Project properties don't show Build Path

半腔热情 提交于 2019-12-04 03:25:33
My eclipse does not show the 'Java Build Path' option in a JAVA project's properties. The properties screenshot is attached above. What might be the reason for this ? On the left side lide, there should be an option for Java Build Path.. NoNaMe You may get some help from any of these blogs How do I add a builder to a given project OR check this post Eclipse adding your own build command To resolve this issue follow the below options 1) Go to Project root 2) Select " Project facets " from Properties 3) Check " Java " This fixes the issue I was in the same situation. Found two solutions for this

Is there a way to tell if a classpath resource is a file or a directory?

折月煮酒 提交于 2019-12-04 02:41:45
For example, this snippet throws a NullPointerException(!) on the stream.read() line, assuming the com.google package exists in a JAR somewhere (Guava, for example). ClassLoader classLoader = getClass().getClassLoader(); URL resource = classLoader.getResource("com/google"); InputStream stream = resource.openStream(); System.out.println(stream.toString()); // Fine -- stream is not null stream.read(); // NPE inside FilterInputStream.read()! If com/google is swapped with a package that's in the file system rather than a JAR, then the snippet doesn't crash at all. In fact, it seems to read the

Setting spark classpaths on EC2: spark.driver.extraClassPath and spark.executor.extraClassPath

随声附和 提交于 2019-12-04 02:12:52
Reducing size of application jar by providing spark- classPath for maven dependencies: My cluster is having 3 ec2 instances on which hadoop and spark is running.If I build jar with maven dependencies, it becomes too large(around 100 MB) which I want to avoid this as Jar is getting replicating on all nodes ,each time I run the job. To avoid that I have build a maven package as "maven package".For dependency resolution I have downloaded the all maven dependencies on each node and then only provided above below jar paths: I have added class paths on each node in the "spark-defaults.conf " as

Loading two classes in different JARs

荒凉一梦 提交于 2019-12-04 01:40:56
问题 I got two classes with the same package in different JARs. Until the previous version, both classes were identical, so i had no issues in loading them. Now, one of them has a new method added and if I want to access it, not only should I import the class with that package, i also need to make sure the jar with the correct class comes first in the classpath. i.e. javac -classpath "%classpath%;a.jar;b.jar" MyClasses.. where a.jar has the class with my new method. Now, how do i ensure this when

Classpath for taskdef?

◇◆丶佛笑我妖孽 提交于 2019-12-04 01:23:10
I am defining a new task in Ant. I exported it as a jar and added to my buildfile: <taskdef classname="X" classpath="Y.jar"/> The problem is that this fails at runtime. It tells me it didn't find the class. By adding the jar to the classpath, it is corrected. My question is: Is there a way that I can refer to my jar from the Ant buildfile, without changing the classpath? If you know the path of your jar, inside ant script you can define the classpath for your own task. <taskdef name="myTaskName" classname="com.myorg.myclass"> <classpath> <pathelement location="pathToMyJar.jar"/> </classpath> <

java.lang.ClassNotFoundException: com.mysql.jdbc.Driver

核能气质少年 提交于 2019-12-03 23:51:19
问题 I am getting this error when compiling my java program java.lang.ClassNotFoundException: com.mysql.jdbc.Driver Then I knew that I should add the path of mysql-connector-java-3.1.14-bin.jar to the java classpath. I am using Windows XP, I edited the classpath in the controlpanel/system/enviromental variables the classpath was : .;C:\j2sdk1.4.2_16\jre\lib; so now it became : .;C:\j2sdk1.4.2_16\jre\lib;C:\Program Files\mysql-connector-java-3.1.144 however, i still get the same error, moreover,

Could not find or load main class when calling Weka

拟墨画扇 提交于 2019-12-03 21:51:26
问题 I apologise for my Java noobness but I am trying to use Weka from console and for some reason I get following error: Error: Could not find or load main class weka.classifiers.trees.J48 I am trying following command: java weka.classifiers.trees.J48 -l C:\xampp\htdocs\frequencyreplyallwords.arff -T C:\xampp\htdocs\testfreqrep.arff -p 0 > C:\xampp\htdocs\output.txt I suspect some problems with classpath but since I don't really understand Java is there any simple way of checking if everything is

How to reference an included file in OSGi bundle when performing java.io.File or FileInputStream

依然范特西╮ 提交于 2019-12-03 19:56:24
问题 I am using the aQute Bnd toolset to create an OSGi bundle and have packaged with some dependant 'resource' files. This includes *.css files and *.xsd files in a resources directory I have created. I have included the following in the bundle.bnd file: Include-Resource: resources/=resources/ and when I do a build, the generated *.jar file has the *.css and *.xsd files in the resources directory in the top directory of the jar bundle file. However, in the actual code I am having difficulty in

ClassPathResource does not get the classpath

故事扮演 提交于 2019-12-03 19:09:23
问题 In my application, I would like to use a resource that exist in a folder media/src/main/resources/testMediaExif To get that path, I used this piece of code, located in media/src/main/java/com/project/MyClass.java : ClassPathResource resource = new ClassPathResource("classpath:testMediaExif"); File file = resource.getFile(); String absolutePath = file.getAbsolutePath(); The error shown is: java.io.FileNotFoundException: class path resource [classpath:testMediaExif] cannot be resolved to URL

Including a directory inside web-inf/lib in tomcat classpath

非 Y 不嫁゛ 提交于 2019-12-03 17:34:10
In my webapp; WEB-INF/lib is added in classpath by default which is fine. Now, I want to add spring jar files in my tomcat's classpath. If I put all the jar files inside WEB-INF/lib; it works fine. But if I want to add a directory WEB-INF/lib/spring and put all jar files inside spring directory ; it doesnt work. How can I include WEB-INF/lib/spring in classpath. I would prefer to make changes in web.xml as that is very localised to my webapp. Surely I will not want to make changes in catalina.properties because there all the jar files are loaded in JVM ( not just added in classpath ) You