Newest java Questions

Q&A for professional and enthusiast programmers

The easiest way to display resultset from sql query on GUI in java

I am wondering what is the easiest way to display a resultset from a query in a dialog box using Swing. Right now I have the following code that attempt to create a new dialog box and display the ...

Integrating google analytics in my android game makes it crash before starting

hope you having a good day, a noob here trying to include analytics in his game following the google guide https://developers.google.com/analytics/devguides/collection/android/v4/ i finally managed to ...

controller desn't get executed when I set value of @RequestMapping to “/”

I want map root path of the application to a specific controller. Below is how I did this: My controller: @Controller public class Index { @RequestMapping(value = "/", method = RequestMethod.GET)...

the result of ECB Encryption is maybe different. it is same as the result of CBC

public class Symmetric1 { /** * @param args the command line arguments */ public static void main(String[] args) throws Exception{ // TODO code application logic here ...

I am working on a simple pedometer app, and it has these errors, for the following code

package com.example.ritwik.letswalk; import android.content.Context; import android.hardware.Sensor; import android.hardware.SensorEventListener; import android.hardware.SensorManager; import android....

System cannot Load Native Library mvm.dll

I am working on Calling matlab function in java code by using Java Matlab Engine API in Eclipse. I have written very simple program but its giving me runtime error. I have written this code: import ...

PagerView and adapter exeptions

I get IllegalStateException with adapterView plz help. This is my MainActivity class public class MainActivity extends AppCompatActivity implements NavigationView....

How to sort parent objects in JAVA with respect to their child elements in FIREBASE for android?

This is the Firebase database structure As shown in the above picture I want to sort the list items with respect to the date they were created. Can someone tell me how to do that! I am using Firebase ...

How to change line chart dataset with data from MySQL using MPAndroidChart

This is my first time with Android. I want to ask about a tutorial to create a line chart in Android using MPAndroidChart with date as x-axis and 1-5 scale as y-axis based on my JSON data. this is ...

Convert JSON with JSON prrety print [duplicate]

I want to make this code to show info exactly like that using JSON pretty print and i don't know how to do that: { Reviews: { review 1: "..."} { review 2: "..."} ................ .....

Mapping sub domains in Tomcat

My webapps directory in Tomcat currently looks like this. webapps/ | -CR/ | -HW/ | -SWC/ I have the webapps folder with three subfolder, CR, HW and SWC I want www.mydomain....

unable to write a file [duplicate]

I am trying to create a excel file using the input data of user.I am getting a error here is my code- index.html <!DOCTYPE html> <html> <head> <meta charset="ISO-8859-1"> &...

Finding strings in an ordered list that match a prefix and a suffix using binary search

Given a list of strings ordered alphabetically, I need to count and return the number of strings which start with a given prefix and end with a given suffix. I am constrained to using only String ...

Detect mouse action while clicking on rectangle in swing

I'm new to Java. I'm developing a small 2D game and trying to learn MVC design pattern. I have a Menu Panel with Play button (which is just a rectangle with some text, not JButton). The problem is ...

four connect ai Alpha beta minmax

Hello first of all my English inst very good so excuse me when some things aren't understandable. I wrote a MinMax algorithm for tic-tac-toe and it worked really fine. So I tried myself on a MinMax ...

Instanciate a bean with singleton scope

When the bean below will be instanciated ? <bean id="a" class="Someclass" lazy-init="true" scope="singleton"/> Does Spring ignore the "lazy-init" attribute in this case (because we use ...

arraylist add function not working?

I dont know why my kmeanscluster objects cannot be added properly to my cluster arraylist. Even when i try to print the arraylist of clusters by calling tostring, it shows as if it has added them all ...

How to make a call of this recursive Longest Increasing Subsequence function

I'm learning about recursion. I have taken as an example the algorithm LIS (Longest increasing subsequence) which given an array: 1,2,8,3,6,4,9,5,7,10 Find the longest increasing subsequence that ...

getInputStream() Source code

To get InputStream from HttpURLConnection we code like that urlConnection.getInputStream(); If InputStream is an Abstract class then how getInputStream() method create a InputStream and return it ...

Unable to Start Activity showing have you declared this activity

package com.acer.syncmysql; import android.app.ProgressDialog; import android.content.Intent; import android.os.AsyncTask; import android.os.Bundle; import android.support.v7.app.AppCompatActivity; ...

StAX splitting large items file with shared tags

Using java StAX, starting with big.xml <?xml version="1.0" encoding="UTF-8"?> <items> <attribute>g3</attribute> <multi> <attribute>g1</...

Newly installed Geogebra doesn't open (persumably JDK issue)

Just now installed geogebra on my Ubuntu 16.04 (with plain old sudo apt-get install geogebra) when I try to open it I get: GeoGebra 4.0.34.0 (Debian version 4.0.34.0+dfsg1-3) 22 June 2012 Java 9-...

Coding using Greedy Algorithm

We are searching for a product in a store and we select the location from the list box. If the product is not available in that store and we want to find the nearest location from the given current ...

Travelling salesman (TSP) getting the actual path

I wonder if there is a way to get the path (not only the distance) chosen by brute force algorithm (TSP)in my solution like i get only the distance. Notice that I started from City Stockholm and ...

java howto convert comma and slash string to array

I have the following string: str = /data/media/file1.txt,/data/media/file2.jpg,/data/media/file3.jpg I want to have array with file names. I tried all kind of splits. it didn't work. please help :)

How to print out all methods called during runtime in Java?

I want to print out all methods that get called during runtime. They should be printed out in the order that they're called in and if they're called multiple times, they should be printed multiple ...

Android Barcode Scanner displaying special characters

I'm working on an android app which has barcode scanning functionality. At times when a barcode is scanned, special characters are displayed within the barcode e.g. 012JPDK19L15%H What could possibly ...

How to store radibutton values in sql using onClickListener with attaching button to it?

What method I have to use for two radio buttons as strings(eg: gender). String --the error "string declaration is not allowed here" if(radioButton1.isSeleceted()) String temp = radioButton1....

How to insert element in between elements in wffweb

I'm new to wffweb (webfirmframework). I'm using wffweb-2.1.5 to generate ui. I want to insert a tag in between two tags. There is a method to append child but it appends the child to the last position....

single pixel value combined of RGB value for feature detection

my project is basically based on feature detection(land, water etc) in the satellite image. I have already got individual RGB value of a pixel by applying red = (rgb >> 16) & 0xFF; green = (...

Retrieving and Displaying data from Firebase

I'm currently learning about Java and Firebase. I've been trying to retrieve data from Firebase. I read through many docs and examples from Firebase and other solutions posted on stackoverflow but ...

Cannot write into a file in java as it is printing using System.out.println

File output=new File("C:\\\\MDU-1617-CSJ0098\\\\web\\\\products.txt"); BufferedWriter writer1 = new BufferedWriter(new FileWriter(output)); while(q_set2.next()) ...

Synchronizing Async' actions (Java/android)

I have a JavaScriptInterface that I'm using to catch AJAX calls, then handle them in my native functions inside the activity and the back a certain response that I get asynchronously. I MUST wait for ...

Criteria API is not generating left outer join

I have 3 entities, infact many more joined together for brevity i'm skipping those and i'm using open jpa 2.2.2 and oracle 11g. Any thoughts what's going wrong here? Entity SystemRules{ @OneToMany(...

Database - have 2 Tables and need another one which has both IDs and another field

i use spring and hibernate. Ok so in my programm i have articles and stores (entities), which are stored in a myql database. i now need a way to store the amount of articles in each store in the ...

Spring Hibernate: Values not inserting into database

I can't seem to add values to my table. There is no error but the values aren't inserting in my database. After submitting the form, no errors would show up. Upon looking at the console, this shows: ...

Transaction is not rolled back in JOOQ

I have a code that is very similar to this one: dslContext.transaction(new TransactionalRunnable() { @Override public void run(Configuration arg0) throws Exception { dao1.insert(...

Difference between a void result and a specific result

i got a little problem. The following code inserts a given element in a sorted LinkedList. If i run this method as a void-method, the result is wrong. For example the list before is 1,2,3. If i start ...

Multiple button for multiple java class

I'm currently making a app on Android Studio. I have a layout that contain multiple button and I create a java class for each button because I want each button to open a another layout and I used ...

Popup Notification-Java [on hold]

i am working on a project called library management system using java Swing.i want to show the notification message on the bottom corner of the desktop screen whenever the system start. Thank You.

How to implement add method from List interface

I want to implement the add method for my Customlist which implements List in java. The code looks like this: public class CustomList implements List{ private List list; public boolean add(...

How To Decrypt PGP Encrypted File (Encrypted by two PGP keys. Key1 having public, private key. Key2 having only in public key) Through JAVA API

Dears, I have two PGP keys my PGP desktop. Key1 - Created in my PGP desktop. which contains both public and private key Key2 - Created by my client and shared with us only public key. I added key2 ...

What is the best way to parse SOAP response in Java

I call a soap api using saaj and store the response in a file. Here is part of response: <?xml version="1.0" encoding="UTF-8"?> <soap:Envelope xmlns:soap="http://schemas.xmlsoap.org/soap/...

how to send message to kafka topic protected with SSL

Can anyone please suggest which properties we need to set to send message to SSL protected kafka topic using java KafkaProducer ,am new to kafka , not able to send one message to kafka protected with ...

[sqlite MISMATCH]: data type mismatch

i'm getting an sqlite mismatch exception while inserting data into database.i m creating an app in netbeans but when i try to update database by selecting textfields by clicking button its showing ...

Java - Input in same line

I have problem with my java program, i running program with console (CMD). i want, if i finish input and then press enter on keyboard, in the console is not chance rows, but the next input in same ...

BluetoothSocket Connect() throws IOException read failed, socket might closed

So I'm trying to connect an Android app to a raspberry Pi, the devices are paired and are trusted by I receive an error identical to the one found here: IOException: read failed, socket might closed - ...

JSF inputText inside foreach doesn't work

I study JSF and can't set a value in my bean from <h:inputText> inside <c:foreach> Here is my code. JSF page: <c:forEach items="#{commentController.getComments(request.getParameter('...

JTable setSelectionMode not working

Using JTable in Java, first I set the selection mode to single table.setSelectionMode(ListSelectionModel.SINGLE_SELECTION); and it worked. Later I need to change the selection mode to multiple ...

marker error on null object reference [duplicate]

i cannot figure out the error please help. i want to add marker whenever location coordinate arrives from the FCM. i get the marker set on the position but also this error. The error is attepmt to ...
Translating... 0%