classpath

Classpath including JAR within a JAR

◇◆丶佛笑我妖孽 提交于 2019-12-16 19:30:49
问题 Is it possible to specify a Java classpath that includes a JAR file contained within another JAR file? 回答1: If you're trying to create a single jar that contains your application and its required libraries, there are two ways (that I know of) to do that. The first is One-Jar, which uses a special classloader to allow the nesting of jars. The second is UberJar, (or Shade), which explodes the included libraries and puts all the classes in the top-level jar. I should also mention that UberJar

Setting the classpath

纵然是瞬间 提交于 2019-12-14 04:09:07
问题 hi i have written one shell script which is performing 1 task. java -jar abc.jar $* -adminid $j_username before this command i want to set classpath(or want to refer) of all jars which are in particular lib folder, how to do that? 回答1: set CLASSPATH=pathtojars1;pathtojars2 before your java command. Or: java -classpath 回答2: One way to do it would be: set CP=abc.jar:someother.jar java -cp $CP your.main.Class $* -adminid $j_username It is worth while to note that when using -jar you can't

Uuse both a manifest.mf and also pass jars using cp?

*爱你&永不变心* 提交于 2019-12-14 03:54:05
问题 I have a jar that uses a manifest for some of its dependencies which are packed up into a jar using maven. Is it possible to run the jar with both the internal packaged up jars, which are described in the manifest, and jars that I pass using -cp at application launch? Or is it one or the other? 来源: https://stackoverflow.com/questions/19693729/uuse-both-a-manifest-mf-and-also-pass-jars-using-cp

ClassNotFoundException for class file on classpath

喜欢而已 提交于 2019-12-14 03:52:04
问题 I have the following code: // Test TODO remove try { System.out.println(System.getProperties().getProperty("java.class.path")); this.getClass().getClassLoader().loadClass("mypackage.MyClass"); } catch (ClassNotFoundException e) { // TODO Auto-generated catch block e.printStackTrace(); } Now the output shows me, that the class is on the classpath, i.e.: /...some/path.../workspace/project/target/test-classes:/rest/of/the/classpath java.lang.ClassNotFoundException: mypackage.MyClass ...here be

<mvc:resources> how to use the classpath location

人走茶凉 提交于 2019-12-14 03:44:55
问题 I've searched high and low in order to solve this problem, but I can't find a solution. The problem is as follows: I have an Spring-mvc webapp build on a Tomcat 7 server - 7.0.12 to be precise - and I'm having trouble getting the <mvc:resources> tag to work correct. As you will see below the <mvc:resources> works for the old resource folder, but I prefer having the resource folder in the /WEB-INF/web/ directory. MediorkoorVOICES-Web-servlet.xml: <?xml version="1.0" encoding="UTF-8"?> <beans

Eclipse and Classpath

心已入冬 提交于 2019-12-14 03:23:13
问题 I swear I'm going insane. JDeveloper runs my project with not a single complaint. If I do "java -cp /usr/share/java/mysql.jar:. MAIN.java", it works like a charm. But Eclipse says "[ censored ] you" and ignores my classpath settings. I open the Run > Run... menu, and add the mysql jar in the classpath tab, but time and time again, I keep getting "No suitable driver found". Now, I shouldn't have to add the jar to the build path ---otherwise, what's the point of using JDBC if I'm gonna rebuild

Hadoop WordCount.java Dependency Issues

给你一囗甜甜゛ 提交于 2019-12-14 03:16:02
问题 I am trying to compile WordCount.java file into jar inside of /Desktop/Hadoop/playground/src. Here's the command I am using. javac -classpath hadoop-1.2.1-core.jar -d playground/classes playground/src/WordCount.java The compiler seem to be getting invoked, however I am getting tons of errors like this error: package org.apache.hadoop.conf does not exist import org.apache.hadoop.conf.Configuration How do I go about fixing this? May be there is an answer to this issue already. However I could

Could not load class when executed with -cp option

喜夏-厌秋 提交于 2019-12-14 02:33:40
问题 Java not able to find the class file when executed with -cp option as below javac -cp ~/softwares/pig-0.12.0/pig-0.12.0.jar PR.java Compilation is successful. However when I run the above generated class I am getting error java -cp ~/softwares/pig-0.12.0/pig-0.12.0.jar PR Error: Could not find or load main class PR If I remove the -cp I am getting below error which is expected java PR Exception in thread "main" java.lang.NoClassDefFoundError: org/apache/pig/PigServer at PR.runPigScript(PR

Eclipse gives error “… is not a valid location for linked resources.”

不打扰是莪最后的温柔 提交于 2019-12-14 01:33:55
问题 When I try to add a new Classpath Variable in Eclipse for my Build Path configuration, and the path I add is a directory that the current workspace is a subdirectory of, Eclipse gives the error: 'C:\JavaStuff' is not a valid location for linked resources. Why does Eclipse impose this restriction? I can't think of a good reason for it... I might want to put my JARs in C:\JavaStuff\libs and have my workspace in C:\JavaStuff\workspace , then reference libs (on my machine) via JAVASTUFF_DIR\libs

Classpath empty when adding <outputDirectory> to pom

南笙酒味 提交于 2019-12-14 01:12:56
问题 I am using this simple pom.xml to generate an OSGi-bundle using the maven-bundle-plugin : <project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> <modelVersion>4.0.0</modelVersion> <groupId>de.test.osgi</groupId> <artifactId>test</artifactId> <version>0.0.1-SNAPSHOT</version> <packaging>bundle</packaging> <build> <plugins> <plugin> <groupId>org