Questions tagged [java]
Java is a high-level object oriented programming language. Use this tag when you're having problems using or understanding the language itself. This tag is frequently used alongside other tags for libraries and/or frameworks used by Java developers.
1,846,980
questions
0
votes
0
answers
2
views
Attempt to invoke virtual method 'org.jsoup.select.Elements org.jsoup.nodes.Element.getElementsByTag(java.lang.String)' on a null object reference
[but I am getting null pointer exception error][1]
My error in line protected class GetDataCountry extends AsyncTask<Void, Void, String> and my error in line List list=context.getElementsByTag(&...
0
votes
0
answers
8
views
Issue in updating table
I am receiving below error in my program because of which my table is not getting updated. can anyone help me with it :-
log4j:WARN No appenders could be found for logger (org.apache.axis2.description....
0
votes
0
answers
9
views
Not able to run the perl script in java
package checkpl;
public class runpl {
public static void main(String args[]) {
Process process;
try
{
process = Runtime.getRuntime().exec("perl C:\\...
0
votes
0
answers
5
views
Unable to find column with logical name JPA in springboot
There are two tables. Address inside Hotel. I have already mentioned OneToMany relation. But Compiler throwing error.
Error creating bean with name 'entityManagerFactory' defined in class path ...
0
votes
0
answers
9
views
How to store BigDecimal type data in Elastic Search and sort by that value
How do I store BigDecimal type data in Elastic Search and sort by that value
0
votes
1
answer
20
views
How to insert long datatype in Priority Queue Java
I want to store all long type integer to a priority queue, and I want to intialize the queue something like this
PriorityQueue<long> pQueue = new PriorityQueue<>();
Is there an ...
-1
votes
0
answers
19
views
Convert the for loop inverted half pyramid to while loop in java
How do I convert the for loop inverted half pyramid to while loop? Is it possible to convert in while loop? I need answers please I'm just a beginner eager to learn.
int i = 5;
while(i >= 1) ...
0
votes
0
answers
6
views
Add dynamic footer in MS word using apache poi - Java
Could someone please explain how to insert dynamic footer in each page using Apache poi API - e.g. timestamp & Page Number
-1
votes
1
answer
19
views
Im looking to ask for user input, but instead, my code returns me back to the beginning without giving the chance to enter input
so, i am looking to write code which firstly asks for user input in order to run the desired operation, this element of my code is working fine, but after selecting one of the options from the first ...
-1
votes
0
answers
10
views
Trying to read int through buffered reader results in number format exception but if I uncomment the comments in sout it runs?
I’m trying to use buffered reader if I try to run this program it results in noformatException but if I uncomment the print statements and run it runs fine ?
import java.io.IOException;
import java.io....
0
votes
0
answers
4
views
get all the responses from the flux
I am trying to get all the responses from flux but sometimes I'm getting all the response and sometimes I'm not getting only few responses. Can anyone please help me on this. I have attached the ...
0
votes
1
answer
7
views
Retrieve deleted package from eclipse
I have deleted a package from my Java code in eclipse and now I need it back. I am not able to find it when I click on "restore from local history". Is there any other way to retrieve it?
-4
votes
0
answers
21
views
script to image encode and decode base64 in java [closed]
Function for Decode Image String Base64 to Image:
public static void decodeImage(String txtPath, String savePath) throws Exception {
FileInputStream inputStream = new FileInputStream(txtPath);
...
0
votes
0
answers
8
views
Gradle Resolutionstrategy in Dependency
Suppose there are 3 projects A, B and C.
B
--C:1.0
--D
-----C:1.2
Now B has direct and transitive dependency on C and there is a version conflict, suppose C:1.0 and C 1.2. And C:1.2 has some problem, ...
0
votes
0
answers
5
views
Some JSP pages not found when running tomcat app in windows services
Have you experienced this scenario before:
I put the war file in webapps then run startup.bat to explode the war file.
I tried running the app and it is working fine. Then, I installed the tomcat app ...
0
votes
0
answers
5
views
Use the same ObjectMapper/JsonSerializer for writing to file as used by Jersey for Responses
I'm using both JSON and XML Serialization in Jersey
ApplicationConfig.java
register(JacksonFeature.class);
Resource classes
@Produces({MediaType.APPLICATION_JSON, MediaType.APPLICATION_XML})
Now for ...
-2
votes
0
answers
12
views
longest prefix String in an Array
why showing out of bond index(if(strs[j].charAt(i)!=c)
)?
char c=strs[0].charAt(i);
for(int j=1;j<strs.length;j++){
if(strs[j].charAt(i)!=c)
...
0
votes
0
answers
6
views
Querydsl Contains Column value in a String
Generally we can use QObject.column.in(String[]) to find rows that specific column value in a string list. But how can we filter if column value exists in a large string?
Something like QObject....
0
votes
0
answers
6
views
Hide rows of datatable based on condition in JSF2
I'm using MyFaces <h:datatable> in JSF2 and I would like to hide rows based on condition like below.
But it seems that my condition doesn't work.
<h:dataTable value="#{myController....
-1
votes
1
answer
12
views
cannot be resolved or is not a field, and No enclosing instance of type CarDemo is accessible
I was following our teachers instructions but even still the program runs into a problem where it says that both CONVERTABLE and BLACK cannot be resolved or is not a field.
public class CarDemo {
...
0
votes
1
answer
14
views
How to reset a countdown timer when the same button is pressed
So I'm making this game which gives the player 30 seconds to choose an answer. If they choose an option, the timer resets back to the 30 seconds.
@Override
public void actionPerformed(ActionEvent e) {
...
0
votes
0
answers
7
views
what is the designed purpose of serializable interface in java ? why wouldn't kafka mandate every entity to implement serializable? [duplicate]
I know this might be quite old question, but I am confused.
So far as I know, with the Reflection API, we can serialize instances, then why does java need an empty interface like Serializable ? I read ...
0
votes
0
answers
6
views
KoI can't using Hyperloglog in Spark java
I try using Hyperloglog function but it's not working
I added dependendcy to file pom.xml
<!-- https://mvnrepository.com/artifact/org.apache.spark/spark-sql -->
<dependency>
&...
0
votes
0
answers
10
views
Jasypt. Is it possible to decrypt the data encrypted in the previous program run?
I use runnable jar which at first run encodes password using jasypt and saves the key used. Then after reboot that jar file started again and for this time it just decrypts existing encrypted password ...
0
votes
0
answers
8
views
How to create schema with billion columns in Cassandra?
I see in Cassandra for every row key we can save billions of column name/column value pairs.
Also we need to create the schema before being able to persist data in Cassandra.
So I am wondering how are ...
0
votes
1
answer
13
views
Given string filter out unique element from string using regex
Have this string and I want to filter the digit that came after the big number with the space so in this case I want to filter out 2 and 0.32.I used this regex below which only filters out decimal ...
0
votes
2
answers
19
views
Spring Boot + RabbitMQ: how to convert received object using convertSendAndReceive() method?
How can I deserialize a message using convertSendAndReceive() method? It gives me NullPointerException due to not being able to find the required class for deserialization in another package. Packages ...
0
votes
0
answers
10
views
Hibernate's default-update-timestamps-region.data causes 90% disk I/0
There was a huge disk I/O on our servers when we were doing some batch email processing (Spring Thread Pool Executor) by retrieving/updating data in DB. When I did a "sudo iotop" command I ...
0
votes
0
answers
25
views
Java HashMap sorting first by value, then by key; overloaded method with different generic types
I am trying to sort a HashMap by first sorting values, then grouping keys into sorted array lists (of array lists of keys) based on sorted values. Each array list represents a sorted value.
For ...
0
votes
0
answers
6
views
Bidirectional Stack over issue
public class Post {
@Id
@GeneratedValue(strategy = GenerationType.IDENTITY)
private long postid;
@Column(nullable = false)
private String content;
@CreationTimestamp
private Timestamp timestamp;
@...
0
votes
0
answers
10
views
could not find the JDBC driver when using Pyspark to connect to MySQL database
I am using PySpark in AWS linux server.
My script:
import findspark
findspark.init()
from pyspark.sql import SparkSession
spark = SparkSession.builder.appName('My first app') \
.config('...
-4
votes
0
answers
22
views
Ask the user to choose whether to enter a 1-dimensional or 2-dimensional array
If you choose a 1-dimensional array: let the user enter an array with n elements entered from the keyboard (check input correctly - re-enter). Then make the user do the select:
The largest and the ...
0
votes
0
answers
8
views
How to open the index.html after every test automatically
I am using Serenity BDD with Rest Assured and want to open the latest index.html report automatically.
Using below code but it doesn't open the latest report.
what changes needs to be done to get the ...
-1
votes
0
answers
10
views
I was coding in vue3 js using chi library for footer spacing to 56px from the bottom .I need to change the code
The code I wrote is
<footer class="chi-footer" slot="footer"
style="margin-top: 56px">
<PoFooter/>
</footer>
But can I put in chi-...
0
votes
0
answers
7
views
Starting a new thread in each kafka Poll
In order to improve the performance of my Kafka listener I want to start a new thread inside my listener code
@KafkaListener(
topics = {"#{'${my-topic}'.split(',')}"},
groupId = "${...
0
votes
0
answers
20
views
Is there an alternative to parsing a string to an integer?
I was wondering if there was an alternative to parsing a string to an integer, because every time I use Integer.parseInt() I get a NumberFormatException.
My code:
fileStream = new FileInputStream(...
0
votes
0
answers
9
views
Doubts about the ClassReader and the accept method
I would like to know how the "optimization" described in the ASM user manual works.
I took a small snippet from the manual:
If a ClassReader component detects that a MethodVisitor returned ...
0
votes
0
answers
8
views
Apache Tomcat showing incorrect version after upgrade
I was using Apache tomcat 9.0.44 earlier and due to some security vulnerabilities I've upgraded it to 9.0.62 now.
/bin/Version.bat shows correct version now 9.0.62
Also checked registry keys and it ...
-1
votes
0
answers
9
views
Android Retrofit 2: java.net.SocketTimeoutException: failed to connect to /192.168.0.107 (port 8080) after 1000ms [duplicate]
So I am trying to get a Login method work using Retrofit 2 in a Springboot backend.
I have given the IPV4 address, tested that on postman but still gives the same error.
I also read the other answers ...
0
votes
0
answers
7
views
Why is Auth not defined using firebase : auth.js:5 Uncaught ReferenceError: getAuth is not defined at auth.js:5:14
UNDER THE SIGNUP PAGE
This is suppose to be a simple signup feature with firebase using html and java. I think it is possible that I am importing the Auth in wrong. I have it downloaded locally as ...
0
votes
2
answers
29
views
string between text and second dot using java matcher
need to find string between a word and second dot.
example: "abc-xyz-qwe/1.2.3 my-custom-text-3.2.1"
result: 3.2
my code
String str = "abc-xyz-qwe/1.2.3 my-custom-text-3.2.1";
...
0
votes
2
answers
32
views
What exactly is the "i" in this median task?
Hey i have the task to write a code to compute the median from an array. I My teacher gave me the following instructions:
Algorithm for the list l with length n > 1 and the position i:
divide the ...
0
votes
0
answers
11
views
How to redirect to specific servlet depending on JSTL variables content
Introduction
I have a website where users and admins can log in. In order to reduce code duplication and create a JSP login page for users and another for admins where just the action attribute of <...
-2
votes
0
answers
34
views
Java Reflection - Dynamically change return type of a method from BigDecimal to String
I want to change the return type of 1 method from BigDecimal to String type dynamically using reflection or any potential lib, this is required in order to provide the json-response for different ...
0
votes
0
answers
8
views
How to identify whether the face is in the frames while detecting by ml kit?
I'm doing an Android project that uses google ml kit to detect faces. I am having a problem is how to know when a face appears in the frame when FaceDetection works. I tried a few ways to display the ...
-5
votes
0
answers
19
views
Sublime Text for Java,
1
This how regular sublime text File Project looks like. For java, it's not convenient to open project like that.
Can in sublime project panel just like in IntelliJ
2
0
votes
0
answers
13
views
How to make button if got pressed and not pressed for a moment and output to table in netbeans
Hello I want to make some program with button if got pressed and not pressed for a moment but idk how to make it, can u help me?
-2
votes
2
answers
41
views
how to make sure an integer number is unique / not repeated
program is where users enter their details and they are searched by their social security numbers
i have the program running but i can enter the same social secirty number over and over
how can i make ...
0
votes
0
answers
8
views
Why is that the data of ChatList Activity Screen on an account also similarly show up in another Account
please help me, i will pray for you guys at least a week for the help.
im creating a chatapp using Firebase Database, which have an UI of chatlist, its a list of chat created from the friend request ...
2
votes
1
answer
32
views
Function::identity doesn't work in Collectors.toMap [duplicate]
I am trying to turn a List<String> into a Map<T, String>, with the value of the map being an element contained within the previous List<String>, and the key being some attribute of ...