classpath

Include multiple jars with classpathentry

…衆ロ難τιáo~ 提交于 2019-12-08 17:36:16
问题 I have an eclipse's .classpath file that looks like this: <?xml version="1.0" encoding="UTF-8"?> <classpath> <classpathentry kind="src" path="src"/> <classpathentry kind="src" path="test"/> <classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER"/> <classpathentry kind="output" path="bin"/> <classpathentry kind="lib" path="/libraries/jee/servlet-api.jar"/> <classpathentry kind="lib" path="/libraries/junit/junit-4.6.jar"/> <classpathentry kind="lib" path="/libraries/log4j

PathMatchingResourcePatternResolver (spring) Usage

余生颓废 提交于 2019-12-08 15:58:33
问题 I'm using : PathMatchingResourcePatternResolver rr = new ...; rr.getResources("classpath*:**/*.class") to get all the classes from the classpath that is made of directories and jars. The call returns only classes from the directories; JAR files are ignored. The following call returns classes from JARs : rr.getResources("classpath*:org/**/*.class") Is that possible to get all the classes without knowing the base package name ? 回答1: It is mentioned in the documentation that when using

Why I can't get the org.h2.Driver? I use maven

ぃ、小莉子 提交于 2019-12-08 15:00:13
问题 I face a problem about connecting to H2 this is my pom.xml: <project> <modelVersion>4.0.0</modelVersion> <groupId>.</groupId> <artifactId>dbConnection</artifactId> <name>Db Connection</name> <packaging>war</packaging> <version>0.1</version> <dependencies> <dependency> <groupId>com.h2database</groupId> <artifactId>h2</artifactId> <version>1.3.176</version> </dependency> </dependencies> </project> and this is my main code import java.sql.*; public class DbConnection { static final String DB_URL

Explanation of Class.getResourceAsStream and how it is set in Tomcat for a simple Java web - app?

陌路散爱 提交于 2019-12-08 12:49:28
I have a very simple java web-application which is deployed to Tomcat. In this application I have some code which goes like this: package com.mywebapp.hello; import javax.servlet.http.*; import java.io.*; public class PdfTwoServlet extends HttpServlet { public void doGet(HttpServletRequest httpServletRequest, HttpServletResponse httpServletResponse) throws IOException { httpServletResponse.setContentType("application/pdf"); InputStream is = PdfTwoServlet.class.getResourceAsStream("/two.pdf"); When I compile my code and deploy it to tomcat, the directory structure goes like this: This is under

java.lang.NoClassDefFoundError error when GlassFish server receives a message

旧时模样 提交于 2019-12-08 11:58:13
问题 Using eclipse mars and glass fish, I have made a local server. In the same package I have a class called MyClass.java. Every time, the server receives a message, I want the message to be processed by MyClass (and its methods). This is what I have: package com.MT; import javax.websocket.OnClose; import javax.websocket.OnError; import javax.websocket.OnMessage; import javax.websocket.OnOpen; import javax.websocket.server.ServerEndpoint; @ServerEndpoint("/serverendpointdemo") public class

getting full classpath from a class

♀尐吖头ヾ 提交于 2019-12-08 11:52:14
问题 I'm looking a utility method so that given a class will return the full classpath required to run this class externally. This means the jar the class is in as well as all jars (or folders) of classes that it uses. UPDATE: there are tools that analyze .class files to find dependencies. This is not what I'm looking for. I'm looking for something that uses Java's reflection API on an already loaded class. I'll settle for something that analyzes byte code, if it goes recursively into classes it

Are there any Java-compilers that leverage an OSGi-environment instead of using the classpath?

孤人 提交于 2019-12-08 11:46:22
问题 Are there any ways to make javac use an existing OSGi-environment for the resolution of build-time dependencies instead of setting the classpath explicitely? I know I could write an OSGi-component that uses the Compiler-API of the JDK, but I think there should be a more straightforward solution. Alternatively, if no such extension is available for javac , does ejc allow such a thing (usable from the command line; I'd be willing to accept an Equinox-only solution with ejc )? 回答1: ant task to

Failing to load properties file in an Eclipse - JUnit test

纵饮孤独 提交于 2019-12-08 11:21:33
I'm running Eclipse Indigo on Mac 10.7.4. I have a Maven (3.0.3) project set up in Eclipse, but when I run a JUnit test from within Eclipse, it is failing to load a properties file in my src/main/resources directory. However, running the same test on the Maven command line passes, so I'm wondering what's wrong with my setup. Here's the test … @Before public void setUp() throws IOException { ... stateService = new StateService("states.properties"); ... } // setUp @Test public void testPositive() { final String stateName = stateService.getStateFromAbbrev("TX"); Assert.assertEquals("Texas",

Failing to load properties file in an Eclipse - JUnit test

◇◆丶佛笑我妖孽 提交于 2019-12-08 06:51:14
问题 I'm running Eclipse Indigo on Mac 10.7.4. I have a Maven (3.0.3) project set up in Eclipse, but when I run a JUnit test from within Eclipse, it is failing to load a properties file in my src/main/resources directory. However, running the same test on the Maven command line passes, so I'm wondering what's wrong with my setup. Here's the test … @Before public void setUp() throws IOException { ... stateService = new StateService("states.properties"); ... } // setUp @Test public void testPositive

Java Classpath error-cannot find my class

蓝咒 提交于 2019-12-08 06:45:55
问题 I am trying to use randoop(automatic test generator for Java) and randoop cannot find my class: eliezer@ubuntu:~/Desktop$ java -ea -classpath \ randoop.1.3.2.jar:home/eliezer/myclasses \ randoop.main.Main gentests \ --testclass=/home/eliezer/Desktop/myclasses/ArrayListError policy = sun.security.provider.PolicyFile@85af80 Throwable thrown while handling command:java.lang.Error:\ classForName(/home/eliezer/Desktop/myclasses/ArrayListError) java.lang.Error: classForName(/home/eliezer/Desktop