java

Popup window appearing while stopping the C process

I am calling a C process from my Java program, and ending that C process using exit (0). On Windows machine, under certain conditions it is opening a pop-up window telling me that "Test.exe has encountered a problem and needs to close. We are sorry for the inconvenience." Does anyone have a guess why this problem is coming around? I ...

java security classloader

hi I am implementing a service which uses a URLClassloader to load classes dynamically. In the interest of security I would like to restrict the access of loaded classes. eg no network, file or db access etc. Anybody got any good resources or tutorials on the web for this kind of thing? cheers hoax ...

Java I/O over an NFS mount

I have a bit of Java code that outputs an XML file to a NFS mounted filesystem. On another server that has the filesytem mounted as a Samba share, there is a process running that polls for new XML files every 30 seconds. If a new file is found, it is processed and then renamed as a backup file. 99% of the time, the files are written wi...

customising serialisation of java collections using xstream

I have an object that needs to be serialised as XML, which contains the following field: List<String> tags = new List<String>(); XStream serialises it just fine (after some aliases) like this: <tags> <string>tagOne</string> <string>tagTwo</string> <string>tagThree</string> <string>tagFour</string> </tags> That's OK as far a...

How do I customize a JComboBox so that the pop-up is a JTree (instead of a list)?

I am trying to create a combo box so that I can put whatever control I prefer within the pop-up, in my specific case a JTree. Having a look at how the JComboBox is implement, the pop-up is really created by the UI delegate. The problem in changing that is that it would need to be re-implemented for each look and feel, which is something ...

Abstract enum a annotation attribute type

Hi, I have an interface which multiple enums are implementing, i.e public interface MinorCodes { public abstract int code(); public abstract String description(); } public enum IdentityMinorCodes implements MinorCodes { IDENTITY_UPLOAD_PICTURE_CODE(1, "Error while trying to upload a picture."), } Now I want to have a cus...

OJB / Oracle XE sql debug-display problem

Hello, I have a Java application, and use OJB as my ORM technology. I have an Oracle XE installation locally to develop against. The problem is when I need to debug a problem, I like looking at the SQL output. Here is an example of SQL I can view through the "Top SQL" interface in Oracle XE: select a_bunch_of_fields from KREW_DOC...

Adding screen brightness controls to android application

I am looking to add controls to adjust screen brightness locally in my app menu but can't seem to figure out how to do it. I have seen examples to max-out or dim brightness but I am looking to add controls so that the user can control and set the brightness level. Does anyone have any examples, tutorials, source code, or just a place to ...

Java EJB interface

Hello, I have been working through this tutorial. Halfway though it creates an interface and facades for an EJB. Can anyone tell me when I reference the interface using the @EJB annotation, where does it actually make the link between the interface and the actual enterprise java bean itself. Thanks for the help. ~ Kyle. ...

Java, MySQL: Is there a way to embed a MySQL server with a Java program?

One thing I love about .NET is the ability to have a database file along with the project. I know that using a SQLite database, this can be done, but did someone achieve this with a MySQL database backend? So for instance, if I run a java program, it should be able to start its own mini MySQL server and manipulate data. So essentially,...

"Time out" when multithreading requests to a webservice with java and axis2

Hi, I'm working with a slow webservice (about 4 minutes each request) and I need to do about 100 requests in two hours, so I've decided to use multiple threads. The problem is that I can only have 2 threads, as the stub rejects all the other ones. Here I've found an explanation and possible solution: I had the same problem. It seems...

is it possible to get the query plan out using jdbc on sql server?

I am using the JTDS driver and I'd like to make sure my java client is receiving the same query plan as when I execute the SQL in Mgmt studio, is there a way to get the query plan (ideally in xml format)? basically, I'd like the same format output as set showplan_xml on in management studio. Any ideas? Cheers, -James Some code f...

Java find the first cause of an exception

I need to check if an exception is caused by some database problem. I receive an Exception and check if its cause contains the "ORA" string and return that (something like "ORA-00001"). The problem here is that the exception I receive is nested inside other exceptions so if I don't find if it's an oracle exception I have to check into th...

how to implement a search feature in java

I need to implement a search feature into my program. At present it reads from a file one line at a time, like so: public void importContacts() { try { BufferedReader infoReader = new BufferedReader(new FileReader("../files/Contacts.txt")); txtName.setText(readLine(infoReader)); txtPhone.set...

Do all Hash-based datastructures in java use the 'bucket' concept?

The hash structures I am aware of - HashTable, HashSet & HashMap. Do they all use the bucket structure - ie when two hashcodes are similar exactly the same one element does not overwrite the other, instead they are placed in the same bucket associated with that hashcode? ...

JSF page rendering error:Faces Context

I am getting the below messages when my JSF page gets rendered. The page is rendered correctly however in the Console the message below repeats itself numerous times... INFO: ERROR: Unable to get Faces Context for session variable: localeBean 11:54:27,090 INFO [STDOUT] Nov 24, 2009 11:54:27 AM com.web.util.faces.UtilFacesFuncs log IN...

Reading text and writing to Excel in Java

I have some code that puts new text on first line of a text document. I need some code to read that first line from the text document, and then should write this text to the first cell, first column of an Excel document. Then my code would put new text on the first line of the text document. Need some code to read new text from the te...

Help me to take value from Web Service using DOM parser

I have 2 table. Table A has ID (int, auto_increase), Name (Varchar), City_ForeignKey (Int, Reference to ID from table B) Table B ID (int, auto increase) Name City (Varchar) than i make Web Service from table A & B and success. When i make a client, i parse the Web Service XML from table A,it's problem to City_ForeignKey, when i want t...

thread safe map for java

i need a thread safe map, i have something like this: (i'm very new to java) public static class Manager { static { //something wrong here, doesn't compile list = new java.util.Collections .synchronizedMap(new Map<String, Client>()); } static Map<String,Client> list; ...

Missing java.util.HashMap

Hey everyone, Is there any reason that I would be missing the java.util.HashMap package? I have java.util.Hashtable, but no HashMap... I have the most up to date JDK and JRE... Thanks! ...