java

How can I get the icon to display for a file from a Java app?

Is it possible from a Java desktop app to find the icon to display for a given file, perhaps based on it's mime type? Specifically I want to ask the host OS for the icon to display so it can match what the user would expect to see. ...

Eclipse and Command Line's Java output differs

Could there be any obvious reason why a Java program I run from the Eclipse IDE's output is different from what I get if I do the same with the command line in Windows (XP)? I am using the JDK 1.6.0_04 and Eclipse 3.4.0 The program creates threads and then tests a locking algorithm. In Eclipse, the threads do not interfere with each oth...

non-editable JTextField: Set visible area

Hi, I have a JTextField with a fixed width, let´s say 100 pixel. Now, I put a text inside this JTextField whose length is greater than "100 pixel", means you have to scroll in the JTextField (possible width mouse). The JTextField isn´t editable. How can I make sure that the part of the text I see is the beginning, not the end of the t...

How to know when network down using java socket programming

Hi I have a problem how to detect when the network goes offline. My server and client are in different computer. but connected by LAN Actually I have written tcp socket programming in java. Once both server and client are connected then if i write something and put a sleep of 10 sec then I remove my LAN cable. After 1 min I plugged my L...

How to create a table in mysql for containing 3 columns?

I want to create a table containing three string columns: The JSP page Part of JSP page (like footer, header, text) Actual value text How do I do that: from the command prompt from a Java application (Create if it doesn't exist -- how common is that?) Thanks ...

Development productivity of Ruby on Rails vs. Java in 2009

Hi, I know this has been a hot topic in the past, spawning many flame wars and a tribe-like attitude in the forums. Some years have passed and Java has evolved: we now have more annotations for almost everything, nice scaffolding tools like Appfuse or Spring Roo, etc. I'd like to know, from people who have developed real projects on R...

JDBC fundamental concepts, Pooling and Threading

I was always using JDBC in JavaSE on single-threaded environment. But now I need to use a connection pool and let many threads to have interaction with the database (MSSQL and Oracle) and I am having a hard time trying to make it as it seems that I am lacking some fundamental undestanding of the api. AFAIK after connect and logging a Co...

javaw.exe.manifest hangs when starting eclipse

I am using an older eclipse and swt 3.1. I tried using the javaw.exe.manifest file hoping to get SWT to use the XP theme styling. But whenever i starts, eclipse just hangs and nothing is shown or executed. Anyone has any experiences with this? thanks javaw.exe.manifest ...

save or update problem

We have an application which has a swing client and java app on the server (jboss.4.2.1.GA) side. We are using ejb3. In our application at some point we are successfuly creating an invoice and show it to the user but when user wants to chage the invoice we get the following error. After reloading the invoice user can be able to change t...

App Engine Class With Children Of The Same Type

I'm trying to save a tree structure in app engine. My class has a parent and a list of children of the same type. Everything works until I add the children property. There are no errors when I call pm.makePersistent(), but the object is not saved. Does anyone know why this doesn't work? This is my class. I'm using App Engine versio...

Need to read own Jar's manifest, and not root-classloaders' manifest

Hi, i need to read the Manifest file, which delivered my class. but it seems that when i use getClass().getClassLoader().getResources(...) i end up getting the MANIFEST from the first Jar loaded into the Java Runtime. My app will be running from applet or webstart, so i will not have access to my own .jar file i guess i actually w...

Running linux process from servlet useing Runtime.exec()

Is it good idea to run linux process in multi user environment. Ex: Runtime rt = Runtime.getRuntime(); Process proc = rt.exec("linux command"); int exitVal = proc.waitFor(); // may wait till 5 to 10 mins ...

Trouble Configuring JPA in Jetty

I am trying to get JPA (Toplink) configured to run in Jetty being run from the maven plugin and am getting a javax.naming.NameNotFoundException. The specifics. web.xml: <persistence-unit-ref> <persistence-unit-ref-name>persistence/mod</persistence-unit-ref-name> <persistence-unit-name>ModPU</persistence-unit-name> </persistence...

Java ME: Are there some good opensource APIs which make the limited Java ME more Java SE like?

Hello! Recently I started playing around with Java ME. The standard API seems very limited to me, compared to recent Java SE. Are there some good opensource APIs which would make Java ME more Java SE like? ...

Java Web Services Container

I have just started learning Java Web Services ( JAX-WS ) and have one question. The reference documentation always talks about Web Services container. My question is : What is a Web Services container and why do we need it. I saw a simple example of JAX-WS in book "java web services up and running" where the web service is published usi...

How to drop/restart a client connection to a flaky socket server

I've got Java code which makes requests via sockets from a server written in C++. The communication is simply that the java code writes a line for a request and the server then writes a line in response, but sometimes it seems that the server doesn't respond, so I've implemented an ExecutorService based timeout which tries to drop and r...

Java JFileChooser opens back up after clicking open in the chooser dialog

When I use the JFileChooser in my project that i am working on everything works just like it is supposed to work with no problems at all except for one. when you click "open" in the dialog it changes my background and then the JFileChooser dialog opens up again. could anyone tell me what i need to do to make that not happen?? here's al...

Browser compatibility

Hi, Just wanted to know if ASP.NET supports other browsers as well as it supports Internet explorer? Also, does Spring/Java framework for a web platform would them in any better way…? Thanks. ...

C# Java HashMap equivalent

Coming from a Java world into a C# one is there a HashMap equivalent? If not what would you recommend? ...

How to force Maven to download maven-metadata.xml from the central repository?

What I want to do is to force Maven to download the 'maven-metadata.xml' for each artifact that I have in my local repository. The default Maven behaviour is to download only metadata from remote repositories (see this question). Why I want to do that: Currently I have a remote repository running in a build machine. By remote reposit...