classpath

Run java application from command line with external jar files

廉价感情. 提交于 2019-12-05 23:33:29
问题 I have an external jar file(have package structure), which contains the main class, and I can run the app from command line like this: java -jar example.jar But I still have another test.class file outside this jar file, and some classes inside this jar file will invoke the methods in test.class . How can I specify the test.class file to be used by jar file in command line? Tried many ways, always show: NoClassDefFoundError for test.class NB: the test.class file also use class files in

Adding of external jar file into classpath for jBoss 7

泪湿孤枕 提交于 2019-12-05 21:57:08
I would like to include external jar files into classpath for all configurations of jBoss7. Is there any way to do this without moving my files somewhere into jboss lib directories? Or better - is there any way to include all jar files in some external directory? There's a directory called modules where you can put your jars. But to know how to do that you should read this guide. You may also create a global module that is accessible to all deployments. Look at this doc. No answer actually outlines exactly what to do here so here goes. In your jboss-deployment-structure.xml file, which should

How to deal best with SVN and local changes, that should not be committed?

回眸只為那壹抹淺笑 提交于 2019-12-05 21:49:28
I have checked out some projects from SVN repository. To build those projects I have to adjust some configurations (e.g. the classpath and property files) to fit the local enviroment. Now I don't want to commit those changes to the repository. So setting an svn:ignore may help. But what if I want to get updates from the repository without committing those files? Is there any option that allows me to get updates and prevents me from committing? Or what is the best way to deal with local changes? With my application projects I may configure eclipse's launch configurations to lauchn them with the

Cannot reference jdbc.SQLServerDriver in Eclipse (ClassNotFoundException)

放肆的年华 提交于 2019-12-05 21:35:46
I am trying to use the MSSQL driver for JDBC. I have followed the instructions on how to add an external JAR file to the Eclipse Windows IDE as follow: - Download the installation from here http://msdn.microsoft.com/en-us/sqlserver/aa937724.aspx (Microsoft JDBC Driver 4.0 for SQL Server) - Extract the zip to a file location I have extracted it here (c:\MsJDBCforSqlDriver) - In Eclipse Package Explorer right click your project -> Build Path -> Configure Build Path -> Java Build Path -> Libraries Tab- Add External JAR file and then I browse to "C:\MsJDBCforSqlDriver\sqljdbc_4.0\enu\sqljdbc4.jar"

maven assembly create jar with dependency and class path

大城市里の小女人 提交于 2019-12-05 20:22:54
I have a maven project with a lot of dependencies. I want to pack all in a jar with dependency using assembly plugin, but I don't won't all the dependencies jars unpacked in a big mess. I want all of them do go into lib folder, but I don't know how to add the class path. my pom: <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>test.com</groupId> <artifactId>simple-weather</artifactId> <version>1.0

Add jar file to spring-boot classpath at runtime

梦想的初衷 提交于 2019-12-05 20:21:43
I want develop a modular application using spring-boot and plugins . The plugins will be handled with spring-plugin and these are stored in jars files in a directory (for example: /home/application/plugins).How can I add jars files to the application classpath at runtime and loading classes and beans (plugins) that are in these jars files. Best regards, HLicea You need to use PropertiesLauncher instead of JarLauncher: java -cp "yourBoot.jar" -Dloader.path=plugins/ -Dloader.main=your.mainClass org.springframework.boot.loader.PropertiesLauncher This will make java load the jars in the plugins

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

非 Y 不嫁゛ 提交于 2019-12-05 20:17:48
问题 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

Classpath problems:running ant java task with Maven Antrun plugin

自古美人都是妖i 提交于 2019-12-05 19:08:01
When running ant task from maven ant run plugin I can set maven classpath as an ant property. However when I try to run <ant:java task setting this exact classpath I get the error that the reference can not be find. As if the whole classpath is interpreted as one jar. Is there a way to somehow set this classpath to ant java task? (from maven) <plugin> <artifactId>maven-antrun-plugin</artifactId> .... <property name="compile_classpath" refid="maven.compile.classpath"/> .... (from ant) ... <path id="classpath"> <path refid="${compile_classpath}"/> </path> ... <java classname="..." classpathref=

set resource in spring configuration file

你。 提交于 2019-12-05 18:06:41
i am trying to config dozer in spring configuration. when using xml config it would be like <bean class="org.dozer.spring.DozerBeanMapperFactoryBean"> <property name="mappingFiles" value="classpath*:dozer/**/*.dzr.xml"/> </bean> how can i define resources in config file. i tried using ctx.getResource() but i cannot access to ApplicationContext in Configuration class. i tried ContextRefreshedEvent and add resources from there, but still no luck. (afterPropertiesSet is already called and added mappings wont work) public class ContextRefreshedEventBuilder extends ContextRefreshedEvent { public

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

笑着哭i 提交于 2019-12-05 17:41:38
问题 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