java

Why do I get "Exception; must be caught or declared to be thrown" when I try to compile my Java code?

import java.awt.*; import javax.swing.*; import java.awt.event.*; import javax.crypto.*; import javax.crypto.spec.*; import java.security.*; import java.io.*; public class EncryptURL extends JApplet implements ActionListener { Container content; JTextField userName = new JTextField(); JTextField firstName = new JTextField(); ...

JAR file not opening on a Mac

Hi guys, I have been trying to open a JAR file on my Mac with no success. It says the JAR file could not be opened and asks me to look for any error messages in my console. Here are the console messages, I suspect the prob is in the first line itself, but I am not from software background, so don't know if this is enough for anyone who ...

How do I sign a Java applet for use in a browser?

I'm trying to deploy a Java applet on my website. I also need to sign it, because I need to access the clipboard. I've followed all the signing tutorials I could find but have not had any success. Here is what I've done so far: Wrote an applet in NetBeans. It runs fine in the applet viewer. Made a .jar file out of it. Created a cer...

Scope of the Java System Properties.

In Java we use System.setProperty() method to set some system properties. According to this article the use of system properties is bit tricky. System.setProperty() can be an evil call. * It is 100% thread-hostile * It contains super-global variables * It is extremely difficult to debug when these variables mysteriously change at r...

Using JBoss Cache as directory for Apache Lucene

Has anyone tried to store Lucene index in JBoss Cache? Are there any good implementations of Lucene Directory for it? I found sources only for this one but I can't find any documentation or testimonials on it. Basically what I would like to do is to store Lucene index in JBoss Cache and manipulate it with application written with GridGa...

Using the ClassLoader method to retrieve all resources under classes as Input Streams

Hello there, My problem is one that you would think is quite common, but I haven't so far managed to find a solution. Building a Java web app under Tomcat 5.5 (although a requirement is that it can be deployed anywhere, like under a WebLogic environment, hence the loading resources as streams requirement). Good practice dictates that r...

Avoiding Initial Memory Heap Size Error

Hi all, I run a Java code with the following command: $ java -Xms4G -Xmx4G myjavacode My cpu's RAM capacity is 6GB. However it always fail to execute giving me this error message: Invalid initial heap size: -Xms5G The specified size exceeds the maximum representable size. Could not create the Java virtual machine Is there any wa...

What's the best way to parse an XML dateTime in Java?

What's the best way to parse an XML dateTime in Java? Legal dateTime values include 2002-10-10T12:00:00-05:00 AND 2002-10-10T17:00:00Z Is there a good open source library I can use, or should I roll my own using SimpleDateFormat or similar? ...

while loop issues java

I'm reading data from serial port inside while loop as follows: while((len = this.getIn().read(buffer)) > 0) { data = new String(buffer, 0, len); System.out.println("data len " + len); handleModemresponse(data); } but, while reading the data from stream starts, the main AWT window, which has a disconnect button, is not get...

Can you use a Card Layout on Game Panels?

I set up a Card Layout at main Game Panel, in order to bring up some additional menus at certain times during the game. When I run the build, the panels just flash back and forth between each other continually. Is this because both of them are continually refreshing? and is the card layout feasible in the main Game Panel, Is there a ...

jersey security and session management

Hi, Is there a way for session management or security available programatically in Jersey specification. e.g. like a web-application session management. Or is transaction, session, security all handeled by the containor on which the jersey application is deployed. Adhir ...

JAVA jar execution problem

When i execute the application in jidea ide it executes fine. But when i double click the jar file it shows the gui fine, then i click a button which must create some objects, but only some objects created, in that action call some constructors does not called. But when this is done in the ide all the constructors called!!! what is the ...

IntelliJ not recognising JDK version

I have write one java project on IntelliJ idea 8.1.1.When I go to compile option of IntelliJ IDEA 8.1.1 then it shows pop-up message box, in that it shows error- cannot determine version for JDK Update JDK configuration. Even though I have proper JDK version, I have jdk1.5.0 installed in my PC working properly with other environm...

C#: How would I execute this command line directly to java.exe ?

I am writing a program that needs to run a java.jar server. I need to run the process directly so I can rewrite the output to a textbox and all-in-all have complete control of it. I tried just doing it through CMD.exe, but that wouldnt work because CMD.exe would just call a new process java.exe and I wouldn't have control of it. I need t...

Generating Class Diagram

HI All I am at the end of the release of my project.So in order to keep working our manger asked us to generate Class Diagrams for the code we had written.Its medium project with 3500 java files .So I think we need to generate class diagrams.First I need to know how reverse engineering works here. Also I looked for some tools in Google(G...

In a method that performs C in CRUD, what should it return ?

Imagine an interface with a method to create objects of type Address. The entities involved here are irrelevant. /** * @throws IllegalArgumentException if addy is null or invalid * @throws PersistenceException if db layer encounters a problem */ Object addAddress( Address addy ); addAddress inserts the domain object into the databa...

Do I have any method to override System Properties in Java?

I am getting a practical issue and the issue can be dascribed as follows. We are developing a component (Say a plugin) to do some task when an event is triggered within an external CMS using the API provided by them. They have provided some jar libraries, So what we are doing is implementing an Interface provided by them. Then an intern...

Data binding of @ModelAttribute annotated parameters

I have a Spring 2.5 annotated Controller in which I have a method annotated with @RequestMapping(method=RequestMethod.GET), which performs some logic to fill the model. I also have a method annotated with @RequestMapping(method=RequestMethod.POST) which performs the request. This method has a @ModelAttribute annotated parameter that con...

Red Black Tree <Black Height> (Redraft)

/** The following function checks the red black tree black height * @param n the root node is inputed then a traversal is done to calculate the black-height * @return Return an error message / mesages informing the user whether or not the black height was maintained * @author Ferron Smith */ public static void getCount (SkaRedBlackTreeN...

can any one tell me which is the best way to learn spring

hi, can any one tell me the best way to learn spring. i have sound work experience in struts. and little experience in jsp and hibernate thanks in advance ...