j2se

Why does Java's socket.connect() consume 100% cpu resources?

I created a threadpool and gave it 50 tasks to connect to a server. So once it was done connecting, sending some data over, then disconnecting. It also has a read timeout set at 5 seconds (5000 long of course). I even set the thread pool to a max size of 1. I then fire this up, on linux, and ran htop (a better version of top) to check th...

Monitoring application to monitor a Java desktop application performance

Hey, I have a Java desktop application I wrote, and I would like a recommendation about a monitoring application that can spot bottlenecks in the code and real time memory consumptions. As I was developing for J2Me, the WTK then, had a memory monitor, and I found it really useful, I would like to know which monitoring program you think...

How can I send a file via wi-fi between two pocket PCs?

I have two Pocket PCs and I want write an application that be able to send a file via Wi-Fi, as you know the Pocket PC's OS is Windows-mobile. Can I use J2SE ?(Because windows-mobile) or I must write J2ME Application? Please kindly advise me, with a sample source code about that. Thanks a lot ... ...

Is J2SE a framework?

Hello, I want to know is this legitimate to say J2SE a framework? If J2SE is a framework, then why there is a collection framework? Isn't collection framework inside J2SE? Please help me! ...

How to find out the drag source component in the drop target TransferHandler?

Question is regarding Java 5 and Drag n Drop. Is there a way to determine the drag source component in the drop target TransferHandler? I need to know this in my canImport(..) or importData(..) method in order to take different actions for transfer data of the same type or DataFlavor. The way I have achieved this currently is to hijac...

does a java function call spawns new thread for its execution?

Hello all, Suppose i have one simple function in my program. Whenever i call that function does a new thread or process is spawned to execute the function or it is executed under the main thread memory space only. Please help... any pointers will be appreciated. Thanks in advance, Rupesh ...

Error when trying to launch an executable .jar file.

Hi when in try to run jar file this error shown : "failed to load main-class manifest attribute from ..." but when i run project in netbeans it`s run successfuly !!! ...

Twitter API Request Limit Problem

I've written a small java program to download all friends' and followers' profile pictures from twitter. But i'm getting an error because only 150 requests per hour per IP address is allowed. the exact error is: twitter4j.TwitterException: 400:The request was invalid. An accompanying error message will explain why. This is the status...

Creating a javax.microedition.lcdui.Image on J2Se Application

Hey, I have designed a component for J2Me, and here is the paint method: import javax.microedition.lcdui.Graphics; import javax.microedition.lcdui.Image; class Component { ... public void paint(Graphics g) { if (background != null) g.drawImage(image, bounds.getLocation().x, bounds.getLocation().y, 0); } ... } I want to...

Job asks for J2SE skill but working on server-side

I am gonna have an interview with a company working on stock trading system which only requires core Java skill. However, the requirements list many server related stuff as follow: Strong server-side Java (no UI) Strong JUnit testing Web service knowledge, HTTP / HTTPS Lucene Performance tuning experience will be desirable Continuous i...

multiplexer code

hi i have a Java library for working with multiplexer but i don't know how to take output from it ? any body can help ? this is the library link to download http://www.bozorgvar.com/multiplexer.rar ...

JPA+Hibernate(J2SE) @OneToMany - Millions of records slows adding a new object down.

Hello, I'm using JPA+Hibernate with a PostGre SQL database in a J2SE project. I have 2 entities A and B. A has a @OneToMany relationship to B. In my domain model A might reference millions of B's. When I add a new object to the collection it takes minutes to complete. @OneToMany(cascade=CascadeType.PERSIST) Collection<B> foo = new Arra...

org.restlet: Posting JSON content against webservice returns HTTP error 411 (length required)

Simplified code example: http://pastebin.com/9ZQxSXi9 Hi I wanted to experiment with the restlet 2.0 library and the gpodder webservice but somehow i reached a point where I can't see the wood for the trees. The service in the example requires HTTP authentication and to post some JSON content to a URL. Nothing that complicated but som...

Android: buffer blocked until process exited

I have a problem with blocking buffer with the following code on my android application: else if (tcpdumpButton.isChecked()) { try { Process process1 = Runtime.getRuntime().exec("tcpdump"); BufferedReader osRes = new BufferedReader(new InputSt...

How to Modify the default editing behavior of a TreeCellEditor (Java)

I have a custom object that has a description (String) and priority value (int). I display these values in a JTree because there is a hierarchical relationship between different objects of this type. I only display the description in the JTree nodes because the priority is not important for display purposes. I would like to have a JDial...

When is garbage collector used in java?

As far as I know GC is used only when JVM needs more memory, but I'm not sure about it. So, please, someone suggest an answer to this question. ...

Ant build symlink error

Hi, I am getting the symlink error when i do an ant build. Searched in net and some posts suggested to download junit jar for fixing it. Downloaded junit-4.8.2.jar. Added this jar file to Classpath but still's not working. I tried to include the jar file within the build.xml but still it didn't work out. <target name="-createDir"...

Resizing panel with flow layout does not invoke the scroll bars

Hey, I have a containing panel JPanel with a Flow Layout, the containing panel is in a JScrollPane, the containing panel holds a bunch of other JPanels, inner panels, in it. All the inner panels have the same dimensions. If there are more panels then the containing panel can hold in its width then they are gridded downwards, and if ther...

JMS usage in a JSE application

Hi, I have a JSE application which currently uses JMS, it was written by a developer which is no longer with the company. For some reason, I really don't know if it was justified or not, the JMS session were not created as transacted. I now want to change this as to have all Producers using transacted sessions; This in itself is very sim...

Join String list elements with a delimiter in one step

Is there a function like join that returns List's data as a string of all the elements, joined by delimiter provided? List<String> join; .... String join = list.join('+"); // join == "Elem 1+Elem 2"; or one must use an iterator to manually glue the elements? ...