war

How do I run a class in a WAR from the command line?

落花浮王杯 提交于 2019-11-26 04:20:06
问题 I have a Java class which has a main and I used to run as a standalone app from the command line e.g. java -jar myjar.jar params I needed to repackage the code to run under apache and all my code, including the entry point class from the old jar, has ended up in a WAR file for easy deplyment into the web server. However, I still want to be able to run it from the command line and the code has not changed and is all in there, I just can\'t figure out how to get it to run. Here\'s what I tried.

Oracle JDBC ojdbc6 Jar as a Maven Dependency

落爺英雄遲暮 提交于 2019-11-26 03:05:29
问题 I cannot seem to get Maven to bundle the ojdbc6.jar file into my project\'s war file. I have it working within the POM file when specifying a dependency directly for Hibernate tools. But it won\'t get bundled with the project\'s war file, and therefore my project won\'t run on Tomcat. I have tried every solution I can find out there on the net, including those specified for this question here: Find Oracle JDBC driver in Maven repository Most recently, I did the following: Download the jar

Appending files to a zip file with Java

旧城冷巷雨未停 提交于 2019-11-26 01:29:48
问题 I am currently extracting the contents of a war file and then adding some new files to the directory structure and then creating a new war file. This is all done programatically from Java - but I am wondering if it wouldn\'t be more efficient to copy the war file and then just append the files - then I wouldn\'t have to wait so long as the war expands and then has to be compressed again. I can\'t seem to find a way to do this in the documentation though or any online examples. Anyone can give

What is WEB-INF used for in a Java EE web application?

社会主义新天地 提交于 2019-11-26 01:25:02
问题 I\'m working on a Java EE web application with the following source code structure: src/main/java <-- multiple packages containing java classes src/test/java <-- multiple packages containing JUnit tests src/main/resources <-- includes properties files for textual messages src/main/webapp/resources <-- includes CSS, images and all Javascript files src/main/webapp/WEB-INF src/main/webapp/WEB-INF/tags src/main/webapp/WEB-INF/views The bit I\'m interested in is WEB-INF - it contains web.xml , XML

How to add JAR libraries to WAR project without facing java.lang.ClassNotFoundException? Classpath vs Build Path vs /WEB-INF/lib

我与影子孤独终老i 提交于 2019-11-25 22:29:40
问题 How should I add JAR libraries to a WAR project in Eclipse without facing java.lang.ClassNotFoundException or java.lang.NoClassDefFoundError ? The CLASSPATH environment variable does not seem to work. In some cases we add JAR files to the Build Path property of Eclipse project to make the code compile. We sometimes need to put JAR files inside /WEB-INF/lib folder of the Java EE web application to make the code to run on classes inside that JAR. I do not exactly understand why CLASSPATH does