java

Is there a Findbugs and / or PMD equivalent for C/C++?

I was recently asked about alternatives to Coverity Prevent for a code base that includes both C/C++ and Java. Obviously, on the Java side, the free tools available include Findbugs (compiled code analysis) and PMD (static code analysis). They are very powerful, especially when you start investigating integration with IDEs (which, agai...

What else do I need in ejb 2.x ear?

I have now ear |----test.jar |-------META-INF |-------application.xml |-------test |-------Test.class |-------TestEJB.class |-------TestHome.class |----test.war |-------WEB-INF |-------web.xml |-------test |-------TestServlet.class appli...

When doing small, single class programs should I make everything static or or instantiate a copy of itself in main?

When I'm working on homework assignments for class it is typically beneficial if the programs are small to keep the problem to a single class (easy to submit with our script). For these one-off programs does it make more sense to declare all methods and instance variables as static or does it make more sense to declare an instance of th...

Oracle Database Deleting Files Using Java

Sometime this weekend one of our databases (11.1.0.7) began having problems accessing certain folders on a portion of the network through Java. I have reproduced the problem using a small portion of java that does nothing but create a file object and attempt to delete the file. From the database this works for deleting local files and de...

Blackberry JDE FieldChangeListener

I'm sort of confused as to how to implement a FieldChangeListener in the Blackberry JDE. One way has me make my main class implement FieldChangeListener, and then have a fieldchanged method inside of it, and another has me do: FieldChangeListener listenerUS = new FieldChangeListener() { public void fieldChanged(Field field, int cont...

Design Pattern to Handle Grouping Similar Entities Together

Over the past few years I've been on projects where we've run into a similar problem in our object hierarchy that always seems to cause problems. I was curious if anyone here knew of a classical OOP (Java, C#, PHP5, etc) design pattern that could gracefully handle this situation. Say we have an existing system. This system has, among ...

Accessing a WCF-service using Java

I'm developing a web-service using WCF, which I want to access using a client written in Java. I will encode the messages using Protocol Buffers (with Marc Gravell's protobuf-net to be exact). Is this possible to achive or must the client be written in .NET as well? I know that data serialized with Protocol Buffers is binary interopable...

Default font for Swing text

Does the text in Swing components have a default font? In particular, what about tab labels on JTabbedPanes? I'm working on a mock-up of a GUI made with Swing and want it to blend it with a screen image I grabbed of a Swing app. ...

What alternatives exist to Spring Batch to handle queued jobs?

I have been looking in to Spring Batch to solve a batch processing scenario with huge amount of data involved in each job. Are there any other solutions that compete with Spring Batch? To be used in a JEE environment. ...

Knowing when all threads complete and dealing with exceptions

Hi, I am using the Executor framework to kick off several threads using a threadpool i.e newFixedThreadPool. I use threadpool.submit(aThread) to submit jobs to be executed by the threadpool and this works fine however I need to determine when all the threads are complete so that I can continue with other processing. I looked at using F...

Customer management / What database is recommend?

Hello! My workmate and I are trainees and we got an exercise to realize a project. We have decided us to create a customer management in Java. Now we have to choose a database. We are able to use Oracle, MySQL, PostgreSQL, HSQLDB and of course other Open Source databases. So, what database is recommend for us? I thought Oracle is too com...

How to include file in Jar through Ant at specific location

Hi, I've got an ant jar task: <target name="jar"> <jar destfile="${generated.jars.dir}/hello-${environment}.jar"> <fileset dir="${generated.classes.dir}"/> <fileset dir="${environment.dir}/${environment}" includes="config.xml"/> </jar> </target> How can I force the config.xml file to be pushed to a specific director...

What's new in OSGi 4.2?

OSGi 4.2 has just been released which updates the 4.1 specification with a few new RFCs. So, what's particularly new with OSGi 4.2, which frameworks support 4.2 already (or are close to) and why should you target new developments against a 4.2 framework instead of a 4.1? ...

Loading a DLL on a jboss server

I am able to load a DLL library on my machine by putting it in a directory found in the PATH environment variable. I can also specify System.setProperty("jna.library.path","C:\\dev"); and that works. For some reason I cannot get it to work on another box that's running the same version of JBoss. I tried dropping the DLL in C:\WINDOW...

Maximum Java heap size of a 32-bit JVM on a 64-bit OS

The question is not about the maximum heap size on a 32-bit OS, given that 32-bit OSes have a maximum addressable memory size of 4GB, and that the JVM's max heap size depends on how much contiguous free memory can be reserved. I'm more interested in knowing the maximum (both theoretical and practically achievable) heap size for a 32-bit...

Printing HTML file out to printer in java

I need to print a an html out to the printer programmatically. I do not want to print the html tags, I want the html tags parsed before printed. This code adds html features and data to an htm document named document. I am then sending the output to a file named itext.html HtmlWriter writer2 = HtmlWriter.getInstance(document,new File...

JTable Row Header implementation

Hi, I wanna create a JTable with a row header. This question seems simple and I could find a lot of tips on google search. Nevertheless, everything I have found were tips of how make a column mimics the real header. Although good, it comes with the problem of that the look and feel can not be applied very well. In my program, I tryed th...

What will the class be for a Web Service method result?

Hello everyone, I have been given by a partner a WSDL for their Web Services. I'm not too experienced with Web Services, so I'm a bit skeptical about something with the WSDL. One particular method allows us to get some information, but we can only use it once (or face a penalty.) The problem is that it is returned as "raw XML" inside th...

How can I make Netbeans 6.7 recognize JSF tags in facelets?

I would like to upgrade from Netbeans 6.5 to Netbeans 6.7. However, I've encountered an annoyance. Netbeans 6.5 recognizes jsf tags, but Netbeans 6.7 does not. Here are the screenshots: Why isn't Netbeans 6.7.1 not recognizing and matching JSF tags? ...

Sharing output streams through a JNI interface

I am writing a Java application that uses a C++ library through a JNI interface. The C++ library creates objects of type Foo, which are duly passed up through JNI to Java. Suppose the library has an output function void Foo::print(std::ostream &os) and I have a Java OutputStream out. How can I invoke Foo::print from Java so that...