I am used to the c-style getchar(), but it seems like there is nothing comparable for java. I am building a lexical analyzer, and I need to read in the input character by character.
I know I can use the scanner to scan in a token or line and parse through the token char-by-char, but that seems unwieldy for strings spanning multiple line...
I would like to export the image in my JPanel to a vector graphics file so it can be edited and printed at a higher-than-screen resolution. Essentially I want its paint() function to be called with a destination Graphics that saves the drawing commands into a vector graphic file.
What is a good, simple way to do this? What libraries a...
I am writing an application in java (1.6) using swing. I currently have a JXBusyLabel on a JXLayer over the content area of my program acting as a busy indicator. I want to provide a way to allow others working with me to create a task that pops up the busy label while it's executing. The catch is, the task must be cancel-able. What is t...
Hi. Sorry my newbie question :P If I promp "java -version" in the cmd on a windows system, am I guaranteed that the system will be able to run .jar files if I don't get any error?
...
Is there a way to auto-cast Spring beans to the class defined in the application context XML? I'd like to avoid putting type information about the beans in 2 places.... in the xml configuration file and also in the code as a cast.
For instance, given this config file
<bean id="bean-name" class="SimpleSpringBean" scope="prototype">
...
Apache Commons IO FileUtils.contentEquals() compares 2 files.
Is this also possible using code from eclipse.org ?
...
I am not very familiar with databases and what they offer outside of the CRUD operations.
My research has led me to triggers. Basically it looks like triggers offer this type of functionality:
(from Wikipedia)
There are typically three triggering events that cause triggers to 'fire':
INSERT event (as a new record is being inserted...
I'm doing something in Java SE that would require me to use SSL in an unusual way.
The required steps would be something like:
Establish an SSL session;
Exchange some private information;
Renegotiate connection parameters to stop using cryptographic operations.
I haven't found in the Java API a way to to this. I believe that the prob...
I have a class that takes objects from a BlockingQueue and processes them by calling take() in a continuous loop. At some point I know that no more objects will be added to the queue. How do I interrupt the take() method so that it stops blocking?
Here's the class that processes the objects:
public class MyObjHandler implements Runna...
I asked a general Spring question and had multiple people respond that calling Spring's ApplicationContext.getBean() should be avoided as much as possible. Why is that?
How else should I gain access to the beans I configured Spring to create?
I'm using Spring in a non-web application and had planned on accessing a shared Application...
My organization has made an upper level decision to move to maven as the standard build tool for Java projects. I have been tasked with helping our local teams migrate projects over to maven.
One of the core tools that is in play is the MyEclipse IDE. MyEclipse seems to have had a "fun" history with the maven team as evidenced in vari...
I have an open source Java database migration tool (http://www.liquibase.org) which I am considering porting to .Net.
The majority of the tool (at least from a complexity side) is around logic like "if you are adding a primary key and the database is Oracle use this SQL. If database is MySQL use this SQL. If the primary key is named ...
Hi all, first time poster and TDD adopter. :-) I'll be a bit verbose so please bear with me.
I've recently started developing SOAP based web services using the Apache CXF framework, Spring and Commons Chain for implementing business flow. The problem I'm facing here is with testing the web services -- testing as in Unit testing and func...
I use the following lines to get the memory usage with Java :
Free_Memory=Run_Time.freeMemory()/1048576; // 1024 x 1024 = 1K x 1K = 1Meg
Total_Memory=Run_Time.totalMemory()/1048576; // 992 Total on a 4 GB PC
The Free_Memory I got was : 900, but it is way off, when Free_Memory goes down to around 600, my program ran o...
Here's another issues that we are facing while migrating our application from current production environment to the new data center environment (see details below)
Current Production Environment : Java 1.4, Java EE 3, WAS 5.1, JSF 2.1
New Environment: Java 1.5, Java EE 5, WAS 6.1, JSF 2.1
Here we have a third party jar file with the ...
I'm looking into the various ways to validate input for an editable JComboBox. Currently, I need to restrict input to numbers in a specified range. Thus far I've found 3 distinct ways. Any thoughts on the best way to approach this?
JComboBox comboBox = new JComboBox(
new Object[] {"Donnie", "Danny", "Joey", "Jordan", "Jonathan"}
);
...
When you run a program through the command line, you can use java -Xms -Xmx to specify the heap sizes. If the program is going to be run by double clicking a .jar file, is there a way to use more heap than the standard?
...
In the book 'Code Complete' the author talks about programming into a language (instead of programming in a language). He means, that you should not limit yourself by the restrictions of the chosen programming-language.
A callback is an often used feature. I'm interested: What is the most elegant way to programm callbacks into the java-...
What is the difference between composition and aggregation?
can anybody give me a sample of this OOAD?
...
Hi. I'm having a hard time trying to make a Java program with just a shape (e.g rectangle) as main window. I don't want the shape to be inside the 'OS-window' (with buttons to close and minimize etc..)
...