Tagged Questions
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. ...
0
votes
0answers
3 views
Android: Hide DatePicker header (selected day, month and year)
I was trying to create a CalendarView in Lollipop when I ran it I didn't get the same design as Marshmallow so I changed to DatePicker but I don't want the header part just the Calendar. Is that ...
-2
votes
0answers
9 views
partially filled arrays program terminates early runtime
Trying to make a program that uses a partially filled array. The part of code I left out just deals with getting user input for the array size and getting them to enter a value to be placed in the ...
-4
votes
0answers
7 views
How to determine if a page contains a news article
i wrote a simple web crawler in java to use on popular news websites.I use boilerpipe library to extract articles from pages with moderate success.But i can't reliable determine which pages contain ...
0
votes
0answers
11 views
Write File from .Jar
I have some code to do a bunch of manipulations on some excel files with Apache-POI and save the resultant files into two new excel files. I wanted to compile these into a jar so that my boss could ...
0
votes
1answer
10 views
Java Replace Unicode Characters in a String
I have a string which contains multiple unicode characters. I want to identify all these unicode characters, ex: \ uF06C, and replace it with a back slash and four hexa digits without "u" in it.
...
1
vote
0answers
10 views
Creating object from class located inside JAR?
Creating object from class located inside JAR?
I’m currently attempting to create a system for managing .jar plugins from inside another Java project. The idea is that it should be able to create an ...
-1
votes
0answers
14 views
Can't figure out what is wrong wi th my merge sort code
I went over it multiple times and I am not sure what I am doing wrong. The logic seems ok but it is printing out the first number only. I left out the main method. Thank you.
public class MergeSort {
...
0
votes
0answers
7 views
Java animation: two rotating objects [duplicate]
i have a little problem with my program in Java. I want to display animation of rolling circle, and that circle has a stick on the edge. I want to rotate this stick around point of contact and i dont ...
-1
votes
0answers
8 views
How does one Convert a List to Map with Java-8 Streams where Key is the ListValue and the Value is the amount of values of that specific list
This is my list:
List<Card> cards;
my Java-8 stream where i want to create the Map
Map<String, Integer> cardsMap = cards.stream().collect(Collectors.groupingBy(Card::getCardValue, ...
0
votes
0answers
10 views
Installing Ant for Java on Linux
Trying to Install ant to package Cordova applications but I'm getting the following error upon executing the command 'ant':
/home/meronomy/java/jdk1.8.0_11/jre/bin/java: 1: /home/meronomy/java/jdk1.8....
0
votes
0answers
3 views
android studio list item is not visible in fragment
i am a beginner in app development. i am creating a music app. here is the code of my songs list. when i am running my app only music artworks are coming. other things like album name, duration is not ...
0
votes
0answers
6 views
regex for google search result not work in android
I try to scrape google search result with this code
Pattern p = Pattern.compile("<h3.*?><a.*?href=\"(.*?)\".*?</h3>");
Matcher m = p.matcher(html);
in android studio its ...
-1
votes
0answers
5 views
InputMismatchException for guess number
I am doing a guessing game where in I can input 1-100 but I am having a trouble in only accepting numbers if I typed a letter when I first run the program it will give me error and execute the program ...
0
votes
0answers
5 views
JPA- Compound Primary Key using @EmbededId
Goal: To impolement an @Entity where the id is a compound primary key using @EmbededId.
Problem: Based on my current implementation, I am getting the following result:
[
{
"id": 1,
"name": ...
0
votes
3answers
16 views
Get keys and values from Multimap
I want to print all the keys and all the attributes of an object from a multiMap.
The same key can have different objects.
I have created the multiMap with the following code:
Multimap<Integer,...
0
votes
0answers
15 views
difference between lock/unlock vs wait/notify in the OS
Title says it all, using a ReentrantLock, whats the difference between the lock unlock and using the condition with wait notify?
I know wait/notify is used with a condition, and inside a loop, is ...
0
votes
0answers
8 views
Unexpected character error when using multiple Json inputs in Dataweave
I have a Json payload and Json flowVars. I am populating the Products array in the Stores Json payload with a Products Json flowVar but I'm seeing the following error:
INFO 2017-01-15 23:06:32,559 [...
0
votes
0answers
20 views
Is it possible to create an array of Label[] without setting the initial array size Label[22] [duplicate]
Is it possible to create an array of Label[] without setting the initial array size Label[22]?
Label[] l = new Label[22];
for (int i = 0; i < 10; i++) {
l[i] = new Label(String.valueOf(i));
...
0
votes
0answers
10 views
android.view.InflateException: Binary XML file line #40: Binary XML file line #21: Error inflating class android.widget.ListView
I had previously had the following code working but after disabling it to perform some work on the Bluetooth Pairings, for some reason now it crashes.
Main Activity:
@Override
public void onCreate(...
0
votes
1answer
9 views
Edge Detection Algorithm with Processing (Java)
i want to code an algorithm, that can do an edge detection for an image.
I already have a part of the code, which detects all edges in horizontal way.
Example picture:
But i need an edge detection in ...
0
votes
0answers
9 views
Spring boot web app not working on Tomcat - 404 error
Note: There are similar questions to this one but none of the solutions work for me. I've spent a few days trying to get this to work.
I've deployed a WAR file to Tomcat and the "Tomcat Web ...
-1
votes
0answers
10 views
How to stop components from producing a sound when they gain focus?
I've tried looking for a solution to this but the only questions which come up are how to set a sound on a button click, or on changing radio buttons, etc. I'm using Eclipse to produce a Java applet ...
0
votes
0answers
17 views
Struggling with Ajax Post Image
I've been really struggling posting image data to a Java server. I get 400 (Bad request every time).
Some things I've tried
var imgData = renderer.domElement.toDataURL();
var canvas = document....
0
votes
0answers
9 views
Creating multiple aliases for the same QueryDSL path in Spring Data
I have a generic Spring Data repository interface that extends QuerydslBinderCustomizer, allowing me to customize the query execution. I am trying to extend the basic equality testing built into the ...
-4
votes
0answers
27 views
Identifying duplicates in a deck of cards [on hold]
First of all, this is my first time using Eclipse so I am not really too sure as to what I'm doing. However, I have a task that is due very soon regarding a random deck of cards. I have managed most ...
0
votes
0answers
16 views
Pythagoras tree in Java: How do I calculate the third point of the triangle?
Dear more advanced programmers,
I have to programm a Pythagoras tree (see: https://en.wikipedia.org/wiki/Pythagoras_tree_(fractal) ) and I want to take a step forward, but I just can't.
I want to ...
-1
votes
1answer
23 views
How to find all implementations of a Java interface, without instantiating them all
I created a set of interfaces for different "data points" in my app. I want to be able to add or remove "data points" in a fairly modular way, and only load the ones that a user needs. Currently I ...
0
votes
5answers
41 views
Football Team: Objects and Classes
Before I post my question, I just need guidance on how to improve my java program, because I want to learn.
So, for my assignment I need to:
Create 3 classes, app, football player and football team....
-2
votes
0answers
33 views
Java Program to output the contents of a file within a range of numbers
So basically, my problem is, I have a text file with 5000 values in it. I am supposed to figure out how to display only the values within the range (there's no set range, but I've chosen between 1000 ...
0
votes
0answers
7 views
Exceute JUnit tests inside Docker container
I would like to build a test environment with Docker, where I can remotely send JUnit test classes (including the code that is tested), execute the tests and retrieve the results.
I found some ...
0
votes
0answers
7 views
JDBC mysql driver configuration in IntelliJ
I'm creating a web app using Servlets and Tomcat in IntelliJ. I want to connect my application to mysql database with JDBC. I downloaded mysql workbench, connected to it, and created a database.
Now, ...
2
votes
0answers
9 views
Is it possible to use JSCover or any other tool to get JavaScript code coverage running Java Selenium WebDriver tests in Browser?
Is there a way to run Selenium WebDriver tests in a browser (or just run a test scenario manually in a browser), and get the code coverage of the web-app written in JavaScript? Are there any other ...
-2
votes
0answers
19 views
Why 2 different outputs in removal of textview append method
I have 2 different outputs, 1 is correct and the other is incorrect, i want to understand why's the code work right when i add those lines, so if any of you have past experience using append method, ...
0
votes
3answers
20 views
Replacing width and height in url
What's the simplest way of changing the w= number and h= number?
Example of url:
https://test.com/photos/226109/test-photo-226109.jpeg?w=1260&h=750&auto=compress&cs=tinysrgb&fit=crop
...
0
votes
0answers
8 views
Changing the Android generated Stub files
I'm trying to change the generated stub files in my
Android project. I looked for example at the link: How are .java files in android_stubs_current_intermediates directory generated?
I couldn't find ...
0
votes
0answers
7 views
HTTP POST request in Android using Retrofit 2
I'm trying to send String to the server, but I'm having problems with it.
This is my method.
public void intervalPost(View view) {
try {
Retrofit retrofit = new Retrofit.Builder()
...
2
votes
1answer
42 views
Implementation of isEmpty()
I'm trying to figure some basic things out. I was exploring standard library ArrayList.java when found that ArrayList has implementation of method isEmpty().
ArrayList.java:
public boolean isEmpty() ...
0
votes
1answer
31 views
Create binary tree from a list in java
I'm trying to make a binary tree based on a list. The list contains on index 0 the node, and on the index 1 and 2, the left and right child. On index 3 is another node and on index 4 and 5 is left and ...
0
votes
1answer
14 views
POJO class from JSON for Retrofit2 Callback
{
"success":true,
"userobject":{
"username":"user",
"email":"[email protected]",
"password":"user123"
}
}
This is my JSON. I want to create POJO class from this. Now i ...
-4
votes
2answers
32 views
ArrayIndexOutOfBoundsException: 5 [duplicate]
What is wrong with this?
public class engine2 {
public static void main(String args[]){
int[] leftval={1,4,5,7,8};
int[] rightval={5,7,2,7,9};
char[] opcode={'a','s','m','d','l'};
...
0
votes
1answer
14 views
How to search in Java inside a JSON object for specific key during JSON parsing
I am parsing the following JSON file http://pastebin.com/Mb5E6Ewf using json-simple library in the Java class with name JacksonStreamExample.
In this JSON file I have a JSON object and inside it an ...
1
vote
1answer
9 views
Andoid compile loop after added .jar files which use java 8
I need to use same nlp libraries in my android application. In particular these libraries need java 8. I added the .jar files in android project,
added
android {
compileSdkVersion 25
...
0
votes
0answers
12 views
opencv 3 - java get stream from camera and display it in gui
I'm trying to get a stream from the camera. and display it inside gui windows (jpanel for example) but I have no idea how to do this in java..
I want to do something like this example but in java (...
0
votes
0answers
6 views
Add Jsch 0.1.54 jar dependency to IntelliJ artifacts
I am attempting to add Jsch 0.1.54 as a dependency to my Java project in IntelliJ however when I build my jar artifact and run the application via the command line I am encountering an exception:
...
-1
votes
0answers
11 views
Strange behaviour on Java MP3 player
I've been working on some sort of MP3 player in Java, it reads the files from some folders, extracts some information like titles and duration of the songs and stuff. I suppose this is nothing new to ...
1
vote
2answers
19 views
How to convert checkerboard coordinates to the corresponding row and column number in Java?
This is my first time working with java so please bear with me. So imagine an 26x26 checkerboard (or chessboard). I need to know how to properly convert a checkerboard's coordinates to the ...
0
votes
0answers
9 views
generate type List String with lombok
this code
JCExpression valueVarType genTypeRef(fieldNode, "String");
I will create a JExpression have List <String> :
JCExpression valueVarType genTypeRef(fieldNode, "List<String>")...
-1
votes
1answer
23 views
Java project with image files
I am working on a project in which I use image files. Where is the proper location to store the folder with the images? Inside src folder (created by netbeans) or outside? Also when I clean and build ...
-8
votes
0answers
31 views
Google foobar bringing a gun to a guard fight [on hold]
I have a google foo bar challenge that I am trying to solve.
Bringing a Gun to a Guard Fight
Uh-oh - you've been cornered by one of Commander Lambdas elite guards! Fortunately, you grabbed a beam ...
-1
votes
1answer
23 views
IntelliJ IDEA running the wrong class
Apologies for my stupidity if this question has an obvious solution, but I just can't figure out how to make my IntelliJ to run the class I want. I've looked at another post on Eclipse running wrong ...