java

Running GCC precompiler on Java code

I'm trying to run the GCC precompiler on Java code by issuing the following command: "gcc -D YES -E -x c -o YesNo.java _YesNo.java". The gcc precompiler adds some extra stuff/info in the beginning of the file, though, as can be seen below. How do I instruct the precompiler not to create such outputs so I can compile the output of the pre...

Number of GWT RemoteServiceServlets

When designing an application with a large number of remote services, is it better to have one RemoteServiceServlet end point with many methods or a large number of RemoteServiceServlet endpoints with fewer methods? ...

What are the good open source implementations of Java Virtual Machine ?

I am trying to write my own JVM. Can you point me to some existing open source implementations. Thanks. ...

altering network setings via java program

I want to write a program that will reset a user's Local Area Network / (TCP/IP) Properties. Here's what I do manually (which I want to program to do automatically): 1) START -> Run -> cmd (get command prompt) 2) ipconfig /release 3) START -> Connect to -> Show all connections 4) Right-click "Local Area Network" and click "Properties" ...

What is the error in this string loop?

for (int i = len-2; index>= 0; index --) ...

Simple Java List Question

I am supposed to create an iterative method stretch that takes a positive number n as a parameter and returns a new ListItem beginning a list in which each of the numbers in the original list is repeated n times. For example, if the original list is ( 6 7 6 9 ) and the parameter value is 2, then the new list returned is ( 6 6 7 7 6 6 9 9...

Java: Changing the properties of an iterable object while iterating over it

The following code is just to produce an example of the problem: public static void main(String[] args) { Collection<Integer> src = new ArrayList<Integer>(); Collection<Integer> dest = new ArrayList<Integer>(); src.add(2); src.add(7); src.add(3); src.add(2201); src.add(-21); dest.add(10); while (src.size() != 0) { ...

why can't i access protected java method even thought i've extended the class?

Here's the documentation for the protected method: /** Converts jmusic score data into a MIDI Sequence */ protected javax.sound.midi.Sequence scoreToSeq(Score score) And I made this little class to extend the class that scoreToSeq method comes from: public class MidiSequence extends MidiSynth{ public Sequence getSequence(Score ...

JMenuItem accelerator not working after showing two non-modal JDialogs? (Mac only?)

I have the problem that the accelerators of JMenuItems aren't working anymore after showing two JDialogs directly after one another. Please take a look at this small example that reproduces the problem: import javax.swing.*; import java.awt.*; import java.awt.event.*; public class DialogBug { public static void main(String[] args)...

Writing Encoded Objects to File

Hi all, I'm looking for a low-level encryption to write questions/answers for a test/exam application in Java. Both the questions and exam are objects. Basically, I need a way to serialize a object, write it to a file, whilst encrypting everything so no one can read the question/answers without my program. I've heard of Protocol Buffer...

Examples of Object-Oriented Projects Help Procedural Programmers

Please help me identify some small to medium sized open source projects that embody object oriented design (preferably in C++ or Java). I would like to use these projects to demonstrate how real world problems (as opposed to contrived text book examples) can be solved with an object oriented design. I want to be able to present a plaus...

What would PHP bring to the table for a Java Developer ?

I am a Java EE developer working mainly with JSPs, Servlets, and frameworks like Spring. Will learning PHP be a wise decision ? What would PHP offer me ? ...

Tomcat performance issue

I've got a web application that's running really slowly and occasionally hanging. It's a school-related Wicket app with reporting and editing, and also a servlet which is used by automated clients to get/post data via HTTPS. During busy times where a lot of editing/uploading/downloading is going on, the app becomes sluggish and unrespo...

How to design a system that queues requests & processes them in batches ?

I have at my disposal a REST service that accepts a JSON array of image urls, and will return scaled thumbnails. Problem I want to batch up image URLs sent by concurrent clients before calling the REST service. Obviously if I receive 1 image, I should wait a moment in case other images trickle in. I've settled on a batch of 5 images. ...

Java: List<E> decorator implementation with notification

Hi, I need to implement List decorator class, which notify registered listeners in case of any change in list. I have subclassed AbstractListDecorator from org.apache.commons.collections15 and override methods like add(), addAll(), remove(int), remove(E) and so on with my notifying. But there are some holes in -- for example when iter...

A list of objects in Java

I'm trying to make a list containing different objects. List<Object> list = new ArrayList<Object>(); defObject defObj; optObject optObj; and defObject has just one property for a String. public static class defObject { public static String defObj; public defObject(String x) { setDefObj(x); } public static String get...

I need to download jasper reports professional trail version

I need to download jasper reports professional trail version, can anyone help? ...

need your advice regarding this desktop animation application

i want to create an application that when running would make appear a circle ( radius and color configurable ) move from centre-down of my laptop screen to centre-up ( speed of motion configurable ). this animation should run in a loop as long as the program is running and i want to know is it also possible that when this circle is runni...

How do you call the default media player to play a wav file in Java?

How do you call the default media player to play a wav file in Java? ...

how to insert/retrieve a userDefined Object in DB-MySql?

I want to insert and retrieve a a user defined Object in DB,am using Mysql5.1. 1)What should me the data type for the column(is Blob is the correct answer for this question) I am using EntityClass to Insert/Get values from the DB. 2)but to how to insert Object in database? ...