java

connection between applet on network

Dears.. i try to make a small applet, this applet is about (Dots-lines)game, and i think all of us konw this game. "Java applet to play the pencil-and-paper game of "Dots and Boxes", also known as "Lines and Boxes". The game board is a rectangular grid. Dots are shown for the corners of the board squares. Players take turns drawing...

I can't understand the usage of the normal class libraries of the Java

I'm a beginner at Java Programming. I have the experience that I used DX library for before in C++. The DX library worked with simple functions, but the library of the JAVA does not work with functions. How can I understand Java Class libraries? ...

What are some of the different names of terms and concepts in Objective C as compared with Java?

I was hoping to make a list of some of the differences in terms between java and objective c to abate my confusion. It makes explaining my difficulties easier when I know what things are called. For example: null - nil this - self map - dictionary (not even quite sure about this one) What I'm looking for are similar comparisons or c...

build tool to detect autoboxing?

Does anyone know of any style checkers or build tools that would flag autoboxing and unboxing from the build server? I already have the eclipse option to flag it on my end, but not everyone in the project uses the same IDE or same settings. Finding it on the build side seems the only way to detect where it might creep into the project...

Only one parameterization of an interface can be implemented—how to work around?

Here's an example of what I'd like to be able to do (in Java): interface MyInterface<E> { public void doSomething(E foo); } class MyClass implements MyInterface<ClassA>, MyInterface<ClassB> { public void doSomething(ClassA fooA) { ... } public void doSomething(ClassB fooB) { ... } } When I try to implement this, th...

Capturing Entire response including headers with HttpServletResponseWrapper

Thanks to everyone in advance - So I went ahead and implemented this code: http://stackoverflow.com/questions/701681/how-can-i-read-an-httpservletreponses-output-stream Which gives me the body of the response (html etc), but I am not getting any headers at all - is this possible to do with HttpServletResponseWrapper? I need to capture ...

What's wrong with: LinkedList<String> stringList = new LinkedList<String>();

When I try: LinkedList<String> stringList = new LinkedList<String>(); I get the following compilation error: type LinkedList does not take parameters What am I missing? Can't you do this? ...

How do I convert a regular expression in a valid .NET format to valid Java format?

Hi, I want to use the following regular expression which is written within a C# .NET code, in a Java code, but I can't seem to convert it right, can you help me out? Regex(@"\w+:\/\/(?<Domain>[\x21-\x22\x24-\x2E\x30-\x3A\x40-\x5A\x5F\x61-\x7A]+)(?<Relative>/?\S*)", RegexOptions.Compiled | RegexOptions.IgnoreCase | RegexOptions.Singlelin...

Running hibernate tool annotation generation without the "catalog" attribute

when i run my hibernate tools it reads from the db and create java classes for each tables, and a java class for composite primary keys. that's great. the problem is this line @Table(name="tst_feature" ,catalog="tstdb" ) while the table name is required, the "catalog" attribute is not required. sometimes i want to use "tstdb", so...

study roadmap for newcomer into java ee

I'm the newcomer into java ee,I have studied about core jave,servlet,jsp. Could anyone give me some suggestion(some books,forums,etc) on how to promote my skills into jave ee? Thanks a lot in advance. ...

Java SWT - Repainting a canvas after a resize

I have a shell that contains a canvas, which in turn draws some text in its PaintListener. The problem is, when I dynamically reduce size of the shell with its setBounds method (this is going to happen every once in a while), the text doesn't get redrawn. In fact, the canvas' PaintListener doesn't get called again. Is there a way to for...

How to isolate your program from calls to a "bad" API?

When I developed a piece of (academic) software using Java, I was forced to use an API that was rather badly implemented. This means that calls to this API for a certain set of input data would sometimes never return. This must have been a bug in the software as the algorithms that it offered were deterministic ones, and sometimes it wou...

how to open the find type dialog programmatically in eclipse

Hi, I want to open the "Ctrl-Shift-T" dialog (find a type) programmatically in eclipse plug-in. I tried the FilteredItemsSelectionDialog and ResourceListSelectionDialog, but how do I get all the types in the workspace? Thank you, Ido. ...

Singleton vs Static Preference and Defect

Hi, When we want deploy Web Application should we use singleton Object or use Static instead of? what is the bottleneck for use each of them? I should know about Memory Problem , Concurrency problem and ... . P.S: what happen for the class that was just readable (should use static or Singleton) P.S 2: what happen for the class that wa...

referencing each case of a switch from a conditional inside a different method in java

Hello, I am implementing some methods which use switch statements to distinguish between different cases: private void doThis(){ switch(command){ case on: {status = doCalculationsA; break;} case off: {status = doCalculationsB; break;} case idle: {status = doCalculationsC; break;} case stdby:{status = doCalculationsD;...

Memory shortage problem while using BufferedImage and ImageIO to save images.

I want to save some java.awt.Image objects into the disk. But when I try like: for (Image image : images) { image = new ImageIcon(image).getImage(); BufferedImage temp = new BufferedImage(image.getWidth(null), image.getHeight(null), BufferedImage.TYPE_INT_RGB); Graphics2D g = temp.createGraphics(); g.drawImage(image, 0, ...

Is it possible to get Java to ignore the "trust store" and just accept whatever SSL certificate it gets?

I am trying to write an SSL client that sends mail using the javax.mail API. The problem I am having is that the server request that I use SSL, but the server is also configured with a non-standard SSL certificate. The web pages I have found say that I need to install the certificate into the trust store. I don't want to do that (I don't...

Using CacheListener with GAE

I store instances of Domain objects in GAE's memcache using the javax.cache API. I'd like to be notified as soon any instance is evicted due to storage limitations or anything else. Is a CacheListener the solution for that? Is GAE calling CacheListener.evict(Object o) when it's removing instance? ...

few characters missing after decryption.

Hi, This is my original xml: <?xml version="1.0" encoding="UTF-8"?> <table> <row> <id>12</id> <name>Mickey Mouse</name> </row> </table> This is the output after going through encryption/decryption process <?xml version="1.0" encoding="UTF-8"?> <table> <row> <id>12</id> <name>Mickey Mouse</name> </...

Exchange server will not accept username/password provided with javax.mail API

I have a lovely little Java client that sends signed email messages. We have an Exchange server that requires username/password authentication to send a message. When I connect to the exchange server, I get this error: avax.mail.AuthenticationFailedException: failed to connect at javax.mail.Service.connect(Service.java:322) ...