Skip to content
Advertisement

Java, server client TCP communication ends with RST

I’m trying to figure out if this is normal. Because without errors, a connection should be terminated by: I get this at the end of a TCP connection (over SSL, but i also get it with non-encrypted): The client exits normally and reaches socket.close, shouldn’t then the connection be shut down normally, without a reset? I can’t find anything about

Java heap size – will this work?

I try this with NetBeans desktop application template – increasing heapsize (to 512 MiB) of executed .jar file. (I believe that NetBeans uses Singleton app by default – SingleFrameView) Will it work? Answer Not going to work. The heap space is set from the -Xmx parameter at JVM initialization time. By the time you’re running Java code, it’s too late.

Convert xml to java

How can I convert xml to java so that it could read the xml document and put it in to a database? Answer Check this: http://www.java-tips.org/java-se-tips/javax.xml.parsers/how-to-read-xml-file-in-java.html That’s how you read xml file. Then you just crate SQL query to insert it into database (JDBC?)

Oracle doesn’t remove cursors after closing result set

Note: we reuse single connection. Answer The init.ora parameter open_cursors defines the maximum of opened cursors a session can have at once. It has a default value of 50. If the application exceeds this number the error “ORA-01000: maximum open cursors exceeded” is raised. Therefore it’s mandatory to close the JDBC resources when they are not needed any longer, in

How to set arrayList size as null?

Why the size of the arrayList choice is 5 when all the elements have been set to null Answer Because the ArrayList still contains 5 Objects. They are null, but they are objects, thus present in the list! You can empty the ArrayList, by calling choice.clear();

Java – Get a list of all Classes loaded in the JVM

I would like to get a list of all the classes belonging to a certain package as well as all of their children. The classes may or may not be already loaded in the JVM. Answer Well, what I did was simply listing all the files in the classpath. It may not be a glorious solution, but it works reliably

Creating custom URI scheme using URI class

I need to create a custom URI scheme for my project. i.e urn:myprotocol:{p1}:{p2}:{p3}:{p4} – opaque representation myprotocol://{p1}/{p2}/{p3}/{p4} – hierarchical representation. How can I add my scheme to Java URI class? Or, how can I make Java URI to understand my scheme, so I could use it in my code? Concrete examples are welcome. Answer Are you sure you need to

How to change the cursor type

This question is related to the previous post. How to save file and read alt text http://freeimagehosting.net/image.php?dc73c3bb33.jpg How can I change the cursor to “Hand” only when the mouse pointed on grid which is not Null (contained images)? So far the cursor turn to “Hand” all over the grids (null or not null). Answer This should have the desired effect:

List all files from a directory recursively with Java

I have this function that prints the name of all the files in a directory recursively. The problem is that my code is very slow because it has to access a remote network device with every iteration. My plan is to first load all the files from the directory recursively and then after that go through all files with the

Advertisement