java

java

  • All Sites

0 answers

Encapsulation / Abstraction

I've noticed that the notion of Encapsulation and Abstraction are important when discussing OOP design. However, I'm not too sure on how they differ from one another. I've read a bunch of articles and …

34 secs ago
0 answers

How to populate JList with .java and .class files

Im creating an application that gets a list of .java and .class files from a chosen directory and places them in a JList. I am using Netbeans 7.1.2. At the moment i have the files being retrieved …

51 secs ago
0 answers

Does all network traffic go through the RMI registry?

This may seem like a simple question, but I can't find the definite answer: Say I have three servers on a local un-firewalled network, one of which is the registry (R) and the other two are clients …

1 min ago
2 answers

Datastore throwing exceptions when getting entities by Key

In the last few hours I've started getting exceptions when getting entities by key: Caused by: java.lang.NullPointerException at ...

2 answers

Android: Positioning in file (similar to fseek in C++)?

I'm trying to read some data from html file that I opened from internet using httpClient. I'm using readLine() function in loop for reading. The lines I want to read start at 500th row. Is there a …

7 answers

How to access variable from a static class

I want to access a variable from a static class. For example : public class ABC { public static void ABC() { int abc = 123; int bcd = 234; } public int getabc() …

1 min ago
2 answers

How to get rid of a false error in IBM RAD 8 / Eclipse?

I use JSP include and from my IDE (IBM RAD 8) I get an error that it can't find variables and that imports can't get resolved but those variables and imports are actually handled in the file that ...

2 mins ago
0 answers

appengine java development server displaying source code

When I access a jsp page like this on an appengine development server: localhost:8888/index.jsp/ it's displaying the source code of index.jsp in the browser. if you access without the trailing slash …

3 mins ago
1 answer

Spring, Hibernate, Transaction Management, not commited

So, I try to use Spring for transaction management. Finally my application had worked, but without committing. Before using Spring I managed transactions in DAO, and I thought that after I can remove …

1 answer

Jackson SAX parser throws exception when parsing huge JSON

I'm trying to implement JSON array iterator with Jackson SAX parser (please, don't ask why). My app should work with huge files (up to 5 MiB), and that's a problem. That's how I initialize JsonParser …

4 mins ago
1 answer

Add jsp file to ear

I wanted to add a .jsp file to an ear that is deployed at a client site. What would be the process for doing this? Keep in mind I'm very new to the java world. It's going to be a simple keepalive page …

5 mins ago
3 answers

Resetting CLASSPATH after doing export CLASSPATH

I was trying to do a setenv CLASSPATH /somethig/foo/junit-4.9.jar kind of thing. After doing some searching (the command setenv was not detected). I found that I had to use instead export ...

7 mins ago
1 answer

ModelAndView object not returned to jsp

I am trying to return a simple String "HelloSpring" from controller to jsp. Controller is package it.polito.ai.e4; import javax.servlet.http.HttpServletRequest; import ...

7 mins ago
0 answers

java.lang.IllegalMonitorStateException: object not locked by thread before wait()

But I am synchronizing on the 'roster' object everywhere it gets new'ed. How come ? The offending code: public Roster getRoster() { if (roster == null) { return null; } if ...

1 answer

Java Thread Serialization , why serialized Thread Object can be started

A thread in java can't be restarted in Java, so I implemented a java Thread , and then tried to restart the thread after getting the serialized object of Thread. import java.io.Serializable; public …

8 mins ago
1 answer

How to run reg file in Java Netbeans Code

Please help me to solve : how to run .reg file in java netbeans ? And how to set source file automatically if I open the program in different computer ? I have an reg file like this : ...

9 mins ago
0 answers

Hibernate column nullness default

For a Hibernate table's column definition, if I don't specify not-null or @NotNull, what does the nullability default to? Example: <class name="Person" table="person"> <id name="id" ...

1 answer

What should I use for a Client/Server Multi-player survival game? Java

I am making a game in java and it is going well. I want to early on implement multi-player so I build on it instead of porting the entire game to multi-player when it has a ton of different features.. …

1 answer

Java/Swing: reference a component from another class

I have a Swing-GUI (built with Netbeans GUI-Builder), there is an label which I move around using the arrow-keys. Pressing the space-key another class is called. How can I access the label from this …

10 mins ago
1 answer

Is there epoll equivalent in Java?

Is there an equivalent of Linux epoll in Java? epoll allows a thread to react to a number of heterogenous events. For instance, I can have a thread that reacts to either a socket event or an input …

11 mins ago
0 answers

Does code needs to be compiled at local for remote debugging/ remote debugging modus operandi?

I have java webapplication deployed on remote server. I want to do remote debugging from my local machine from eclipse. Both are of same version. My question does the code needs to be compiled at my …

2 answers

How can I write Ubuntu apps in Java?

I am new to linux. I want to develop apps for Ubuntu desktop and mobile using Java.

3 answers

Converting ISO8601-compliant String to java.util.Date

I am trying to convert an ISO8601 formatted String to a java.util.Date. I found the pattern "yyyy-MM-dd'T'HH:mm:ssZ" to be ISO8601-compliant if used with a Locale (compare sample). However, using the …

13 mins ago
2 answers

writing multiple lines to file in java

I am trying to write timestamps to a file when clicking on a JButton. Once .close() is invoked the data is written to the file and any other writes throw an error. How can I write the data without ...

13 mins ago
1 answer

ColdFusion - java object method call

I'm trying to get a list of datasources off my server (Yes I am the server owner...this is not a hack). Starting here... dbserv = ...

13 mins ago
0 answers

XQJ BaseX API in java shows different result for xquery than the BaseX application

Using the baseX application I constructed a XQuery that returned the result that I need. Using The XQJ BaseX API I implemented this same xquery so I can use these results in my java application. This …

14 mins ago
2 answers

java:netbeans gui buttons not working simultaneously

I have two buttons on my Netbeans GUI form. One button is starting button, and the other is stopping button. When I press the start button, my code runs good, but when I try to stop then the stop ...

16 mins ago
3 answers

How to convert ARGB to RGB array of bytes?

I have a byte array: byte[] blue_color = {-1,0,112,-64}; How to convert into byte array of RGB? And also how can I get the real RGB value of the color?

19 mins ago
0 answers

Loading animated GIF in JLabel weirdness

I'm trying to load an animated gif in a JLabel but while this works: URL urlsd; try { urlsd = new URL("http://pscode.org/media/starzoom-thumb.gif"); ImageIcon imageIcon = new ...

3 answers

Why volatile in java 5+ doesn't synchronize cached copies of variables with main memory?

According to: http://www.ibm.com/developerworks/library/j-jtp03304/ Under the new memory model, when thread A writes to a volatile variable V, and thread B reads from V, any variable values that …

15 30 50 per page
1 2 3