java

ResultSetMetaData returning BigDecimal insted of int

Need some help regarding jdbc metadata. I am using ResultsetMetaData to get metadata of columns of a table on Oracle10g. I am using ojdbc14.jar. There is a field in table ID declared as Number . This field is being read with jdbc at runtime to get its metadata attributes. ResultSetMetaData.getColumnClassName() is returning java.math.BigD...

java inheritance versus composition (implementing a stack)

Hey everyone, I am trying to implement a Stack in java (using the list interface: Interface List). I want to implement it two different ways: using composition and inheritance. For inheritance, so far I have: import java.util.Collection; import java.util.Iterator; import java.util.List; import java.util.ListIterator; public cl...

How to replace multiple occurences of a string in a text file with a variable entered by the user and save all to a new file?

public static void main(String args[]) { try { File file = new File("input.txt"); BufferedReader reader = new BufferedReader(new FileReader(file)); String line = "000000", oldtext = "414141"; while((line = reader.readLine()) != null) { oldtext += line + "\r...

Java/Windows Get application location.

Is there a way to get the location of an installed application without searching through the file system? EDIT: Sorry for not making the question clear enough, What i am trying to is like figure out where firefox is installed from within an java application. I would like to initiate an install for an extension. ...

J++ to Java: how to migrate from RNI to JNI?

I've inherited a legacy J++ project. I've upgraded this project to standard Sun Java successfully. However, this project includes a native C++ dll which the Java code talks to via the Microsoft-specific RNI framework. Needless to say, calling System.loadLibrary("myRniNativeDll") now throws a UnsatisifiedLinkError, saying one of the dep...

TinyMCE or SmartGWT Rich Text Editor for my GWT app?

I want to add a rich text editor to my GWT application. TinyMCE is one candidate, and so is the rich text editor in SmartGWT. Do you have any advice about choosing between the two? ...

Is it worth to obfuscate java web application?

Is it worth to obfuscate java web application? and why? ...

netBeans gui problem

I have designed this gui in netBeans which has a canvas , a couple of JtextAreas and a Jbutton. It looks great in preview, the problem is when I run the actual program the text areas are shurnk until the program prints something in them, then they expand to their full size, the Jbutton is invisible until I mouse over it then it stays vis...

Wifi information in Java

How can I get the MAC address, SSID, and signal strength of wifi routers nearby in Java? Preferably system independent, if not then Windows. ...

3D scatter plots and 3D graph visualization in Java

I'm looking to create views of scientific data in Java. The data is a mathematical graph consisting of points in 3D space. Are there any Java-based frameworks for creating 3D graphs in Java so that I can: 1. Plot points as spheres, 2. Connect some of the spheres with thin cylinders, 3. Draw flat triangles between some sets of three sph...

How to keep the order of elements in hashtable

I have a hashtable . values() method returns values in some order different from the order in which i am inserted.How can i get the values in the same order as i inserted?Using LinkedHashmap is an alternative but it is not synchronized. ...

Mocking vs. faking, when to use what?

Can anyone come up with a guidelines kind of stuff, suggesting the ideal scenarios when to go for mocking or faking (setting up the essentials manually). Bit confused with the approach? ...

line break problem with MultiCell in FPDF

I am using java port of fpdf. I am encountering fowwlowing errors. 1).When i call multicell 2 times every time the text is printed on a new line. MultiCell(0, 1, "abcd", currentBorders, Alignment.LEFT, false); //prints on one line MultiCell(0, 1, "efg", currentBorders, Alignment.LEFT, false); //prints on next line I want that there ...

Container.remove(int i) throws unexpected ArrayIndexOutOfBoundsException

I'm trying to remove all but the first child component from a Java Container. The following code logs "There are 3" and throws an ArrayIndexOutOfBoundsException: Array index out of range: 2 int componentCount = cardPanel.getComponentCount(); logger.info("There are " + componentCount); for (int i = 1; i < componentCount; i++) { card...

How do i merge multiple .png images as a single image using java?

I want to send multiple .png images as an single image through servlet response.getOutputStream().write(encoder.pngEncode()); But i can send only one image at a time,but i need to send multiple images through response object using java. If anyone knows please give me your inputs. // Create a set of charts JFreeChart chart1=null; ...

Inject New Methods and Properties into Classes During Runtime

Is there any way we can inject new methods and properties into classes during run-time. http://nurkiewicz.blogspot.com/2009/09/injecting-methods-at-runtime-to-java.html states we may do that by using Groovy. Is it possible by just doing using Java? ...

Understanding Enums in Java

What are java enums? How do they work? Where could I used them and how? Can I do without using enums in an app or are they so powerful that Its better to use them than ignore them? ...

How do I execute an external program from Java?

Possible duplicates: How should I call a Perl Script in Java? Include Perl in Java How can I call Perl from Java? I want to execute a program of Perl from Java. I take a file name with an argument and carry out a program, and the program of Perl outputs a result file. So it is the program side of the JAVA I appoint an argume...

How to keep bound JTable up to date?

I am using a bound JTable to display a list of entities. // selSteps is a List of entities. selStepsBound = ObservableCollections.observableList(selSteps); JTableBinding jTableBinding = SwingBindings.createJTableBinding(org.jdesktop.beansbinding.AutoBinding.UpdateStrategy.READ_WRITE, selStepsBound, tblSelSteps, "tblSelStep...

NoClassDefFoundError while running from jar

I am getting a "no class definition found" exception while trying to run my application on Windows (it runs fine on OS X). The classes the JVM is complaining about are my classes (no third party jars required). When I unzip the files inside the jar, all files are present, including the ones the JVMm is complaining about. The jar is cr...