classpath

How to resolve Maven exec plugin: classpath too long error?

风流意气都作罢 提交于 2019-12-10 23:09:36
问题 I have a large Java project with a large number of jar file dependencies. When I try to run the project (using exec) from Eclipse or Netbeans, Maven throws an exception which turns out to be a too large number of entries on the classpath (only 2/3 of the needed entries are included). Does anyone know a workaround for this? (Except from building an executable jar and running it from terminal.) Is it possbile to "extend" the "classpath-buffer"-size? 回答1: This is a Maven exec plugin bug, it is

Managing many jars via WebAppContext extraClasspath

蹲街弑〆低调 提交于 2019-12-10 19:07:18
问题 I have an embedded jetty server that hot deploys webapps. When deploying the other wars, I add a deployment descriptor.xml to the directory to configure the webappcontext. I wish to add a DIRECTORY of jars that gets built in another location to the classpath of the hot deployed war (/extJars). I see how to do this within the webapp descriptor.xml, and I can accomplish this by stating individual jars, but I have tried multiple configurations for trying to simply read ALL jars in this directory

class not found exception for com.mysql.jdbc.Driver not a classpath problem

不问归期 提交于 2019-12-10 18:25:04
问题 I've been working on this for weeks, and now I'm just running in circles. I'm getting the runtime error: " class not found exception in [class] while getting connection com.mysql.jdbc.Driver ". The connection function is as follows: /** * @return a MySQL connection to the server as specified above */ private static Connection getConnection() { Connection con = null; try { Class.forName("com.mysql.jdbc.Driver"); con = DriverManager.getConnection(url, username, password); } catch

Glassfish 4.1 - Latest Jersey version

浪子不回头ぞ 提交于 2019-12-10 18:21:28
问题 We want to integrate latest Jersey Version in Glassfish 4.1. Glassfish provides Jersey 2.21.0 implementations, so we added Jersey 2.22.2 to WEB-INF/lib. It seams to work with new version. But is this the correct solution? Will Glassfish always put the libraries in WEB-INF before its own to the classpath? 回答1: If it is not an option to modify glassfish installation, you still may force glassfish to consider the libs in your web app before the global ones. You just need to provide file

Generate source using jaxb from an xsd that is in my classpath

岁酱吖の 提交于 2019-12-10 18:17:42
问题 I'm trying to generate java classes using JAXB from a schema in my class path. For CXF I generated java classes from a wsdl in my classpath like so: <wsdlOptions> <wsdlOption> <wsdl>classpath:wsdl/MetsInterfaceService.wsdl</wsdl> </wsdlOption> </wsdlOptions> I was hoping something similar existed with JAXB. I did try using a catalog but this seems to be more in line when a schema (stored in the same maven module) imports another schema in the classpath. Any help would be appreciated! -Sal 回答1

What is the difference between maven.plugin.classpath and maven.runtime.classpath

醉酒当歌 提交于 2019-12-10 18:14:45
问题 Maven recognizes 4 classpaths: maven.compile.classpath: Classes and jars which need to be on classpath when compiling your source codes. So basically for maven-compiler-plugin maven.test.classpath: Classes and jars which need to be on classpath when running unit tests or integration tests maven.runtime.classpath: I understood that maven.runtime.classpath contains jars and classes maven itself needs to run. maven.plugin.classpath: I understood that this classpath is pass to maven plugin when

loading a class from out of classpath by using Java Reflection

十年热恋 提交于 2019-12-10 18:00:44
问题 I want to load class from that is not in class path. is there any way that I load class by file path without being in classpath ? for example ClassLoader.load("c:\MyClass.class"); 回答1: Example taken from here: // Create a File object on the root of the directory containing the class file File file = new File("c:\\myclasses\\"); try { // Convert File to a URL URL url = file.toURL(); // file:/c:/myclasses/ URL[] urls = new URL[]{url}; // Create a new class loader with the directory ClassLoader

Problem accessing file from jar file in Java

早过忘川 提交于 2019-12-10 17:44:37
问题 I have a jar called App.jar and it's structure is as follows App.jar | | |---xyzfolder | | | |--config | | | |--config.properties | | |---com (contains classes) | |--MyClass.class Now what I want is that I want to access config.properties file from MyClass.class 回答1: Have you tried the following? this.getClass().getClassLoader().getResourceAsStream("classpath:/xyzfolder/config/config.properties"); see http://download.oracle.com/javase/1.5.0/docs/api/java/lang/ClassLoader.html

Adding additional java files to playframework classpath

偶尔善良 提交于 2019-12-10 17:17:39
问题 I have a project that shares models with my android project. I have a separate eclipse project just for models and other shared code. I add this to my play project as a dependency in eclipse. In eclipse, play compiles and starts without problem. However, I went to deploy to GAE and found that the compilation stage of play's packaging fails because it can't find the models. I suspect I could hack the ant build files, but that seems brittle. Is there a standard way to add extra directories to

.classpath contents update in eclipse

╄→尐↘猪︶ㄣ 提交于 2019-12-10 17:05:50
问题 I downloaded an eclipse project that has a .classpath which has class entries that need to be updated. What does this do exactly? Can I change the content of the .classpath in eclipse? I opened User Libraries in eclipse expecting it to have the same content as .classpath, but there is nothing in it. 回答1: The contents of the .classpath file can be changed by modifying the project Java Build Path parameters. For instance, in Package Explorer, right-click on the project and select Properties...