Closing all flows in Java at once

Is there a way to close all streams or handles at once in Java without having references to them? Or is there a way to close all handles (streams) associated with particular File having reference of that File in Java?No Without a reference to the str

The JavaFX application does not work under IntelliJ Idea

I am using the unchanged sample application that IntelliJ IDEA 2016.3.3 generate. When I try to run it it says "Process finished with exit code -1073740791 (0xC0000409)" However, when I run the exact same source code in Eclipse everything goes f

Java Swingworker one after another and update the GUI

I am working on java swing with some multithreaded application. The situation is so, that I need to execute one thread after another i.e I output of one is related to the second. I did the following. // Class one public class Samp implements Runnable

JavaFX animation returns to the original state

My goal here is to have some animation on a node (such as a fade transition) that serves as a temporary notice that something is happening. I want the animation completely gone, like it never happened when that something has ended. The code snipped b

Java 8: Lambda Card Expression

I have a Map<String, List<Object>> multiFieldMap and I need to itereate over its value set and add the value to multiFieldsList as below public List<Object> fetchMultiFieldsList() { List<Object> multiFieldsList = new ArrayList<O

Declaration of missing declaration Java - Inheritance

I'm writing a program for a library with a class called book which will hold details like author and ISBN. It also has the following method to find the fine due for the book (the rate will be different depending on whether the book is a thriller/roma

& ldquo; No items selected & rdquo; on JavaFX combobox?

What is the correct way to put an item which value is null, inside a ComboBox? I tried using myComboBox.getItems().add(null);, and it works, but whenever the user selects this value on the combo box, an exception is thrown on the console: Exception i

Generic method that does not correctly recognize the type

I have a class that has a member defined as: Map<Class<? extends Model>, List<? extends Model>> mockStore; In this class I have a method: protected <T extends Model> void insertMockStore(T obj) { mockStore.get(obj.getClass()).add(o

Setting the value of the null field with reflection

I am setting a variable value to null, but having problem with it: public class BestObject { private Timestamp deliveryDate; public void setDeliveryDate(Timestamp deliveryDate) { this.deliveryDate = deliveryDate; } } BeanUtils.setProperty(new BestObj

Java - substring search in table

I am trying to find a subString inside a string, in an arraylist, but I can't get it working. It has to loop through the arraylist until it finds the sub string, and then stop. Here is what I have so far private static void teamSearch(String teamName

Sort JTable except the last line

I have a JTable where the last row is the total row that aggregates all other rows. When the user clicks a column header on the table, rows are sorted by that column, except for the total row which should be always at bottom. Is there a simple way to

Initialize a variable in an if statement in java?

I keep getting an error variable F3 may have not been intialized on the last line of code you see. What am I doing wrong? { Float F1,F2, F3; F1 = Float.parseFloat( JOptionPane.showInputDialog("Enter a number and press ok.")); F2 = Float.parseFlo

dynamically change bitmap in imageView, Android

All, I have a problem related to imageView, android. I have array which contains of 10 bitmap objects, called bm. I have a imageView, called im. Now I wanna show the bitmaps in the array in im one by one, so I did the following: new Thread(new Runnab

ArrayList.toArray () throws NullPointerException

I have declared two ArrayLists in my main class. One is an ArrayList of Routine objects, the other a String array of Routine names. Everytime a routine is constructed, that Routine name as well as being stored in the routine is stored in the Names ar

Find the sum of node height in a binary tree recursively

How to find sum of node's height in a binary tree recursively? Example: public int totalHeight() { return totalHeight(root); } private int totalHeight(BinaryNode<AnyType> n) { int totalHeight = 0; if (n.left == null && n.right == null) retur

Can JMS messaging be replaced by a Webservice poll?

Existing scenario: Two Apps are communicating using Queues. One of them is always the Producer, and other is always the consumer. The 'Producer' generates and saves data in its own storage. It then sends it to the Consumer, using Queues. The more I r

Which inverse ajax library for Java?

What are worth to look at libraries for reverse ajax in Java web app? Atmopshere is still in 0.6 version, ICEpush still in alpha version, and websockets in Firefox 4.0 wont be available too.Try out Comet with Tomcat. Also, Tomcat 7 might be useful to

How to check access to project boundaries in Maven projects

I have a set of Maven projects and I'd like to define access rules. For example, projects Database and Cache may only be accessed by project DataLayer, but not from project UiLayer. I'm speaking in terms of maven projects, but a package level access

Adding WCF Service Reference to the Java Application

How can I add WCF Service Reference to my Java Console Application ? I want to use this method for prove the interoperability of my wcf Service. I'm newbiee to java and I don't know what do I import to java.I have service and service.wsdl but I haven

Update cached data in a hash table

In order to minimize the number of database queries I need some sort of cache to store pairs of data. My approach now is a hashtable (with Strings as keys, Integers as value). But I want to be able to detect updates in the database and replace the va

You can not refer to the static enum field in an initializer?

I just got Java5 project that has this error, i tried using Java5 and Java6, but its still there. it worked somehow before(since it was in svn), how can i bypass that compiler error?Don't "bypass" the error - it won't do what you want it to. The