java

How to convert an existing Java application to a SYS V service (daemon)

I have a Java application, to start it I use java -jar myapp.jar To stop it I use CTRL+C. Now I need to convert that application to something that I can start with: /etc/init.d/myapp start And I can stop with: /etc/init.d/myapp stop The problem is all about saving the PID of the process, I think I saw somewhere a recip...

printf() functionality in Java combined with a CharBuffer or something like it

I am a little confused here. I would like to do something like this: create some kind of buffer I can write into clear the buffer use a printf()-like function several times to append a bunch of stuff into the buffer based on some complicated calculations I only want to do once use the contents of the buffer and print it to several Pri...

Where are Swing applications used?

Are Swing applications really used nowadays? I don't find a place where they are used. Is it okay to skip the AWT and Swing package (I learned a bit of the basics though)? ...

Can an MBean be run under Tomcat?

We have 2 applications that run under JBoss. I am looking for a way to reduce the overhead of the server. The main app runs under Tomcat. The other app is made up of MBeans. Is there a way to run MBeans under Tomcat? Alternative suggestions are appreciated. ...

HibernateTransactionManager(Spring) with multiple Session Factories

I have a DAO implementation that uses a HibernateTransactionManager for transaction management and the application has 2 session factories. I am getting an exception at the transactionManager.commit() line below. Does performing Hibernate operations within a transaction manager related to a different session factory cause problems? Tran...

Is Google Web Toolkit similar to AWT and Swing

I've looked breifly into GWT and like the idea that I can develop in Java and have the application compile down to HTML and JavaScript. Is the concept behind GWT and AWT and Swing the same or different? ...

How to get a heap dump of a Java process on Windows that's not running in a console

I have a Java application that I run from a console which in turn exec's another Java process. I want to get a thread/heap dump of that child process. On Unix I could do a "kill -3 " but on Windows AFAIK the only way to get a thread dump is Ctrl-Break in the console. But that only gives me the dump of the parent process, not the child. I...

Java RMI Resources

Hi everyone I am currently undertaking a project that involves extensive use of Java RMI and I was wondering if anyone is aware of any good resources about it. The problem I am having with the material I am finding currently is that its usually quite out of date (like Java 1.3) and / or half complete. I would even be happy to buy a book...

Java for Audio Processing is it Practical?

Is Java a suitable alternative to C / C++ for realtime audio processing? I am considering an app with ~100 (at max) tracks of audio with delay lines (30s @ 48khz), filtering (512 point FIR?), and other DSP type operations occurring on each track simultaneously. The operations would be converted and performed in floating point. The sys...

Apache Derby: how can I do "insert if not exists"?

I'm giving Apache Derby, aka JavaDB a spin. I can't seem to get around duplicate key issues when inserting records that may already exist. Is there a Derby equivalent to "insert if not exists", or "merge" ? Similarly, is there a way to do something like "drop table foo if exists"? ...

How does Java Garbage collector handle self-reference?

Hopefully a simple question. Take for instance a Circularly-linked list: class ListContainer { private listContainer next; <..> public void setNext(listContainer next) { this.next = next; } } class List { private listContainer entry; <..> } Now since it's a circularly-linked list, when a single elemnt is added, it ...

Check the signature on large data sets efficiently using JCA

I have to verify the signature on a file that may be as large as 2Gb, and I want to do so in a way that is as memory-efficient as possible. For various reasons, the file will already be loaded completely into memory, and is accessed using an InputStream by the application. I would like to verify the signature using the stream interface...

Vector graphics in iText PDF

We use iText to generate PDFs from Java (based partly on recommendations on this site). However, embedding a copy of our logo in an image format like GIF results in it looking a bit strange as people zoom in and out. Ideally we'd like to embed the image in a vector format, such as EPS, SVG or just a PDF template. The website claims that...

Ordering return of Child objects in JPA query

So if my JPA query is like this: Select distinct p from Parent p left join fetch p.children order by p.someProperty I correctly get results back ordered by p.someProperty, and I correctly get my p.children collection eagerly fetched and populated. But I'd like to have my query be something like "order by p.someProperty, p.children.some...

How do I check out an SVN project into Eclipse as a Java project?

I was trying to check out a project from SVN using Eclipse. I tried using "Checkout As" to make it into a "Java project from existing Ant script", but the project wizard requires the file to have already been downloaded. Is there a way to checkout the project into Eclipse as a Java project, without having to download it elsewhere first? ...

What code does the compiler generate for autoboxing?

When the Java compiler autoboxes a primitive to the wrapper class, what code does it generate behind the scenes? I imagine it calls: The valueOf() method on the wrapper The wrapper's constructor Some other magic? ...

What is the difference between swing and awt?

Can some one please explain me what is the difference between swing and awt? Are there any cases where awt is more useful/ advised to use then swing or vice-versa? Thanks in advance. ...

What is the best *free* IDE for Java programming?

There are two free IDEs for Java: Netbeans and Eclipse. Netbeans seems to have better auto-complete support and compile/debugging support. However, it lacks support for auto-completing variable/method names, as well as word-wrap support. What are the Pros & Cons of Netbeans over Eclipse, and vice versa? ...

Java(Swing): influence height of JList in GridBagLayout

I want to build a dialog in Java with a List and a couple of buttons underneath it. The list ends up with the same height as the buttons (about one line) and the whole dialog is about two lines of height. However, I'd like the dialog to be taller (maybe 10 lines) and the JList to take up most of the space .. I've played around with the ...

NetBeans web services client producing invalid request

I'm trying to make my first web service client for the eBay API using the NetBeans 'new Web Service Client' wizard and the WSDL found here. My understanding is that this is using JAX-WS to generate class files, and my requests are all SOAP. Everything seems to work fine except when I try to execute a request, eBay responds with a 404 w...