java

JDBC THIN Oracle with Java6

Hi all, I have a problem with JDBC Thin in Oracle 11g with NetBeans V6.7.1. I don't know how to configure it. I have already set classpath of ojdbc6.jar and orai18n.jar. But I still can't run this example in NetBeans: import java.sql.*; import oracle.jdbc.*; import oracle.jdbc.pool.OracleDataSource; class JDBCVersion { public stati...

Are there any Java PDF creation alternatives to iText?

I am trying to render about 100,000 - 80 column records through FOP and it tanks pretty much everytime (OutOfMemoryException). I know iText could handle that kind of load but I can't use it because of the LGPL license. Are there any alternative Java libraries to iText that can handle rendering a high volume of data to PDF? ...

multiline jlables java

Hi, i want to JLabel text in multiline otherwise text wiill be so long,how can do this in java? Thanks, Rekha ...

Java - Find a line in a file and remove

I was digging on the internet to find a small code snippet that will find a line in file and remove that line (not content but line) but could not find. So for example I have in a file following: File myFile.txt aaa bbb ccc ddd Need to have a function like this: public void removeLine(String lineContent), and if I pass removeLine("...

multithreaded multiclient programming

hi... i m doing a client - server application.... i want to connect multiple clients with a single server...here each client is connected with the server using three ports..one for -sending an image second- sending the keyboard events third - sending mouse events all these infor...

database in desktop application using swing

I am making a desktop application in java and using MSAccess in data base. I want that if i run the setup of the application the database should be created on client machine because there can be different client using the application and how can i create the setup? is there any tools available for this free of cost? please explain me in ...

Optional parametrization in Java with Generics

Is is it possible to specify default type when parametrzing a class? Example: // abstract class public abstract class AbsClass<T1 extends Par1Class, T2 extends Par2Class> { // code } // parametrized imlementation class public class RealClass extends AbsClass<ClassThatExtendsPar1, ClassThatExtendsPar2Class> { // cod...

How to invalidate spring session when the app server session times out?

I am working on a struts2/spring/hibernate application running in Tomcat 5.5 server. i have defined my struts action in session scope. The problem i am facing is even when the server session times out, and at that time, if the user clicks on any link in the application, he is redirected to the login page.(This is right and as expected) B...

Configure the root logger with java logging API

how can I configure the behaviour of the root logger in the logging api? I don't want to configure the behaviour of each logger separately, instead it would be very convenient if I have a single property file where I can set the behaviour of all loggers. ...

JTextPane prevents scrolling in the parent JScrollPane

I have the following "tree" of objects: JPanel JScrollPane JPanel JPanel JScrollPane JTextPane When using the mouse wheel to scroll over the outer JScrollPane I encounter one annoying problem. As soon as the mouse cursor touches the inner JScrollPane, it seems that the scroll...

Pax-import-bundle and Spring DM bundles

Hi, I'm following the examples from Modular Java but I'm having trouble with chapter 6 and adding the Spring DM modules to my project. I run: pax-import-bundle -g org.springframework.osgi -a spring-osgi-extender -v 1.2 -- -DwidenScope -DimportTransitive When running pax-provision the Spring DM bundles are not resolved. I get complaint...

Java Webservice and Polymorphism

Let's say i have the following strucutre public class Mammal { @WebMethod public ArrayList<Mammal> getAll(){ return null; } @WebMethod public String speak(){ return "Unable to speak"; } @WebMethod public Mammal me(){ return this; } } @WebService public class Human extends Mammal { @WebMethod public Arra...

How using BigDecimal would affect application performance?

I want to use BigDecimal to represent arbitrary precision numbers like prices and amounts in a low-latency trading application with thousands of orders and execution reports per second. I won't be doing many math operations on them, so the question is not about performance of the BigDecimal per se, but rather about how large volumes of...

diffrence between jboss.jms and jboss.mq ?

Whats is diffrence between classes org.jboss.jms.server.destination.QueueService and org.jboss.mq.server.jmx.Queue? ...

ActionListener on JLabel or JTable cell

I have a JTable with JLabel[][] as data. Now I want to detect a double click on either the JLabel or a table cell (but only in one of the columns). How can I add an Action/MouseListener on JLabel respectively table cell? ...

How to create installers with Maven

I'm migrating a medium sized Java application's build from Ant to Maven. I could easily migrate the basic building stuff, but I would also like to create the installer packages from the Maven build. The easiest way would be to call the original Ant scripts through the Ant plugin, but I thought maybe I should look around first for some Ma...

writing a BitSet to a file in java

I have a BitSet and want to write it to a file- I came across a solution to use a ObjectOutputStream using the writeObject method. I looked at the ObjectOutputStream in the java API and saw that you can write other things (byte, int, short etc) I tried to check out the class so I tried to write a byte to a file using the following code...

Which development environment to use for developing JEE and EJB 3?

Hi all, I have to work with a project in which it is mandatory to use JEE and EJB 3. Can anyone suggest the best development environment for development of these technologies? And any useful links with some samples and how-tos to start with? ...

How to check if a URL exists or returns 404 with Java?

String urlString = "http://www.nbc.com/Heroes/novels/downloads/Heroes_novel_001.pdf"; URL url = new URL(urlString); if(/* Url does not return 404 */) { System.out.println("exists"); } else { System.out.println("does not exists"); } urlString = "http://www.nbc.com/Heroes/novels/downloads/Heroes_novel_190.pdf"; url = new URL(urlStr...

Downloaded PDF with Java is corrupt?

I have read the excelent discussion about How to download and save a file from internet using Java. However, if I exectue the next code, i get a corrupt PDF. Any idea why? import java.io.*; import java.net.*; public class PDFDownload { public static String URL = "http://www.nbc.com/Heroes/novels/downloads/"; public static Strin...