Java is an object-oriented language and runtime environment (JRE). Java programs are compiled to bytecode and run in a virtual machine (JVM).

learn more… | top users | synonyms (5) | java jobs

0
votes
1answer
12 views

Why does this DataOutputStream print gibberish after my name?

everything in the question is in the title. there's a lot of gibberish after "my name" in the output. import java.io.*; public class DOStry { public static void main(String[] args) { String ...
1
vote
4answers
34 views

'While' Loop not executing?

I have a comment in my code to explain what the end result I am going towards is, but please do not answer how I could achieve that goal whilst answering this question. Basically, I have an int ...
0
votes
3answers
37 views

Object Oriented Programming Concepts

Can someone help me to clarify below question. Under what circumstances would you add a method to class but restrict its scope so that it may only be invoked from code in another method in the class?? ...
1
vote
0answers
8 views

Need to change my code to generate correct JSON object

I am trying to generate the following JSON to be accessed by tokenInput, but my code generates it in other way, how can I tailor the code to generate the correct JSON. Required Json ...
0
votes
1answer
16 views

Why isn't my string being displayed in the window?

I am trying to create a simple application that shows a red circle that when clicked displays different messages under it. I believe that this part of the code: g.drawString("DO NOT PRESS", 100, ...
3
votes
1answer
26 views

Algorithm and Data Structure for Checking letters in a word with another set of letters

I have a dictionary of 200,000 words and a set of letters. I need an algorithm to check if all the letters of a word are in that set of letters. It's very slow to check the words one by one. Because ...
0
votes
1answer
13 views

How to wake up waiting SwingWorker?

I have a SwingWorker that is running in the background. After it works on some stuff. It will wait. When the user push a button, the MyListener will be invoked and wake up the worker to continue ...
0
votes
1answer
22 views

what the meaning for the image about the package in java eclipse?

what the meaning for the image about the package in java eclipse?
1
vote
0answers
13 views

Communicating with Xbox 360 controller connected via USB cable to Android device

I am working on an Android project that will connect to an Xbox 360 controller. I want to be able to capture user feedback via the controller's input reports. I am using Virtual Box and AndroidVM ...
0
votes
1answer
7 views

Reading artifacts from a maven repository

I'm kinda new to maven and was wondering if anyone knew how to get all the artifacts from a repo. I was looking into using the aether library but I'm not exactly sure if its possible. Any help would ...
0
votes
2answers
13 views

Java audio playing error

I am java newbie. I was reading a tutorial book, and tried almost all code given as examples, and they all worked perfectly. But, when I tried this audio playing tutorial, even though I understood ...
0
votes
4answers
22 views

Why I cannot add ArrayList directly to Jlist?

i am trying to add ArrayList to Jlist, but the only way that I given to understand is that to write the code like this : ArrayList<String> labels = new ArrayList<String>(); JList jlist = ...
0
votes
0answers
8 views

Android popbackstack() without showing back transition

Ok so I have a basic transition flip animation between two fragments. It looks like this ... fragmentManager .beginTransaction() ...
0
votes
2answers
17 views

Relative Path setting in JAVA

I am trying to access config.xml file from my JAVA program. But its showing me "File Not Found". Here is my project structure. I am using eclipse. So now I want to read "conf/config-file.xml". How ...
0
votes
0answers
10 views

Why does my Producer/Consumer thread algorithm cause audio skipping and jitters?

My algorithm causes skips and jitters... Here are some known facts: 1. audioQ is an ArrayBlockingQueue [1] 2. when I reduce the runtime of encodeSample, this algorithm works (eg in the case of WAV) ...
0
votes
0answers
16 views

How should I use UTF-8 in MySQL?

I have set my MariaDB to Default Character Set UTF-8. According to Blue Box Blog Character Set Hell, setting that will save me the problem from unrecognized accented character like 'é'. However, I ...
0
votes
0answers
5 views

JPA Foreign Keys not working

I'm trying to follow the JPA tutorial and design a set of tables connected by foreign keys. Right now I have two tables: CREATE TABLE Addresses ( id SERIAL PRIMARY KEY, line1 TEXT, line2 TEXT ...
0
votes
5answers
24 views

How to create generic primitive arrays?

This is a following question coming from Two methods for creating generic arrays. With given two methods, @SuppressWarnings("unchecked") static <T> T[] array1(final Class<T> elementType, ...
-2
votes
0answers
13 views

Object populates with null in JSP

I have made something as follows <%list.add(object)%> in one page And, whenever I enter to that page, it populates list with one null. How to avoid this behavior?
0
votes
1answer
15 views

Java: Alternative to Multiple inheritance

I have a class A that has to extend class B and C which are both provided by 3rd party and I don't have a control of them. Since Java doesn't support multiple inheritance. Using interface wouldn't ...
1
vote
1answer
9 views

Currency Converter API not working in Android

I am encountering a problem where my Yahoo Finance API is not working in my code. I am creating a realtime currency converter. I have checked Google but nothing seems to answer my question. When I ...
0
votes
1answer
11 views

How to merge two Hibernate Queries?

I need to merge results from two different queries in order to sort the results by dateCreated. I would like to do: def query = """ select u.user from (select v.user, v.dateCreated from Vote ...
1
vote
1answer
8 views

Java - Apache POI - Trouble filling rows and cells with loops (Excel)

There's a HashMap: HashMap<String, ArrayList<String>> matrix = new HashMap<String, ArrayList<String>>(); I want to fill an excel sheet in this pattern: hashkey1 | hashkey2 ...
0
votes
0answers
4 views

Android/Java - Load tff file from server at runtime

I'd really like to download a font file (tff) from my server and load it at runtime as opposed to prepackaging it with the app. That way if I choose later to update, add, or remove a set of font files ...
0
votes
0answers
18 views

Spring @Async saving searches

I've got a search input field in my Java Spring based website where user can search for content of the website. I want to save the queries entered by users to my MySQL database asynchronously for ...
0
votes
0answers
13 views

Autowiring classes with “prototype” scope

I have following class structure: @Component class ExecutorFactory { @Autowired CommandExecutor commandExecutor; Executor createCommandExecutor(String command) { ...
0
votes
0answers
15 views

Disable Java automatic updates in ubuntu & firefox

I'm building a kiosk appliance that runs on Ubuntu and boots directly into Firefox. I'm using a small Java applet that is custom and doesn't involve external lookups to anything, and everything is ...
0
votes
2answers
46 views

Java Click on a object and output a message

Im currently making a game in my spare time to improve my java but im having trouble with one of the things i want to do. Ive made the game so i can put a item into a certain position. In this example ...
1
vote
2answers
34 views

Flipping three consecutive heads then program exits using RandomGenerator

I'm stuck on a problem that I don't know how to solve. I'm trying to use the RandomGenerator to simulate flipping a coin until the RandomGenerator flips 3 consecutive heads then at which point the ...
0
votes
2answers
22 views

How to reflect that two objects of subclasses never expired?

superclass: public class Card { ... public boolean isExpired() //Card never expires. { return false; } } subclasses: public class IDCard extends Card ...
0
votes
0answers
7 views

LWJGL Cropping issue w/ textures

So, I have been working on a fontrenderer, and my font renders, but it has a big problem. The individual characters seem to have their height distorted? They crop out the bottom 50-75% of the texture, ...
0
votes
1answer
12 views

Have maven add dependency to target jar/lib

Is it possible to have maven create a statically linked jar? I have a specific design pattern I'd like to enforce regarding my JPA entities and the library that depends on them. In my design ...
0
votes
0answers
10 views

what does here_now(String args0) in Pubnub do?

I am trying to find the clients subscribed to a particulair channel. On git I found an example which used a function here_now() with 2 parameters. Something like this: ...
0
votes
1answer
28 views

Parsing error for date field

I want to parse a date in YYYY-MM-DD format to YYYYMMDD. If I use the following function, it returns me a YYYYMMDD format but with a different DD. i.E: 2013-05-16 BECOMES 20130515 Apologies for ...
1
vote
2answers
21 views

Is it possible to determine the CRC of a zip file ?

I am not sure if I got the concept right, but I know that we can verify that the integrity of the files in a zip by getting the CRC values for each entry. However, my question is if I get a zip file, ...
0
votes
1answer
26 views

Refreshing ListView data after setting Preferences double populates

I'm a Java and Android newbie. I'm creating something that requires a listview. The listview data is calculated from GPS coordinates which are set in a preferences window. My problem is that after I ...
0
votes
1answer
19 views

SimpleDateFormat Parses and Compares time incorrectly

When using the following SimpleDateFormat: SimpleDateFormat format = new SimpleDateFormat("hh:mm"); Then I parse then compare 2 values: 12:19 and 11:40 like so: val = ...
0
votes
5answers
31 views

Unique Integers From Array List

I am having problems with making a method that will return distinct integers of the array list. I really want to do it with removing the duplicates and then just display the array list. I cannot ...
0
votes
0answers
8 views

RollingEncryptedFileAppender for logback?

I've searched the documentation located in the logback manual for an appender that will encrypt the log messages to a local file. The SSLServerSocketAppender seems to be exactly what I want except for ...
0
votes
0answers
3 views

Saving child collections with OrmLite on Android with objects created from Jackson

I have a REST service which I'm calling from my app, which pulls in a JSON object as a byte[] that is then turned into a nice nested collection of objects -- all of that bit works fine. What I then ...
0
votes
1answer
22 views

setColor in JFrame does not work

My problem is the following. I have a touch sensor and want to draw with it on the display. It gives me three values: x coordinate, y coordinate and force of the press. My application works so far ...
-1
votes
1answer
16 views

how to mensplit diterdapat on EditText string, so the string is divided into 2 parts?

how to mensplit diterdapat on EditText string, so the string is divided into 2 parts: eg I have the following string: 1234432198w8w9gw98vud8989787fb7d98s9 I want the first 8 string taken, namely: ...
0
votes
2answers
23 views

Tomcat 7 /WEB-INF/ directory mapping

I want to map all requests to a specific servlet but Tomcat won't let me map the /WEB-INF/ directory. My web.xml file. <servlet> <servlet-name>TestServlet</servlet-name> ...
0
votes
1answer
25 views

Game loop using threads and synchronization

I've been muddling through the internet and my own code in an attempt to write a game-loop I'm satisfied with (I'm picky). I implemented DeWitter's loop but decided I didn't like interpolation for ...
0
votes
0answers
49 views

how to remove an action listener?

so im making a chess game but only with the knight. this is the method for moving the knight public void caballo(final int row, final int column) { final JButton current = ...
0
votes
4answers
23 views

Prepend beginning to object name and set text in java

I'm trying to pick up java quickly and looking for a way to set the text of a number of labels in my java app. What I have is a java app that starts\stops\checks status of windows services. I have a ...
0
votes
4answers
46 views

Return sublist of a List of object array

I'm getting result as below after making query to database VendorName | IncidentID | IncidentStatus | IncidentDate ------------------------------------------------------- XYZ | 100 | ...
0
votes
0answers
7 views

Using a ResourceBundle.Control on Google-app-Engine for localization of a Java application

I am trying to take a JSF targetted localization application example, and move it from JBoss to Google App engine - and stumbling... The internationalization example is taken from the final link in ...
0
votes
0answers
9 views

Correct way to handle resources in Spring Jetty and Camel

I've a webapp (Jetty, Spring and Camel). Now I want to connect to a Redis (using Jedis) in my a Camel route. My question where (and when) should I create the Jedis pool and how can I get access to ...
-1
votes
0answers
10 views

how can I print a LBL on zebra printer on android app?

does anybody know or has an Android code to print a LBL file in a Zebra RW420 printer? I need my app to print a LbL file that is sent via Bluetooth. Also I need how to generate the lbl file based on ...

1 2 3 4 5 8738