Java (not to be confused with JavaScript or JScript) is a general-purpose object-oriented programming language designed to be used in conjunction with the Java Virtual Machine (JVM). "Java platform" is the name for a computing system that has installed tools for developing and running Java programs. ...

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

0
votes
0answers
2 views

Encapsulating alarm creation code in a different class than the Activity

I'm creating my first Android Notifications app, so I'm very much a beginner. I have a class, Notification.java, that asks the user for the time and date. Using these data, it creates an alarm that is ...
0
votes
0answers
2 views

Setting Hadoop number of mapper with input split not working

I am trying to run a hadoop job multiple times with different number of mapper and reducer. I have set the configuration : mapreduce.input.fileinputformat.split.maxsize mapreduce.input....
0
votes
0answers
7 views

Java Thread Output data to Collection getting wrong results

I wrote a small program for testing java's Thread. The problem is that I cannot get results as I predicted: 100 records every time. I got random number of records. and after I remove the comment of ...
0
votes
0answers
4 views

Built a jar file with sounds and images in intelliJ

As the title suggests, I'm trying to make a .jar of an intelliJ project. I'm currently loading multiple images and sounds using: For images: BufferedImage img = ImageIO.read(new File("images/"+...
-1
votes
1answer
16 views

IndexOutOfBoundsException while loop executes-Java

package com.cp.javapractice; import java.util.ArrayList; import java.util.Scanner; public class Cp { public static void main(String args[]) { ArrayList al = new ArrayList(); Scanner s = new ...
0
votes
1answer
20 views

how to return object of different type from method in java?

i want to ask you how a single method can return different types of objects in java? lets say we have a class "a". class a is parent class of classes "b" and "c". lets say we have an array list ...
0
votes
0answers
6 views

org.springframework.beans.factory.UnsatisfiedDependencyException , java.lang.Error: Unresolved compilation problems

Can anyone tell me, why this error is happening ? Actually I can't understand where to start resolve it. Nov 19, 2016 10:20:30 AM org.apache.catalina.core.StandardContext listenerStart SEVERE: ...
-1
votes
0answers
4 views

Need a tool for Hibernate implementing models and crud operations from database schema?

In my project their are many Tables which needs crud operations in Hibernate, so is their any framework or library which can be used to reverse this process of creating model beans and implementing ...
0
votes
0answers
6 views

What is root node in javafx scene object?

I try to create a scene object to apply css style on it's component, but looks like l am in trouble creating an object of scene. The compiler says: root cannot be null. Any tip please? This is my ...
-2
votes
0answers
6 views

How to generate a database table to sql and model class file using perl software? please tell me how to generate?

How to generate a database table to java sql and model class file using perl software? please tell me how to generate?
0
votes
0answers
13 views

Password hiding in shell script for mainframe ingestion

I am ingesting the mainframe file into hive external table. I am able to do so but in the following command using CobolSerde.jar and FTPtoHDFS class "hadoop jar CobolSerde.jar com/savy3/util/FTPtoHDFS ...
-3
votes
0answers
9 views

I am getting this error when i tried to create web service

IWAB0489E Error when deploying Web service to Axis runtime axis-admin failed with {http://xml.apache.org/axis/}HTTP (404)404
1
vote
0answers
13 views

Hibernate make right database query but return null entity

I'm working in a Vaadin java project with spring and hibernate. I have the next Entity in my project: import java.io.Serializable; import java.util.HashSet; import java.util.Set; import javax....
1
vote
1answer
19 views

Wrong On Click called for list of items using recycler view adapter?

I have an activity with three fragments, each one with a separate RecyclerView with a bunch of items. When scrolling between fragments, the onClick() gets mixed up and click on an item in fragment 1 ...
0
votes
0answers
5 views

Selenium Webdriver / JUnit how to find an element that isn't there when the page loads but get's added by a script after a button is clicked?

Selenium Webdriver / JUnit how to find an element that isn't there when the page loads but get's added by a script after a button is clicked? The page's source looks like this: <html> <...
0
votes
0answers
24 views

Finding nearest non-coprime number

Given an array, I need to find the indices of nearest non-coprime number (i.e. GCD(Ai, Aj) > 1 , for any Ai and Aj in the array, i != j ) Example, let the array be [2 17 4 6 10] The answer will be ...
-2
votes
0answers
28 views

java recursion indexofBounds

When I run my code it is giving me an error of Exception in thread "main" java.lang.StackOverflowError How do i fix it? public enum Coins { TOONIES(2, 0), LOONIES(1, 1), QUARTERS(0.25, 2), DIMES(...
-3
votes
0answers
22 views

How to add timer in offline java quiz application code?

I am working on an offline console based quiz application in Java, and I want a timer of 30 seconds for each question. In order to answer a question, the user has 4 choices, 1 to 4, and the user can ...
1
vote
1answer
24 views

JAVA Button Alignment

First, this is homework, I'm not looking for the complete answer but I am hoping to get an idea of how to do what is needed. I am trying to align buttons in a JFrame to appear as such: What GUI ...
0
votes
0answers
14 views

SystemUI force stopped

What's the problem,my systemui forced stop every time..my Catlog 11-16 22:00:22.537 E/AndroidRuntime(566): java.lang.RuntimeException: Error receiving broadcast Intent { act=android.intent.action....
-3
votes
2answers
32 views

Declaring custom exception in Java

when I try to catch this exception it gives me a compilation error message that says, "exception LinkedListException is never thrown in body of corresponding try statement". What does this mean? try {...
-3
votes
0answers
14 views

Distribute load between nodes

I have standalone spring application it will scan and read continuously XML files from a folder.This application deployed in JBoss Cluster step up with 4 nodes .The problem here is all four nodes ...
-4
votes
1answer
38 views

Peculiar for loop - for(;;){} - in Java [duplicate]

Hi Stackoverflow Community I came across the following for loop in the following Java documentation (Lock Objects) earlier today and was wondering whether anyone would be able to elaborate what the ";...
-1
votes
0answers
19 views

Java Simple Class to Return a Reversed Singly Linked List

I am trying to write a simple class that reverse a singly linked list and return a constructed linked list. The code below is working if i make everything public which I dont want to. Anybody ...
-2
votes
0answers
28 views

JavaVM Failed to load

I'm trying to load the "openNLP" library in RStudio and I'm getting the following error. I get a similar error when I try to install the "RWeka" package. How do I troubleshoot this? library(openNLP) ...
-3
votes
0answers
37 views

java.lang.NullPointerException for retrieve the Json data from URL [duplicate]

i had write a program to read the JSON data from the URL which will be something like this http://10.x.x.x:7000/anything/ID. If i copy the URL directly paste in my broswer, the JSON data will show up ...
-7
votes
0answers
27 views

Finding the most isolated post code

So I have a list of Postcode objects which have the postcode saved as a String, Lat and Lon stored as Double. I also have a method that will return the distance between two postcodes with (lat1, lon1, ...
2
votes
1answer
20 views

Parse and execute HTML in Android

I need to parse HTML elements from a webpage in Java, fill out a form and submit it to simulate a login. I've been doing a little bit of research and here's what I did using the jsoup library. ...
-1
votes
0answers
28 views

Why this throws an NullPointerException [duplicate]

Integer v = -1; Integer x; x = v == null ? 1 : null; x = v == -1 ? null : (v + 1); x = (v == null) ? 1 : (v == -1 ? null : (v + 1)); The 5th. line throws an NullPointerException.
0
votes
0answers
9 views

Why the original window loses its focus in Mac, despite of using method setFocusableWindowState(false) in java?

I've some trouble in using this setFocusableWindowState(false) method in java: JFrame frame = new JFrame(); frame.setFocusableWindowState(false); frame.setVisibled(true); Even in Windows OS, it ...
6
votes
4answers
59 views

Replacing characters in a string, Java

I have a string like s = "abc.def..ghi". I would like to replace the single'.' with two '.'s. However, s.replace(".", "..") yields "abc..def....ghi". How can I get the correct behaviour? The output I'...
0
votes
1answer
19 views

How to change only month, year and date in Calendar object without changing the hours, mins and seconds?

I want to set now to have the current time fields (hours, minutes and seconds) but I want to set the year to 1970 January 1st. The code below doesnt do that using the set(int year, int month, int date)...
0
votes
0answers
6 views

Adding Mobfox banner ad code in activity

I'm trying to add mobfox ads to a simple webview app and I followed their guide. But I'm unable to figure it out, especially the MainActivity.java part. Getting different errors like class,interface ...
2
votes
2answers
62 views

Trouble with 'if statements' inside other 'if statements'

if(clicked == button) { button.setIcon(image1); if(clicked == button2) { button2.setIcon(image2) button1.setIcon(image0) } } Basically what I want the code to do, is upon ...
-6
votes
1answer
18 views

card game, hashamp? enum?

I'm making a card game where each card has a number of attributes such as Strength, Intelligence and each attribute has a value betweeen 0-9 (to compare cards to see which is better, when a player ...
-1
votes
0answers
11 views

How can I use the “TextRecognizer” to recognize text in one frame?

I am looking to write a simple OCR app in Google's Mobile Vision. When looking at their codelab they only demonstrated how to use the TextRecongizer for live images. I was wondering if there was a ...
-2
votes
1answer
33 views

When passing an object as parameter, is more memory used?

For an example, I will use libgdx (game engine) but this is a question about how java works that i didn't find. This is the soundControler class: private final Sound s_0 = Gdx.audio.newSound(Gdx....
-4
votes
2answers
17 views

removing elements of an arraylist and placing them in new array

I'm trying to remove a number of elements from my arraylist and add those elements to a new array and this is what I have so far public Card[] deal(int numCards) { int k=0; for (int atPos=...
2
votes
0answers
25 views

Why is the id null in the entity after saveandflush but not null in the database?

I use the latest Spring-boot with data-jpa and Hibernate. The database used is Oracle 11G. I've been searching a solution for a couple of days but nothing worked. I struggle to retrieve the id of an ...
0
votes
0answers
9 views

Unmarshalling ObservableList of Enums with JAXB

I'm working on a custom questionnaire in JavaFX that accepts multiple answers for some questions, which I store in ObservableLists, and one answer for others. The possible answers for each question ...
0
votes
0answers
8 views

Jersey resource structure

I want to use sub-resources to enable better grouping but one of my resources is a sub-resource of two different resources. For example if I have a parent like so parents/1 and i also have children at ...
-4
votes
0answers
27 views

WHY is Java Comparable an interface? [duplicate]

I understand that an interface has method declarations that have no implementation. For this reason I don't understand the Comparable interface in the Java standard library. It seems like it has ...
-5
votes
0answers
31 views

how to fix error: main java.lang.NumberFormatException: Invalid int: “@2131427330”

I got an error like this: java.lang.NumberFormatException: Invalid int: "@2131427330". This is CardContainersFragment: public class CardContainerFragment extends Fragment { private ...
0
votes
0answers
16 views

BufferedImage loses alpha when passed as a parameter

I'm having a problem where images loaded in as a buffered image contain their alpha channels correctly. But when passed as a parameter the alpha channel is lost. I load the images in like this: ...
-1
votes
2answers
26 views

Database for Junit Testing

I am coding crud APIs for my application built on Hibernate/SQL. I am using mysql for both testing and live environment. For testing, I have a database, user and privileges. So every time to test, I ...
2
votes
0answers
11 views

Android: onCreate not running in a FragmentActivity when its corresponding XML is inflated?

New to Android development, and am trying to run an instance of the Google Maps activity inside a tab. I currently have this set up via a ViewPager/TabLayout, using a custom Fragment pager class that ...
0
votes
0answers
4 views

OpenCV getPerspectiveTransform and warpPerspective Java

I current have a ArrayList<MatOfPoint> which stores the contours of the image and have retrieved the largest contour which is my target for the warpPerspective. List<MatOfPoint> contours =...
0
votes
0answers
10 views

javax.management.InstanceNotFoundException on registering object

I am new Java World and specially to JMX. i am working on a program which uses JMX for monitoring the object. When I make a request to the URL it goes through but I also get InstanceNotFoundException. ...
1
vote
2answers
27 views

Networking in Java, 'readLine()' on multiple lines of response in client

I'm currently writing a mail client that simply opens a connection to a mail server and receives the responses from it. However, when I receive the response from the server, it only works when the ...
2
votes
3answers
31 views

Java RegEx split method

I am looking to split the string "PICK TWO IN ORDER: 10 2 T F" into the following 5 sections. Str[0] = "PICK TWO IN ORDER" Str[1] = 10 Str[2] = 2 Str[3] = T Str[4] = F I can get the string to split ...