I do all my programming assignments in eclipse first before putting them in putty and submitting them to our teacher. In eclipse, I have this strange error in one of my methods.
it says "Syntax error on token(s), misplaced construct(s)."
public static int factorial(int iVal, boolean DEBUG)
{
int result;
// Defensive programming
i...
I have a doubly linked list that's storing a bufferedimage in each node. I can easily retrieve all the buffered images by creating an iterator and iterating through list. I want to display each node horizontally one after the other in some sort of a panel. This would be similar to a film reel where frames are linked one after the other. ...
Ok so this program is trying to display the middle digit of a 1-4 digit integer and if it has an even number of digits it should display that there is no middle digits, however I can't get it to output the answer properly, here is the code:
public class digit {
public static void main(String[] arg) {
int MyInt1, MyInt2, MyIn...
I was taught about formal systems at university, but I was disappointed how they didn't seem to be used in the real word.
I like the idea of being able to know that some code (object, function, whatever) works, not by testing, but by proof.
I'm sure we're all familiar with the parallels that don't exist between physical engineering and...
Hi guys,
i have the following class that writes to a file but is not working as i want. I call the write method in a while loop so that it writes a string to a new line. It only writes the last string. All the previous ones are not written except the last one.
Here is the class:
import java.io.FileReader;
import java.io.FileWriter;
im...
I used richfaces in a JSF project. Now I'm trying the same with Seam.
But I always get the same JavaScript error:
Message: Object required
Line: 2791
Code: 0
URI: http://localhost:8080/myapp/a4j/g/3_3_1.GA/org/ajax4jsf/framework.pack.js
The s:button tag works
<s:button id="eMail0" value="sButton" action="#{Mailer.sendMail}" />
Bo...
So I'm trying to take an input from a user using Scanner(System.in) but when i try to type something into the console it won't let me.
Can anyone help?
Function.show();
Scanner input = new Scanner(System.in);
if (input.equals("a"))
{
Function.outputFile(1, list);
}
input.close();
...
This piece of code generates unexpected output.
Hashtable<Pair, Integer> results = new Hashtable<Pair, Integer>();
results.put(new Pair(0, 1), 2);
System.out.println("[DBG] " + results.containsKey(new Pair(0, 1)));
The output is [DBG] false. Why did Hashtable fail to register this element? Does it have something to do with the way I t...
I am using XOM to canonicalize some XML. But there are some strange characters prepended to the output. The core of the code is as follows:
String result;
outputstream = new ObjectOutputStream(bytestream);
Builder builder = new Builder();
Canonicalizer canonicalizer = new Canonicalizer(outputstream, Canonicalizer.EXCLUSIVE_XML_CANONICAL...
Hi StackOverFlowians,
I am working on JiST/SWANS, Java-based discrete event simulator, in Eclipse.
Moreover, in Vanet.info (http://vanet.info/node/14) extensions and improvements for JiST/SWANS have been developed.
I used all the instructions(http://vanet.info/node/119) in Vanet info to prepare my simulation environment.
There is n...
Hello,
I'm trying to create a webApp using GlashFish server and Velocity.
But i get the following error:
SEVERE: ResourceManager : unable to find resource 'temp.vm' in any resource loader.
SEVERE: org.apache.velocity.exception.ResourceNotFoundException: Unable to find resource 'temp.vm'
velocity.proprieties:
resource.loader=web...
Hello everyone. I'm doing a Windows Service in Java, this service list the files in a directory and write the results in a file. My problem is that when i call Java.File.isDirectory() when the service is running it always results false (It works well when i run the service manually as any other program). Besides, if i try the following: ...
I'm writing an Android app that requires SSL client authentication. I know how to create a JKS keystore for a desktop Java application, but Android only supports the BKS format. Every way I've tried to create the keystore results in the following error:
handling exception: javax.net.ssl.SSLHandshakeException: null cert chain
So it looks...
Is there a way to disable restrictions of javac 1.6.0_22 that prevent me from using JRE internal classes like sun.awt.event.* ?
I'm not looking for:
an explanation why it is forbidden.
suggestion to use different classes
suggestion to use reflection
suggestion to use ecj/eclipse
I just want to know if it is possible or not, and if i...
I have a JPanel which contains a lot of child components. While updating\adding new components to the parent JPanel I'd like to prevent it from repainting, how can this achieved?
...
Is there something similar to setting -D javax.net.debug=ssl at the command line for Java desktop applications, but for the Android? I've tried setting it in code via System.setProperty("javax.net.debug", "ssl"); but that didn't work.
If there isn't a way to enable this property, is there at least another way to debug the client side of...
To fix a test case I need to identify whether the function is called from a particular caller function. I can't afford to add a boolean parameter because it would break the interfaces defined. How to go about this?
This is what I want to achieve. Here I can't change the parameters of operation() as it is an interface implementation.
op...
Hi everyone! I'm designing an optimization system for public transport in a big city. So I have a map with some points on it, but don't care about it)
All I need is: my own JButton, which looks like a color-filled circle and a small text tag near it. I got some problems while overriding the paintComponent() method.. the round button is p...
Hi all,
I have a java program where I want to validate if any of 3 booleans is false. I want to figure out the smallest expression I can write to check against the permutations.
if(!(needsWork && (needsApproval || isAdmin) ))
I think this is enough to make sure that if any of the 3 booleans is false I want to stop processing. H...
In Spring Roo I used this tutorial with my custom xsd to generate objects.
After that I used command controller all ~.web, controller is generated but without CRUD functions.
If I make manual objects in Roo controller with CRUD functions is generated. Any idea what is the problem?
Schema file xsd is in my case important for REST data exc...