We don't have any destructor in Java as we have in C++.
Q1. How should we clean up any Object in java.
Q2. Is there any alternative to a finally block.
Q3. Sometimes we have to call explicitely initialization/termination of a third party code from our class e.g.
public classs MyClass{
public MyClass(){
ThirdPartyInitiali...
I'm trying to add the gwt-debugpanel into my project. I'm using IntelliJ 8.1, and I've setup a stripped-down, bare-bones project for testing. The source tree looks like this:
gwt-multi-module
src
com.gindin
dummy
DummyApp.gwt.xml
client
DummyApp.java
public
DummyApp.css
D...
I have a wsdl that has a imported xsd, this xsd has quite a restrictions like this:
<xsd:simpleType name="len_type">
<xsd:restriction base="xsd:string">
<xsd:pattern value='[:alnum:]{4} [\d]{2} [\d] [\d]{2}' />
</xsd:restriction>
</xsd:simpleType>
So I would thind that when I deploy this ear to glassfish via netbeans t...
I'm trying to propagate the schema from the Hibernate configuration to the RDBMS. The code runs without any error message but the database doesn't get updated.
Any hints ? Thank you !
Update That is hibernate-core only with a HSQL database.
Update 2 Yes, i should use SchemaExport (i'm away from hibernate a while ),but it don't flush ...
What are the accepted practices for creating a Tomcat deployment that reads configuration parameters from a properties file?
It would be nice to be able to deliver a WAR file and specify that the client need only create or edit a properties file in a specific directory. Is this a somewhat regular way of doing things? Is there a better ...
I have a webApp whit Spring and works correctly when I use HSQLDB in server mode but in file mode it only passes the unit test. This is my data source:
<bean id="dataSource" class="org.apache.commons.dbcp.BasicDataSource"
destroy-method="close">
<property name="driverClassName" value="org.hsqldb.jdbcDriver" />
<property na...
I haven't been able to get any more console output (to help with debugging) from Hibernate despite setting a few properties in the hibernate.cfg.xml file. For example, adding the line <property name="show_sql">true</property> did not, in fact, show SQL statements in the console.
I've also tried playing around with the contents of the lo...
To use a contrived example in Java, here's the code:
enum Commands{
Save("S");
File("F");
private String shortCut;
private Commands(String shortCut){ this.shortCut = shortCut; }
public String getShortCut(){ return shortCut; }
}
I have the following test/driver code:
public static void main(String args[]){
System.ou...
I'm searching for a good book which discusses the problems of developing a web-crawler in java. Not this typical "search engine optimization" books.
What books can you recommend?
...
I've run in to a strange error with the javamail 1.4.2 api and jdk/jre 1.6.0u16. I've placed the unzipped javamail-1.4.2 folder (along with the MySQL Connector-J 5.1.7 also needed) in both the jdk and jre folders as in the %classpath% below.
.;"C:\Program
Files\Java\jdk1.6.0-16\jre\lib\ext\mysql-connector-java-5.1.7-bin";"C:\Progra...
Is it possible for two instances of Object to have the same hashcode ?
In theory an object's hashcode is derived from its memory address, so all hashcodes should be unique, but what if objects are moved around during GC ?
...
I'll try to describe the situation. We have a web service; on each request web service starts a JTA transaction. It performs several database calls through XA datasource within that and calls some other web services (out of transaction context) and also makes a couple of remote EJB calls on other server.
The problem is that container s...
A 3rd party web application has a cross-scripting security issue. There is one page with three fields which are not sanitized. The vendor will not provide a timely fix and I need to.
The application is running in Tomcat and uses Struts 1. The action for the bad page looks like this:
<action
path="/badpage"
type="com.badvendor.Ba...
Is there some trick to getting a SpringMVC custom view to cause a file download in the broswer? I've implemented the render method from org.springframework.web.servlet.View but the code results in my data being written to the page as a blob of data rather having a download action start.
try {
Document oDoc = (Document) model.get("o...
I've been trying to understand how to start writing and running JUnit tests.
When I'm reading this article:
http://junit.sourceforge.net/doc/testinfected/testing.htm
I get the the middle of the page and they write, "JUnit comes with a graphical interface to run tests. Type the name of your test class in the field at the top of the win...
Created a Java application to upload documents via CIS (Content Integration Suite) to a storage application. The app runs successfully in RAD, but as a executable jar in a unix environment, getting a NoClassDefFoundError. I can not find the class on my local machine and there are not references to the class on the internet.
The mani...
I want to create an application in Java that lists a directory and add drag and drop support to it for copying files from that directory to the explorer window opened and vice-versa(Windows system).
While adding support to drag and drop from windows explorer to the java application is quite easy, it kind of eludes me how to do it when t...
Just what the title says.
Help greatly appreciated!
...
Im looking por any kind of procedure that let me save a Java.io.file in an oracle directory, it may be a stored procedure or a java stored or somethig beyond... if somebody has any example of this, ill thank it forever. im in my web app and i need to store some uploaded files in a specific directory /home/oracle/oracle/.../mydirectory, a...
Hello,
First of all, thank you for taking the time to read this. I am new to developing applications for the Mac and I am having some problems. My application works fine, and that is not the focus of my question. Rather, I have a python program which essentially does this:
for i in values:
os.system(java program_and_options[i])
...