java

Unable to find/install the Java package acm.graphics

I get the following error message RobotFace.java:3: package acm.graphics does not exist import acm.graphics.*; ^ It suggests me that I do not have acm.graphics -package. I have tried to find and install the package in MacPorts unsuccessfully by port search acm How can you install acm.graphics package in your computer for Java? ...

Java - How to create a custom dialog box?

I have a button on a JFrame that when clicked I want a dialog box to popup with multiple text areas for user input. I have been looking all around to try to figure out how to do this but I keep on getting more confused. Can anyone help? ...

Is it possible to use a web framework but not be dependant on that framework?

Hello All, I am investigating the use of web frameworks with my Java web-app. My basic requirements are pretty much easy maintainability, testability and no repetition. I have explored writing my own MVC-type app using some sort of front controller pattern and JSP's for the views. The benefit of this is that I have complete control of ...

Java variable aliasing workaround

I've recently moved to Java, but I've had some problems with variable aliasing. I've searched everywhere, but I can't seem to find the proper way to copy the contents of one object to another object without just referencing to the same object. Does anyone have any suggestions? Edit: What if it is an int that I am having aliasing problem...

What is the best approach for a Java developer to learn C++

I consider myself an experienced Java developer and am planning to get started with learning C++. If you had same experience, i.e learn C++ after Java, I would like to hear your thoughts on what is the best approach at doing this. [Update] "the best approach" was not well quantified. What I am looking for is to leverage my existing j...

How can I apply an aspect using annotations in Spring?

Update: I've found the Spring 2.x annotation-based Controllers are horrible for AOP security because you can't make assumptions about the method prototype due to the increased freedom in params and return values. Before 2.x you could intercept handleRequest and know the first param was an HttpServletRequest and the return value was a Mod...

How to run eclipse without running JRE install?

I wish to run eclipse for C++ on Vista but I absolutely do not want to run the JRE install. Is there any place where I can get a JRE in a zip that I can just dump in the eclipse folder and have it work? ...

Best Way to Determine if *.doc File is RTF with Java or Coldfusion

So I have about 4,000 word docs that I'm attempting to extract the text from and insert into a db table. This works swimmingly until the processor encounters a document with the *.doc file extension but determines the file is actually an RTF. Now I know POI doesn't support RTFs which is fine, but I do need a way to determine if a *.doc...

Issue with trying to Login to a https secure using apache commons httpclient class

Hi, Iam trying to login to a https secured site using Apache commons httpclient. Iam not getting any way to pass the certificate along with my httprequest , since I cannot find any such classes in HttpClient Package. If anybody can guide me on where do I need to add the certificate handling? Any package to do it? Am open to ideas, a...

JAXB Types problem

I have an xsd that looks like this (snippet): <xs:complexType name="IDType"> <xs:choice minOccurs="1" maxOccurs="2"> <xs:element name="FileID" minOccurs="0" maxOccurs="1" type="an..35" /> <xs:element name="IDNumber1" minOccurs="0" maxOccurs="1" type="an..35" /> <xs:element name="Number" minOccurs="0" maxOccurs="1" ty...

Jsp/ Html Page to Pdf

Hi all, How to convert as PDF from my Jsp/Html file?. i want to convert particular part of my webpage to pdf file. is it possible? Gnaniyar Zubair ...

Remove element from linked list JAVA

OK here is my problem. I have a linked list of card objects. I have the following method public void removeCard(Card card){ cards.remove(card); } if I create Card c = new Card(5,C); for example and there is a card with the exact same values 2, and C in the linked list (cards). If I call the method CardPile.remove(car...

update file in a jar

I'm trying to update a file in an existing jar (in this example antlr) using the command: jar -uf antlrworks-1.2.3.jar org/antlr/codegen/templates/Java/Java.stg But I get the following message java.util.zip.ZipException: duplicate entry: antlr/ANTLRError.class at java.util.zip.ZipOutputStream.putNextEntry(ZipOutputStream...

java.lang.IllegalArgumentException: setAttribute: Non-serializable attribute

Hi, I have inherited some code and am getting an error when I try to run it. The error is below: 10:08:32,093 ERROR [MyServlet]:260 - Servlet.service() for servlet MyServlet threw exception java.lang.IllegalArgumentException: setAttribute: Non-serializable attribute at org.apache.catalina.session.StandardSession.setAttribute(StandardSe...

How should I handle Multi-threading in Java?

I am working on a practical scenario related with Java;a socket program. The existing system and the expected system are as follows. Existing System - The system checks that a certain condition is satisfied. If so It will create some message to be sent and put it into a queue. The queue processor is a separate thread. It periodically ...

disable value in s:select

Hi, if I have a for example this struts tag: <s:select name="country.id" list="countries" listValue="name" listKey="id" headerValue="Select Country" headerKey="" label="Country" /> output is the following html code: <select name="country.id" tabindex="12" id="registration_country"> <option value="">Select Country</option> <opt...

Where to look for open source Java libraries?

I am looking for a Java library to incorporate into a demo web app and have looked on github, Google Code and sourceforge. So far, sourceforge seems to have the biggest selection. Are there any other places to look, or is sourceforge going to be my best bet? ...

API to edit web.xml from Eclipse plugin?

What is the easiest way to edit web.xml from an Eclipse plugin? (I'm looking for an API -- as opposed to using a PrintWriter etc.) ...

Differences between Java and C# and .NET

Apologies in advance for the possible flame thread, but that's not what I'm going for. I've only ever done serious development in Linux using C and C++, and I'm looking to take the plunge into Windows. I've been doing some reading and asking around, and it seems to me that .NET with C# is the way to go for developing commercial user-or...

How should I handle exceptions when using SwingWorker?

I use SwingWorker in Java 6 to avoid running long-running code on the event dispatch thread. If the call to get() in my done() method returns an exception, what is an appropriate way of handling the exception? I'm particularly concerned about possible InterruptedExceptions. The JavaDoc example simply ignores the exception but I've lear...