java

Are flat file databases any good?

Informed options needed about the merits of flat file database. I'm considering using a flat file database scheme to manage data for a custom blog. It would be deployed on Linux OS variant and written in Java. What are the possible negatives or positives regarding performance for reading and writing of both articles and comments? W...

Java Protected Access Not Working

In java, there's three levels of access: Public - Open to the world Private - Open only to the class Protected - Open only to the class and its subclasses (inheritance). So why does the java compiler allow this to happen? TestBlah.java: public class TestBlah { public static void main(String[] args) { Blah a = new Blah...

Java: How to pass byte[] by reference?

You can do it in .NET by using the keyword "ref". Is there any way to do so in Java? Thanks in advance! ...

Runtime issues during developing an Eclipse Plugin

Right now, I am trying to create a plug-in of Eclipse which depends on other jar; therefore, I created a plug-in base on the jar and deployed it under my Eclipses' plugin foler. It works well when I start it from my working environment via an Eclipse. However, as soon as I have exported it into a jar and have deployed into Eclipse, it no...

Parallelization: What causes Java threads to block other than synchronization & I/O?

Short version is in the title. Long version: I am working on a program for scientific optimization using Java. The workload of the program can be divided into parallel and serial phases -- parallel phases meaning that highly parallelizable work is being performed. To speed up the program (it runs for hours/days) I create a number of t...

Saving user settings/database/cache... in Java (On every OS)

My Java application is saving stuff in 'user.home' but on windows this does not seem to be the correct path to save application information (as a friend told me). An other option is using the preferences api but it's not possible to set up the hsqldb location using the preferences api. Also, I want all files to be available in the same f...

How to know if is Applet or Application

I have this code inside a class that is used by an application and by an applet. static { if (System.getProperty("os.name").startsWith("Windows")) { System.loadLibrary("extmapi"); } Unfortunately, when the applet loads this code I get an error, because it can't load the "extmapi" library. To avoid this erro...

How to detect a Selector.wakeup call

If I would write: int selectedChannels = selector.select(); Set selectedKeys = selector.selectedKeys(); if ( selectedChannels != selectedKeys.size() ) { // Selector.select() returned because of a call to Selector.wakeup() // so do synchronization. } // Continue with handling selected channels. would it correctly detect the wa...

How to create a Linux cluster for running physics simulations in java?

Greetings, I am developing a scientific application used to perform physical simulations. The algorithms used are O(n3), so for a large set of data it takes a very long time to process. The application runs a simulation in around 17 minutes, and I have to run around 25,000 simulations. That is around one year of processing time. The...

Any easy REST tutorials for Java?

OK - Im getting really piss3d off here!!! Every tutorial or explanation of REST just goes too complicated too quickly - the learning curve rises so fast after the initial explanation of CRUD and the supposed simplicity over SOAP. Why can't people write decent tutorials anymore! I'm looking at Restlet - and its not the best, there are t...

Is there a free tool to profile the execution time of Java methods?

Hello everybody, I need to know the usage by other applications, in time of execution, of java methods of an api created in my project, does someone know any free tool to know this? Thank you very much. ...

Using Java, How can I get a list of all local users on a windows machine

How can I list all the local users configured on a windows machine (Win2000+) using java. I would prefer doing this with ought using any java 2 com bridges, or any other third party library if possible. Preferable some native method to Java. ...

Why didn't header files catch on in other programming languages?

Based on the response to this question: Why does C++ have header files and CPP I have seen the responses and understand the answers - so why didn't this catch on? C# Java? ...

The correct way of waiting for strings to become equal

In a Swing app a method should continue only after user enters a correct answer. The correct answer is stored in a String with user answer being set by a listener to another String. So, the code is while (!correctAnswer.equals(currentAnswer)) { // wait for user to click the button with the correct answer typed into the textfiel...

Eclipse memory settings when getting "Java Heap Space" and "Out of Memory"

When trying to launch and run a flex/java project in eclipse I kept getting a "Out of Memory Exception" and "Java Heap Space" using Eclipse, Tomcat and a JRE. While researching trying to adjust the memory settings I found three places to adjust these: Eclipse.ini The JRE Settings under Window > Preferences Catalina.sh or Catalina.bat ...

Refactoring a Hibernate entity into subclasses

I have a class that is currently mapped as an entity in a database table using Hibernate. This class should be refactored into an abstract class containing some field common to all of its subclasses. I'm using annotations for mapping hibernate entities/relationships classes. I would like suggestions/variants on how to do this refactori...

JMX client that can persist gathered information

We've added performance measures to our application and are exposing them using JMX. Now we would like to gather and store performance data for analysis, in files or in a database. Does anyone know of a JMX client, open source or commercial, that can persist gathered information? ...

How to return actual cell component bounds in a JTable?

I have a custom renderer in a JTable to display Jcheckboxes for booleans. However, this causes a slight issue because when the user clicks in the table cell, but not in the checkbox, the checkbox is still checked. Is there a way I can return the bounds of the actual JCheckbox that is rendered by the JTable at a particular point so I ...

Input level monitoring with Java Sound API

Hi All, I would like to monitor the microphone input level from Java Sound API (and create a small input level meter UI). I'm not interested in capturing only to see if the device is ready/working. Any idea is appreciated. ...

Detect whether FocusEvent of component is lost or gained

I implementing a EventQueue and get notified when AWTEvents are send. I wait till instances of FocusEvent are send to the dispatchEvent methode. The FocusEvent by itself does not have a methode to ask if the focus of the component is gained or lost. The methode paramString returns a String in which the information is placed, but i dont ...