Use Stack Overflow for Teams at work to find answers in a private and secure environment. Get your first 10 users free. .

Questions tagged [java]

Java (not to be confused with JavaScript, JScript or JS) is a general-purpose, platform-independent, statically typed, 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. Use this tag for questions referring to the Java programming language or Java platform tools.

Filter by
Sorted by
Tagged with
0
votes
0answers
2 views

Error: JMSCC5007: Use of JMS2.0 API “createContext()” s not supported

try { // Create a connection factory JmsFactoryFactory ff = JmsFactoryFactory.getInstance(WMQConstants.WMQ_PROVIDER); JmsConnectionFactory cf = ff.createConnectionFactory(); ...
0
votes
0answers
3 views

How can I resolve this Unsorted Data error in Neo4J-admin import

After a bit of trial and error I've managed to coerce my data into a set of CSV files that are initially accepted by Neo4j-admin import. However at around 70% of the import of the largest file the ...
0
votes
0answers
16 views

Migration of a programming language version like Java when there is a new version, in great companies [on hold]

How do companies manage the migration from an old version of a programming language like Java to a newer version.
-1
votes
0answers
6 views

Eclipse Formatter isn't indenting correctly

We are using the Java Conventions [built-in] formatter for our Eclipse projects. The code looks as expected after formatting and indents correctly when viewing it in Eclipse. What we've noticed is ...
0
votes
0answers
4 views

Adding external library for 32bit and 64bit in android studio

I am trining to to add a library for both architect 32bit and 64bit as it is available for both separately. I am using these library. For 32bit: implementation project(path: ':xwalk_core_library-...
0
votes
0answers
3 views

com.sun.imageio.plugins.jpeg.JPEGImageReader no longer part of JDK-11

I am trying to migrate a project from JDK8 to JDK11, the issue is that most of the things are no longer part of JDK11 as they used to be in JDK8. There are some separated jars that I had to add ...
0
votes
0answers
2 views

Maven-checkstyle-plugin can use code format file directly

Maven-checkstyle-plugin can use code format file directly. such as https://raw.githubusercontent.com/spring-cloud/spring-cloud-build/master/spring-cloud-dependencies-parent/eclipse-code-formatter.xml
5
votes
1answer
36 views

Nested array references

I'm currently learning Java online and am confused about the following code and what one of the elements in the array is evaluating to: int[] a = new int[] {9, 8, 3, 1, 5, 4}; for (int i = 0; i &...
1
vote
0answers
6 views

Making all properties required in a Json Schema object

I have a schema file that is being converted to a JSONObject, and i need to take that schema read through all the properties and add them to the appropriate required JSONArray in the schema object. ...
0
votes
0answers
6 views

can't find a file by calling openFileInput

I'm working on a game in android studios. For this game i want to load my mini games from a file named "minispiel.txt" But when i want to read the file i get a FileNotFoundException and i don't know ...
0
votes
0answers
4 views

JBehave junit test output grouping

Currently I'm trying to do some BDD with JBehave and using the "JUnitStory" as follows. import org.jbehave.core.configuration.Configuration; import org.jbehave.core.configuration....
0
votes
0answers
5 views

JavaFX: Remove special day while itarating over it

I know, there are many examples how to remove something from a list while iterating over it, but thats not the point. I'm trying to automatize a process that I need to document my work (in the end it ...
0
votes
0answers
7 views

How to fix 'Coach cannot be resolved to a type' error in Spring

I am new to Spring and I have this applicationContext.xml which has the bean, I used ClassPathXmlApplicationContext class to load the bean. and then I also have an Interface called Coach with method ...
0
votes
0answers
9 views

Not able to parse Protobuf in java

I have two protobuf files. I have to compare the contents of both of them in order to proceed further with the code. For this, i am trying to parse a protobuf file but some how i am not able to get ...
0
votes
0answers
4 views

JiraRestClient Search Not Working for JQL Query “issuefunction in issuesInEpics('key = REGDDV-24911') and issuetype=Feature”

I am facing issue related to Search JQL. I am using query (issuefunction in issuesInEpics('key = REGOPS-24911') and issuetype=Feature) in Jira Portal it is returning some record but when i am using ...
0
votes
0answers
13 views

hyphen symbol change to slash in csv in java

I'm generating csv file in java using following string 108176,2019-09-16,11-15-2019 when open this file in notepad++ it shows as this format but when I open it in excel it shows different format ( ...
0
votes
1answer
19 views

Change language Samsung S8+

I am facing a change language issue in Samsung S8+ (android 9.0). I have uploaded one release .aab("Android App Bundle format") file extension to the google play store of My Application. Now I am ...
0
votes
0answers
8 views

Not able to redirect to a jsp page from @ExceptionHandler method

In Controller i am trying to download a file. If the file is not exist i am throwing a custom exception DownloadException. I am handling this exception in @ControllerAdvice like below @...
0
votes
3answers
24 views

How to add an onClickListener that would open a new activity to a Fragment activity

I'm fairly new to android studio so I will try to explain as best as I can. I've made a menu using fragments, so my activity_home is a fragmented activity. Inside the fragmented activity I've created ...
1
vote
2answers
38 views

How to implement a do…while with a BufferedReader input

I'm trying to make a simple calculator program, and the basic functionality works, but I'm trying to implement a "do you want to do another operation" at the the end of the program so that it closes ...
1
vote
1answer
17 views

Junit test controller with JSON body on POST

I am having issues creating a unit test for my LinuxCommandController. The LinuxCommandController returns a string from the responsebody of it's post mapping. It invokes LinuxCommandService which ...
1
vote
0answers
32 views

How to prove the the correctness of recursive “search” algorithm in the code?

I don't know how to prove the recursive algorithm of the problem. I can't use the mathematical induction to solve the this proving.(although I am familiar with the mathematical induction). The ...
-1
votes
0answers
14 views

How to fix: loop input works once through with an additional “keyboard.nextLine()” but fails without it. Does not work more than once ever

If I remove the "keyboard.nextLine();" an exception is thrown on the first run. If I add it the loop will work 1 time, take an additional input and then fail when the enter key is hit. I have tried ...
-1
votes
0answers
33 views

Fail to convert String to org.threeten.bp.LocalDate

I can not convert String to org.threeten.bp.LocalDate. I have tried with: public type name( @Size(min=6,max=6) @ApiParam(value = "some description", required=true) @PathVariable("paramone") ...
0
votes
0answers
24 views

How to execute `docker exec -it netvertex bash` by Java Program

How to execute docker exec -it netvertex bash by Java Program. By this i am trying to execute but not working public void execute(String command) { try { System.out.println("====...
1
vote
2answers
30 views

View visible again after activity is minimized and then restored

So, I've been getting this weird thing in my app. Consider this, I have an AppCompatActivity, which has ViewPager inside it, which contains two fragments. I've added LottieAnimationView inside both ...
8
votes
0answers
49 views

Java Math.abs(int) optimizations, why this code 6x times slower?

As you may know, Math.abs(Integer.MIN_VALUE) == Integer.MIN_VALUE and to prevent a negative value, the safeAbs method was implemented in my project: public static int safeAbs(int i) { i ...
0
votes
0answers
18 views

How to parse many cursors into many classes

I have to call this procedure, but I want to know if is possible to parse all 3 cursors into different classes, for ex: for cursor 1 getResultList() will return class_1 for cursor 2 getResultList() ...
0
votes
0answers
14 views

Issues with combining MultipartFile and other fields (415 C Unsupported Media Type)

i am trying to upload file with Postman (Post request within its body a attachment key as form-data) In my @RestController i try this @PostMapping(value = "/upload") public String upload(@...
0
votes
0answers
5 views

CASSANDRA_CLASSPATH value

I am getting the following error while executing command nodetool status: Usage: java [-options] class [args...] (to execute a class) or java [-options] -jar jarfile [args...] (...
0
votes
0answers
15 views

How to write tests for HttpServlet with 100% coverage?

I'm trying to implement tests for my project where I mostly use HttpServlet. I need to write some tests for all gets and posts. I have tried searching for how to write the tests with mockito and ...
0
votes
0answers
10 views

MockMvc mockMvc empry resposne/return

I just created a simple integration test with MockMvc for a controller. All works well, but there is no response provided even the controller method returns something. Here is the Controller: import ...
-1
votes
0answers
7 views

HikariCP fetching user from somewhere when migrating app

I am migrating an oauth that is using the spring application startup to wildfly and I am facing some issues due the configuration (and the mess that this code is) that I could use some help. I am ...
0
votes
3answers
56 views

How can I return a for loop output as a String array?

Instead of my for loop printing the output id, I would like it to return the output into a String array that I can use later in my main method. Is this possible? public class FizzBuzz { public ...
0
votes
1answer
16 views

Can we Autowired below class into Configuration class in springboot

I have a Component class and a config class,so can we autowire component class which uses @value internally,I tried using it but it throws exception,Can anyone please help me understanding @Component ...
0
votes
0answers
19 views

TO_DATE in Oracle JDBC PreparedStatement giving invalid identifier

I am a bit baffled by this as I'm sure I have done it a hundred times but from this snippet of JDBC prepared statement: "SELECT {0} FROM " + "(select distinct p.BUSINESS_UNIT_ID, a....
1
vote
1answer
28 views

Mocked method returning NullPointerException

I want to test a method which will add headers to my GET request in order to establish a connection with public API. My service with business logic looks like: @Service public class ...
0
votes
0answers
12 views

How to send data using Java `HttpServlet` while serving `ReactJs` compiled `index.html`?

I have ReactJs compiled front-end and using Java back-end to serve the index.html of the react project. I am trying to send some initial data which the react should use to render the initial state of ...
-3
votes
2answers
36 views

App crashes on initialization views in Dialog [duplicate]

I'm trying to open Dialog window while clicking on some text view in recyclerview element. Opening a window works perfectly if I don't try to initialize the texts view. If I do, then the app crashes. ...
0
votes
1answer
15 views

Append text to text area but set caret position to end of line

Hi! I'm currently trying to build a terminal emulator using JavaFX, I'd like to append some text after "enter" is pressed. This works so far, but the problem is, that after my text is appended, the ...
0
votes
0answers
9 views

How to get the ParseTree even when there is a syntax error in the code in nashorn

String parseTree = parse(code, "nashorn", true); The above code is what i use to get the parse tree from the code. if I pass the below code (Syntactically correct code) String code = "function a (){\...
0
votes
0answers
10 views

Can't get member from private message received

I am trying to get the member from a message received that is a pm in order to then get the roles. However, I can't seem to get the member properly. I have tried converting the current author from ...
2
votes
0answers
21 views

java.lang.NoSuchMethodError: No virtual method group(Ljava/lang/String;) JDBC related

I am actually working on databases in an android app (using android studio). And I am stuck to this error saying: java.lang.NoSuchMethodError: No virtual method group(Ljava/lang/String;)Ljava/lang/...
-1
votes
0answers
10 views

How to parse XML Schema (XSD) with imports to String

in my Projectfolder is the main XML Schema with its import. main.xsd (contain partA and partB as import) partA.xsd partB.xsd I only find solutions for validating, but I would like to use this ...
1
vote
0answers
16 views

differents push notification for open differents activity

I was able to push notifications for messages (MessageActivity) and I want to use this to make also that of my comments on posts (CommentsActivity) when a user comments we get the push notification ...
1
vote
0answers
11 views

BillingManager$6.run NullPointerException

I am using billing in my published app: implementation 'com.android.billingclient:billing:1.2.2' In the developer console, I see several crashes related to it. However, when I test it, it works as ...
0
votes
0answers
14 views

can get data from database but unable to update record to the database from context listener class

I created context listener class in which I am creating a scheduler task using Executor class. From that task I am calling database. context listener class @WebListener public class ...
0
votes
2answers
25 views

Java FileWriter: To remove thread exception from code

Program to create text file using FileWriter. import java.io.FileWriter; import java.io.IOException; class Wx { public static void main(String args[]) throws IOException { String str = "...
0
votes
0answers
11 views

How to create a TensorProto from a Java Map

I can create a Tensorproto with single values like floats. // create TensorProto with 3 floats org.tensorflow.framework.TensorProto.Builder tensorProtoBuilder = org.tensorflow.framework....
0
votes
1answer
37 views

Responsive View in Android Studio

friends i am working on Android Studio to develop an app, the app will be used on Tablets and also other android phones. But i am getting some problems while designing the View (Template). Please help ...