java

pound(#) sign in directory name: in Java How to read it

The ClassLoader doesn't find me the file. It throws a: javax.xml.transform.TransformerConfigurationException: javax.xml.transform.TransformerException: java.io.FileNotFoundException: I was trying to do the follwoing: TransformerFactory.newInstance().newTransformer(new StreamSource("C:\\dev\\workspace\\test1\\a#b\\Browser-Email....

How to print string association from phone number as text?

I need some help with a method i'm writing for a project. the method changes a phone number into a list of text strings. You know that 2-9 have letters associated with them on a phone. i would like to make a converter that will change a 7 digit number to a list of strings. i would like to see all possibilities. i already cut out all th...

Variables in Interface

Why is that a variable used in an Interface is PUBLIC STATIC FINAL? Why "static" in particular? ...

Download a non html file with HtmlUnit

I'm writing a JUnit test that involves the downloading of a file from the web app. How do I do that with HtmlUnit? ...

Detect WebCam device using with java

Hello friends, I am using JMF to operate my web cam.My usb webcam works perfectly with JMF, I used it in JMStudio however,when I make this call from my java code deviceListVector = CaptureDeviceManager.getDeviceList( null ); my "audio capture device" is detected however, my usb webcam at vfw://0 is not detected. To clarify, the audio...

Java error: Only a type can be imported. XYZ resolves to a package.

I get the error: "Only a type can be imported. XYZ resolves to a package." Someone has explained the cause here but I am not sure what I supposed to do to fix this. FYI: I am using Eclipse. I have added the code that does the importing below. The java.util.* import works fine. <%@ page import="java.util.*"%> <%@ page import="org.ivec...

TCP Connect takes X100 longer than ping

I have a java process on machine A communicating with a Tomcat on machine B via TCP. The TCP connect (just the syn-syn/ack exchange) takes on the order of 100 ms consistently, while a ping request takes 1 ms (the serves are on the same LAN). What could cause the increased delay in establishing a TCP connection? How do I optimize it? ...

only JLabel not showing up...

I am writting a simple application which has a button that opens a new window then display a simple GUI/Text to acccept inputs from a user. but for some reason, I can get JLabel to be displayed on the new window. The application has following structure: +mainFrame - JFrame +newFrame - JFrame -+newPanel - JPanel ----title - JLabel ...

Java: Why can String equality be proven with ==?

I learned that it is from the devil to test String equality with == instead of String.equals(), because every String was a reference to its own object. But if i use something like System.out.println("Hello" == "Hello"); it prints true. Why? ...

Splitting one DB association into several collections in Hibernate.

I am trying to model such situation - there is a cash transfer (I mean a car that carries money), that has required amounts of each currency, and also an actual amount for each currency. And it seems to me pointless to create two separate classes, one for required amount and another for actual amount. So the implementation would look lik...

VOIP in C#, asp.net or Java

Could you people please give some good resource / ideas of implementing VOIP in c#.net, Asp.net or Java. Why I am specifying 2 different language platforms is we are yet to take up a call. Basically we don't have the idea henceforth the concept is more important to us. We are going to make a White board application and one of the cli...

Java server jvm installation on windows 32 bit systems

I am trying to bundle java as a part of a java product that should be installed silently with a single click and are having some issues: My installation has the following requirements: Has no be silent and require no user input or action excpect a doubleclick on the installation file (no configuration and post install steps) Has to setu...

Is there a good examples and documentation of jface databinding framework for Eclipse 3.4?

The official site is quite scarce and most of the examples are EMF- related and for Eclipse 3.5 But what if one uses 3.4 target Eclipse platform and does not use EMF. I am specifically interested in Tree Viewer examples, but good example and documentation is always appreciated. ...

database connectivity?

How to establish SQL 2005 database connectivity with Java application. Actually I don't know how to set path for JDBC. Any help would be great. ...

Static String constants VS enum in Java 5+

I've read that question & answers: http://stackoverflow.com/questions/66066/what-is-the-best-way-to-implement-constants-in-java And came up with a decision that enum is better way to implement a set of constants. Also, I've read an example on Sun web site how to add the behaviour to enum (see the link in the previously mentioned post). ...

How to use java.lang.Enum

This is not a question of the new features in enum. This is not a question that waits for an answer that says enum is equivalent to class xyz extends Enum. If you wish to preach on how enums are used, as found in numerous tutorials, please don't answer. This question is specifically on how to use the class java.lang.Enum. Rather it is ...

Why is Sun inventing another module system when everyone has standardised on OSGi?

Sun is putting a lot of effort behind modularising the JDK in the form of Jigsaw, and insinuating that it should be the module format of choice for other Java developers as well. The only notable player who is using this is NetBeans (and derivative applications). On the other hand, the industry has standardised around OSGi, with all of ...

JSF - project structure examples

Is there any JSF CRUD project structure examples? I surfed the net to find some good and big JSF examples, but everywhere are only small projects with simple structure. I need JSF project example with CRUD, forms and reports. ...

Unable to find class annotation

Why does this code print 0? @Table(name = "source") public class SourceDetails implements DatabaseEntity{ public static void main(String[] args) { System.out.println(SourceDetails.class.getAnnotations().length); } ... } ...

Is it possible to set up two FileHandlers in the same logging.properties file?

Using the logging classes in java.util.logging, is it possible to set up two different FileHandlers with different formatters that will write different logging information to two different files? I'm currently using a logging.properties file, and the handlers line is not encouraging: handlers = java.util.logging.ConsoleHandler, java.ut...