java

Setting breakpoints in Java

How does setting breakpoints in Java work? Is it just based on the source file name and line number? Does the class or method name also figure in? If I have an old version of the source in my debugger and set a breakpoint, the cursor is off when I step through. How far off can it be? Can it go into the wrong method (or even the wrong c...

Where do we start using Unit testing?

Where do we start using Unit testing? I have some doubts about where to start using Unit testing. I am doing unit testing with Junit in RAD. And I am doing it after all code is ready to deploy or may be after deployment. I am confused why we are doing unit testing after code is almost ready to deploy. My question is when we should start ...

GData Java Client not working because Google redirects to localized site

I'm following the documentation at Google Analytics Data API - Java and am getting the RedirectRequiredException exception, because Google is redirecting me to a local version of the site (www.google.si). The code: AnalyticsService as = new AnalyticsService("me-myapp-1.0"); as.setUserCredentials(username, password); AccountFeed ac...

SSLEngine used in combination with an InputStream/OutputStream pair

I'd like to write an SSL adapter based on SSLEngine, built from a InputStream/OutputStream pair (standard java blocking I/O) potentially serving as a transport for authentication encrypted data. This adapter should itself give access to a corresponding pair of deciphered InputStream/OutputStream. I've found few complete examples using j...

Can I simplify this Java Generics Hierarchy

Sometimes in my code I'd like to refer to (what I think of as) the implicit type in a generics heirarchy (basically the type implied by the first ? in the following). public class Foo<BAR extends Bar<?>> { public void t(BAR x) { List l = new ArrayList(); Object baz = x.makeBaz(null); l.add(baz); x.setBazList(l); } ...

Create Installer

Hi All, How to create a installer using Java that combine tomcat, mysql and war file and come out a final exe? ...

implemention of imports

Firstly I'm not a Java guy, but I came across what appears on the surface to be an inconsistency with the way imports work. Say you have a file and in this file you have your main function and you have also defined a class Foo, now a different implementation of Foo also exists in a package. Suppose you want to use both versions in your ...

How to activate JMX on my JVM for access with jconsole?

How to activate JMX on a JVM for access with jconsole? ...

getting selected row through AbstractTableModel

Is it possible to get the selected row index from my table model? My object already knows about the table model. Instead of passing a reference to the table it self can i get the selected index using the model? ...

Interfacing AutoCAD with JAVA

Any idea on interfacing with AutoCAD through a JAVA program. I am looking for a solution that can directly interface with an AutoCAD session (even start one), the way it works with the .NET extensions of AutoCAD. Or any way to work with ObjectARX through JAVA, definitely not writing a complete JNI wrapper over it. Added: We are looking ...

Is ist possible to get a MemoryMXBean instance with a remote JVM?

I found this nice article which explains how to query your current memory for your VM http://recursor.blogspot.com/2006/10/memory-notifications-in-java.html My question is, is it possible to get an instance of the MemoryMXBean class from a remote VM easily (and how would I do that), or do I have to resort to query the MBeans manually? ...

WSDL2Java generating the same parameter twice when an element and an attribute have the same name

I have an XML schema having an element with the same name as an attribute: ... <xs:sequence> <xs:element name="subscriberId" type="String"/> ... </xs:element> </xs:sequence> <xs:attribute name="subscriberId" type="String" use="required"/> ... Axis 1.4 WSDL2Java generates two equal parameters in the constructor of the class...

freedesktop.org notifications in java

Hi all :) there's a freedesktop.org notification system using DBUS. Looks simple enough, but I just can't figure out how to use it in Java. Can someone please point to some sample code to display a simple message? Thank you! :) ...

Can I use the maven ant tasks with a custom maven repository?

I need to specify a certain directory which the maven ant tasks should use as repository. maven.repo.local doesn't seem to work with that. Any other ideas? ...

How do I execute the rd command in Java?

How do I execute rd /s /q c:\folder in Java? It woks perfectly on the command-line. ...

Java equivalent of fork in Java task of Ant?

Ant Java task provides fork parameter, which, by definition "if enabled triggers the class execution in another VM". As we are dealing with a large amount of data, setting this parameter saved us from running out of Java heap space. We want to be able to do the same through a Java class. What would be the best way to achieve the function...

Red5 + Java + Windows installation + ant compilation : it works, but why ?

I'm totally new to both java and java Server worlds... But I've a good knowledge (17 years) of object-oriented programming. My question is : Why do I have to call ant to make it work (see later, if you're not interested, skip my question ^_^ ) ? Here's what I want : create a simple application that can do a videoconference (= the ser...

Tomcat problem redeploying:

In the catalina log file we see this error message in some cases when the web application are tried to be redeployed: INFO: Deploying web application archive ROOT.war 13-May-2009 09:50:09 org.apache.catalina.core.StandardContext processTlds SEVERE: Error reading tld listeners java.lang.IllegalArgumentException: URI has an authority comp...

good way to represent a excel sheet value in Java

Consider that I've a excel sheet in below format: person age Foo 29 Bar 27 Now I want to read these values (using POI HSSF) and have to process them. What's the best way to do that? Note that I do not have a Object Person in my application, becasue the values that may come in excel sheet is arbitrary (i.e. it may not be the ...

Under Tomcat java.lang.NoClassDefFoundError when accessing a servlet?

I'm writing a web applicaion in Eclipse, and I'm using the XStream Serialization Library to generate My JSON. I've encapsulated the Code that builds up the JSON in a class which is called by my servelet. Then encapsulated class has a main method for testing and when I run it everything seems to work fine. However when I use the call th...