Questions tagged [java]
Java is a high-level programming language. Use this tag when you're having problems using or understanding the language itself. This tag is rarely used alone and is most often used in conjunction with [spring], [spring-boot], [jakarta-ee], [android], [javafx], [hadoop], [gradle] and [maven].
1,749,563
questions
0
votes
0answers
2 views
How to create cluster using Vsphere management sdk using java
I am unable to create Cluster using vsphere management sdk 6.7/7 using java .I am trying the automation of VM so I am using vsan management sdk and vsphere management sdk for that.
I found one class ...
0
votes
0answers
4 views
spring boot aspect throws object not found error while switching from tenanat database to client database
db source context class
public class DbSourceContext {
private static final ThreadLocal<String> dbContext = new ThreadLocal<>();
public static void setDbSource(String source) {
//...
-2
votes
0answers
19 views
Why is .toString() method not working? (java) [duplicate]
I have a task to create a toString method that returns the value of name along with the value if id as a single String value
public String getNameAndId(){
return this.name+" "+id.toString();...
0
votes
0answers
5 views
Downloading files from FTP server Java ? java.net.NoRouteToHostException: No route to host (Host unreachable)
I am trying to download files from FTP server, in the beginning the code was working properly, but all of a sudden this starting to failing in local machine & servers too..
Here is the FTP url and ...
0
votes
0answers
6 views
Spring REST API have a User entity as well as a Staff Member entity
So I have a User entity which all users that sign up to my website get, however I also have staff members, which I want to just be Users with more data, I also easily want to update a normal User to a ...
0
votes
0answers
5 views
Missing grant type error, When generating new Token from Refresh Token using Spring Security Oauth2
I am trying to generate new token from refresh token.
I am making rest call using spring Rest Template as below.
String clientCredentials = "Client Id value here + ":" + " ...
-1
votes
0answers
5 views
How to initiate autocomplete google map location searching after 3 character in Android with java
I am trying to search using autocoplete google place api but Google place api fire for every character.So, I want to show autocomplete suggessiton after 3 character typed in inbuilt autocomplete ...
0
votes
0answers
6 views
vSan Automation using Java
I am trying to automate vSAN configuration using java, I tried using vijava and vsphere-automation-sdk-java but no luck. I want to do the following things using these APIs -
Get vSAN eligible disk ...
-2
votes
0answers
12 views
Testing api with postman
I'm new to api test.I have a project to complete but I don't know much about it.I need to use I need to use postman for testing however my teacher also shared java codes with me.There are classes like ...
-1
votes
1answer
15 views
Best way to throw exception when Set has N objects already during stream Java
Let's say I created an object class called Person and has a String variable called Name, and another String variable called address, and if 2 person instances have the same name and same address, then ...
-2
votes
0answers
8 views
How to delete 2 days older than folder data in HDFS from Java
How to delete 2 days older than folder data in HDFS from java
and need to configuration also
Need Java code...
1
vote
1answer
26 views
StringType issue: Exception in thread “main” scala.MatchError: org.apache.spark.sql.types.StringType@50a7c72b
@Override
public Option<DataType> getCatalystType(int sqlType, String typeName, int size, MetadataBuilder md) {
switch (sqlType) {
case java.sql.Types.JAVA_OBJECT:
switch (...
1
vote
2answers
44 views
Cannot Convert Date '0001-01-01' from Java to C# correctly
I try to provide a tool to convert datetime from Java to C#. But there is a serious problem.
In Java, I read '0001-01-01' from the SQL Server database via java.sql.Date, and get the millisecond -...
0
votes
0answers
6 views
How to add 2 Endpoints in MarshallerConfig for SOAP Client in Spring Boot
I am trying to add 2 endpoints in MarshallerConfig configuration class for SOAP Client in spring boot.
Below is the code which I am trying in my project for MarshallerConfig and SOAPConnector.
...
0
votes
2answers
30 views
How to generate copies of LinearLayout in java inside loop
I want to know how could I copy a particular LinearLayout like this:
<LinearLayout
android:id="@+id/someID"
android:layout_width="match_parent"
android:layout_height=...
-5
votes
0answers
10 views
What is gmail integration with zoho mail? [closed]
What is gmail integration with zoho mail?.
Can I access all my gmail messages after attachment from zoho?
0
votes
0answers
15 views
Test In-app review in android mobile application
I have implemented Google Play In-App Review in my android application. but not understanding how to test it. I have gone through google API documentation it's written there you can test via internal ...
2
votes
0answers
23 views
Merging values contained by key in a map (Java)
final Multimap<String, Map.Entry<Integer, Integer>>[] actionMap = new Multimap[]{null};
final boolean[] loaded = {false};
db.execute(connection -> {
PreparedStatement statement = ...
1
vote
0answers
21 views
Best way to add data to a list in firebase database
I am using Firebase realtime database and was trying to store a list of "Animales" for a user.
Database structure:
What I want to achieve is that for example: for the user with "Uuid&...
-2
votes
0answers
11 views
The method undefined getPassword() is undefined for the type JTextField.I can't see what the problem
I dunno what the problem here.Already look my coding a few hours.Still can't figured it out.
Please help me
JButton btnLogin = new JButton("Login");
btnLogin....
0
votes
0answers
21 views
Spring boot call delete method not work in some conditions
I have CurrentTerminalStatus entity like this:
@Entity
@Table(name = "current_terminal_status")
public class CurrentTerminalStatus extends DateAudit {
@JsonIgnore
@Id
@GeneratedValue(...
0
votes
1answer
15 views
Getting 250+ items but Custom Listview not displaying anything
I just created a list view with a custom view to create a country list for select
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas....
0
votes
0answers
17 views
Error converting result java.lang.NullPointerException and JSON Parser: Error parsing data org.json.JSONException: End of input at character 0 of
I keep getting the following error in my logcat whenever i try to click on "login" or "signup" on my virtual device
2021-01-27 19:08:14.703 11914-11964/com.kate.CapstoneProject
E/...
-5
votes
0answers
12 views
Download file and upload in spring boot
I am new to Spring, In spring boot i have to download a file from an url and upload to different url without saving in the local device. can you please guide me on accomplish this?
-7
votes
0answers
16 views
Java score calculator [closed]
I am new to coding. I need help making a program for a project. The program needs to be able to add up several user input text fields and out put them to a total box how would I go about doing this. I ...
0
votes
0answers
6 views
Reactor TcpServer drop incoming connection
What is the proper way to deny/drop incoming connection to a Reactor TcpServer?
I currently have following:
TcpServer.create()
.doOnConnection {
if (notAllowed(it.address()) {
throw ...
0
votes
1answer
23 views
How can retrieve Answer and Question table in back end with sql query like this?
I'm using Servlet JSP SQL to write Quiz Application
I have two table in sql like this:
Question(questionID, question_content, status, subjectID)
Choice(choiceID, choice_content, questionID, isTrue)
...
0
votes
1answer
31 views
How to use stream to create map
Input: List<Foo> rawdata
Desired Output: Map<Foo, Bar>
Method implementation: Java 8
public Map<Foo, Bar> getMap(List<Foo> rawdata) {
rawData.stream().flatmap( d -> { val ...
2
votes
1answer
20 views
querydsl can't get data immediately after Jpa Insert
I have a java method with insert and select like that:
@Override
public Page<ApprovalProcessEntity> getApprovalProcess(int page, int size, String approvalNum, String approvalType, int ...
0
votes
0answers
16 views
What is the cause of LazyInitializationException when testing Spring Boot web app with MockMvc and AutoConfigureMockMvc
I am trying out a few examples of unit testing Spring Boot MVC from this tutorial -https://spring.io/guides/gs/testing-web/. My project has Spring Boot MVC and JPA (https://github.com/shankarps/...
-1
votes
1answer
21 views
Is there a way to automatically reset the edittext value to 0 in Android studio when it is null? [closed]
If the EditText value is null with nothing, I want to automatically zero the value.
I want to use on FocusChanged() to write an if statement that if the text in EditText is "", it will ...
1
vote
2answers
35 views
How this non-existing getter method becomes available
I'm just getting my self familiarized with the code base of our application and I found this one Java class:
@Setter
@Getter
@Entity
@Builder
@NoArgsConstructor
@AllArgsConstructor
@Table(name = ...
0
votes
1answer
33 views
Java 8 - Generate power set of list
I have written the following method to generate power set using Java 8 map function
public static List<List<Integer>> powerSet(List<Integer> arr){
List<List<Integer>&...
-4
votes
0answers
16 views
Method OverRiding withoout giving Body [closed]
enter image description here
Why it is Method OverRiding and not method duplication. Is it possible to overRide without giving body or implementation??
0
votes
0answers
9 views
Draw path between current location and a marker
I am trying to draw a route / path between current device location and specified coordinates. The destination coordinates are statically specified in code.
I tried to get the devices location with ...
2
votes
3answers
51 views
Intra-thread coherence
The code is simple.
// not annotated with volatile
public static int I = 0;
public static int test(){
I = 1;
return I;
}
There is a thread that invokes the method test.
Is it possible the ...
-1
votes
0answers
18 views
Airline reservation System UML question - where do these methods belong?
I am preparing for Software Engineering interviews and figured out its good to get a sense of Object Oriented Design for my interviews. In all the examples of UML diagrams I looked at, I am having ...
-5
votes
1answer
48 views
Why does this code print out random letters? [closed]
Why does this code print out random letters? So if you can't tell what I am trying to do, I created four functions. delete_File() Deletes the file if created. new_File() creates a new file called data....
-1
votes
0answers
17 views
Send sms to phone with java
Hello so im trying to send a sms to a phone with java/spring boot, i've heard about twilio and i've tried to create an account, but the account is suspended just after i enter the confirmation code ...
0
votes
2answers
27 views
Can anyone explain exactly what the post- and pre- increment is, because from what I know, I'm just getting more confused?
shouldn't this be, 11 is good and 21 is bad? because, in case of i++, the value 10 first gets evaluated if equal to i, and then incremented?
int i = 10;
if(i++ == i){
System.out.println(i + " is ...
0
votes
0answers
9 views
Process OutputStream hangs when reading from python sub-process
This code works as expected.
public static void main(String[] args) {
char[] buffer=new char[16];
try {
Process process = Runtime.getRuntime().exec("bc");
...
0
votes
1answer
29 views
Calculate the differences in a List in a functional way
I have a list of absolute values (for example: 10, 50, 30), which I'd like to transform in a functional way to a list of differences between these numbers. So, given an input as 10, 50, 30, I'd like ...
-2
votes
0answers
7 views
Can you put a jLabel on top of another jLabel in Netbeans drag and drop jdialog [duplicate]
With Netbeans 8.2 IDE. I am trying to place a jLabel image on top of another jLabel image. Is there anyway to do it with drag and drop?
0
votes
1answer
16 views
Why does JSF output change date?
I have a SQL Server database where some columns have a datetime type but store only a date with the time parts all being zero.
A Java web app running on WebSphere Portal uses JSF and Hibernate to read ...
0
votes
0answers
19 views
GSON array inside array of same object - Android
Having the following JSON:
{
"categorias":[
{
"id":1,
"nivel":1,
"nombre":"Pants",
"activo":...
0
votes
0answers
5 views
CreateFromRessource ChipDrawable : The style on this component requires your app theme to be Theme.MaterialComponents
With using AppCompat and using min sdk version 21, I try to use ChipDrawable to use in a list of email adresse in a TextEdit, and I create that ChipDrawable with :
ChipDrawable chip = ChipDrawable....
0
votes
0answers
21 views
How to update color of a Swing Oval
I would like to dynamically update the color of a Swing Oval I have drawn in my java swing app. Can Someone please help me?
my circle class I created to draw the ovals:
public static class Circle ...
0
votes
0answers
6 views
Failed to redirect after login in TQA env but passed Dev
Currently I wrote this small java application
public String login() throws InterruptedException {
this.waitForCondition().withTimestamp(Duration.ofSeconds(120)).until(this::loginElementsDisplayed);
...
-7
votes
0answers
23 views
N-Queens Completition With 1 Queen [duplicate]
We have a 2D boolean array that represents the position of the queens. Given a certain position for the initial queen we have to calculate using backtracking one possible solution for the chessboard. ...
1
vote
2answers
33 views
Expressions with BigDecimal Java / Kotlin
I need help from those who understand Java / Kotlin.
I would like to perform some calculations with BigDecimal
How would the expression below look using BigDecimal?
(1 + 0.02) ^ (1 / 251) - 1
I tried ...