Java is a general-purpose programming language designed to be used in conjunction with Java Virtual Machine (JVM). "Java platform" is the name for computing systems that have installed tools for developing and running Java programs. Use this tag for questions referring to Java programming language ...

learn more… | top users | synonyms (7) | java jobs

0
votes
0answers
3 views

How to compare two JSON Strings for equality using GSON?

I am trying to compare two JSON Strings for equality. I found this solution which uses Jackson as shown below but in all my project I am using GSON so I need to do the same thing using GSON. ...
0
votes
0answers
3 views

how to automatic write entry and exit log for @RequestMapping

in our system (it's based on Spring MVC), we have lots of controllers, in each controllers, we have some handlers with @RequestMapping(value = "/somefunction") annotation, but we don't write log when ...
-1
votes
3answers
18 views

Getting “;” expected error simple fix, new to java and Netbeans

not sure what is wrong keeps telling me i need a semicolon and parentheses package savingsaccount; /** * * @author cgw94 */ public class SavingsAccount { public static void main(String[] ...
1
vote
0answers
18 views

From 5 dice rolls, generate a random number in the range [1 - 100]

I was going through some coding exercices, and had some trouble with this question: From 5 dice rolls, generate a random number in the range [1 - 100]. I implemented the following method, but ...
1
vote
0answers
10 views

How to read Big files (~300 MB) from Google Cloud Storage?

I can easily upload/write or Read contents of files (~80KB) from Google Cloud Storage Now, I have to perform a bigger task : 1) Serve big files (~200MB-300MB) uploaded at GCS. 2) Need to read the ...
0
votes
0answers
3 views

Are database actions initiated from EclipseLink DescriptorEventAdapter.postUpdate method handled within the context of the initiating transaction?

Here's the situation: I have an API service method using the @Transactional (org.springframework.transaction.annotation.Transactional) annotation. The service method updates a table. Our JPA ...
1
vote
0answers
4 views

Unsupported Class Version during Maven build in Jenkins

I've seen a few of these questions on here, but none of the solutions/tips seem to be pointing me in the right direction. So I have 3 JDK's installed in the locations of "/opt/java/6", "/opt/java/7", ...
-2
votes
0answers
23 views

Sequential and Binary search algorithm

I searched google a lot and could not find answer, i am still learning java btw Example we have array a = (9, 3, 6, 7, 6, 5, 2, 2, 4, 8) and we are searching for value x = 6 What i need to do is to ...
0
votes
0answers
5 views

libgdx spritebatch not rendering textures

I'm working on a top down RPG game using LibGDX, and am creating an Ortho.. camera for my game. However in doing so, only my tile textures render now. This is how the render code looks: Camera ...
0
votes
0answers
6 views

Fragment “path/file.jsp” was not found at expected path “path/file.jsp”

There is a similar question to this but it does not have the same focus and is 5 years old. I have an error with a few of my includes in my .jsp files that reference things in my WEB-INF folder. The ...
1
vote
2answers
17 views

How to compare scanners input with an array?

I was wondering how I can compare the input from a scanner, to an array. Sorry if this is an easy question, but I'm fairly new to Java. Here's what I've written: public static void ...
0
votes
0answers
6 views

Calling done() as a result of seeing true from IsCancelled in SwingWorker to cleanly shutdown worker?

I have a method in my SwingWorker class called sleepy(int ms) that calls Thread.sleep to pause execution for some time. I would like to check the isCancelled function return value before I sleep to ...
0
votes
0answers
9 views

Best way to Unit Test Java Restful Web Service without Connecting to DB

I am using JDK 1.7, Jersey 2.12, Tomcat 7, MongoDB and RestAssured to unit test my Rest calls... However, I always have to my MongoDB daemon started along with the war file deployed to Tomcat 7 ...
0
votes
0answers
10 views

Action parameter is always empty

I'm trying to pass a parameter to an action in my bean: <p:commandButton action="#{criarContaBean.voltar(login)}" immediate="true" value="Cancelar"> And my 'voltar' method: ...
0
votes
0answers
15 views

java.net.SocketException: Connection reset

*hi , i want to make telnet connection some devices . i m able to connect cisco and juniper devices ,however, when send quit command to exit huawei devices my code throws Exception in thread "main" ...
0
votes
1answer
17 views

Send string variable from Activity to AsyncTask Class

I need to send a string variable from my main activity class to the AsyncTask Class and use that string as part of the url to make the api call. I tried using Intent and share preferences but ...
0
votes
0answers
15 views

Optimization of regular expression for custom key-value pairs

I am trying to extract some key-value pairs plus their preceding text from a large file, but the regular expression used runs very slowly, so it needs optimization. The input consists of fairly short ...
0
votes
0answers
11 views

Parsing XML from w3c Document

I'm trying to use a for-loop here in order to parse all the child nodes of an XML file and placing it in a object with getters and setters all set. public class WWUtils { public static final ...
0
votes
1answer
22 views

Match for multiple lines of text between delimiters in Java

How can I match multiple lines of text between delimiters in Java? Question best explained by an example: ... unimportant text EndOfEntry Key=Value unimportant text maybe a few lines of unimportant ...
1
vote
1answer
11 views

Spring and JSF Annotation

I have this bean: @Component @RequestScoped public class Hello { @AutoWire public DBDao myDao; //Getters / Setters } When I add the @Component the class is now managed by the Spring ...
0
votes
0answers
6 views

Shiro Subject Authenticated but missing Principal

I've got a strange Shiro problem I'm trying to track down where sometimes (race condition, likely) a session ends up containing the Authentication setting as true, but doesn't have a principal. Here ...
1
vote
0answers
11 views

What is the benefit of RmiProxyFactoryBean over writing my own wrapper (or not using a wrapper)?

Suppose I have the following Spring XML declaration: <bean id="myBeanName" class="org.springframework.remoting.rmi.RmiProxyFactoryBean" lazy-init="true" p:serviceInterface= ...
0
votes
0answers
6 views

service stops sending pictures to FTP server in Android

        I have a problem that really has me already without ideas. Context I have a service charge every 30 seconds to check the existence of images in a directory, for it created a Handler that ...
1
vote
0answers
13 views

Keep interface method names in proguard

Lets say I have.. public class SomeClass { public interface someInterface { public void firstMethod(String variable); public void secondMethod(String variable); ...
0
votes
0answers
26 views

Parsing for dynamic object vs. compilation [on hold]

I have issues (later on...) that can be resolved with either 2 specific solutions, each have their own pros and cons: Compiling at runtime - making a dynamic object (with a given string format - ...
-1
votes
0answers
16 views

Non blocking background Service in tomcat

I found some similar question in SO, but not fit to get a proper answer for my problem My war needs to run a background service. The service should be 1. Does not block the main tasks running by ...
-2
votes
3answers
39 views

Program not counting -2 at the smallest integer when in the array 10,-2,-1

For some reason, whenever I compile and run this code I get correct answers on what the lowest number in the array is. UNLESS I type in 10, -2, and -1. At this point, it gives me -1 as the smallest ...
0
votes
1answer
7 views

Generating a Random Type 1 UUID from a Unix Timestamp for use with Cassandra

Is it possible to generate a Type 1 UUID in Scala/Java (for use in Cassandra) from a particular Unix timestamp such that it could be used to obtain range slices of records, and individual records from ...
-2
votes
1answer
29 views

Initializing an iterator?

I was writing a basic program to practice using an iterator and was wondering why an initialization like this requires brackets after the initialization? Iterator<Employee> iterator = ...
1
vote
0answers
19 views

SQLite Ways to delete column: Using temporary table vs Renaming using ALTER TABLE

I am trying to find the best way to delete a column in SQLite. Here are the two ways I found: From the official website http://www.sqlite.org/faq.html#q11: BEGIN TRANSACTION; CREATE TEMPORARY TABLE ...
0
votes
1answer
10 views

How to read data in one zip file located in another zipfile using ZipEntry?

I have a zip file (x.zip) in which there is another zipfile (y.zip). I need to read a file in y.zip. How can I iterate through both the zip files to read the file? The code I am using to iterate ...
0
votes
0answers
6 views

Trouble using @JoinFormula in Hibernate

I have two tables in my PostgreSQL database: CREATE TABLE tableOne (id int, name varchar(10), address varchar(20)) CREATE TABLE tableTwo (id int, info text, addresses varchar(20)[]) now I want to ...
0
votes
0answers
26 views

Get “hidden” value from http reponse in Java

I'm trying to read HTTP response this way: StringBuffer response; try (BufferedReader in = new BufferedReader( new InputStreamReader(con.getInputStream()))) { String inputLine; response = ...
0
votes
0answers
6 views

Can't get custom taglib body in jsp

need some help here. I can't make any simple example of getting a custom taglib body work. When there is no getBodyContent function I get a nullpointerexception. In this example below I get a ...
-4
votes
0answers
15 views

Driver class/Main class [on hold]

In our java class projects, professor provided us with a driver class/main class. When I get a job, they will request me to finish a project, starting from the beginning and make it all from scratch. ...
0
votes
0answers
8 views

Pass params of one view to a controller

I'm using the Play Framework 2.x and I'm trying to pass the value of one button to a method in my controller, I have this: View: <form action="@routes.Application.changeLanguage()" ...
-2
votes
0answers
18 views

How should I redirect?

I am a literal roleplayer, sorry guys. I really do like roleplaying on a flash chatting site that allows you to customize your own profile. I know the more advanced code for hiding adds, I know how ...
0
votes
2answers
36 views

Dynamic variables in a for loop?

I've got a layout which is called activity_main.xml which is my parent layout, and I am then inserting a child layout (activity_main_card.xml) within a for loop. I also have an array, and what I am ...
0
votes
0answers
7 views

libgdx + gdx-sqlite can't access database on android

Hi I'm working on a project using libgdx-eclipse-gradle and gdx-sqlite for creating and accessing databases. I can't get the 'demo code' from the git repo of gdx-sqlite to work completely on android. ...
0
votes
0answers
5 views

Only one deployment is slow in Tomcat, another runs normally/quickly

Environment : Tomcat 8 (same results in Tomcat 7) JDK 1.7 Spring MVC 3 Oracle UCP 11.2.0.3 I have a single Tomcat 8 instance (same behavior exhibited in Tomcat 7) with two separate Spring MVC ...
1
vote
1answer
19 views

Subtract value of double array element from the previous array element

I have retrieved values from a sqlite database into a double array. Suppose i have a double array like this: double[] n = { 1.2, 3.0, 4.5, 6.7.... }; My aim is to perform the following ...
1
vote
1answer
17 views

How to parse optional URL parameters

I have a list of request parameters that all require different actions to be taken, but all of them are optional and any one of them could be null. I'm brute-forcing it now with a series of if ...
1
vote
1answer
31 views

How to return array from javascript call in java?

I have the following in a js file: function serialize() { return new Uint8Array(1024); } I invoke that function with the java scripting api like so: byte[] bytes = (byte[]) ...
-2
votes
0answers
27 views

Creating java ArrayLists based on text file

I have to create array lists of objects based on the information from a text file. The text file structure is: name1, attribute name2, attribute2 In this case, I have to read the text file and ...
-2
votes
0answers
8 views

Android Application Crashes On Wakeup(Parse)

I am using Parse as a Back-end service for my application,and would like to know what it is that is causing this app to shut down when the lock screen is turn off and then back on. The logcat is ...
0
votes
0answers
11 views

javax.swing.text.AbstractDocument$LeafElement contains invalid p0/p1 values

I'll apologize in advance for the lack of specificity on this, but I am unsure how this is being caused. We have a XMLDocument that extends javax.swing.text.DefaultStyledDocument If we make rapid ...
0
votes
0answers
10 views

How to start developing Parser for downloaded data set of Blogs in Java?

The aim is to build a search engine, hence starting with parsing the files to make documents with various fields like field name and field Id. I need some info how I can proceed with this in Java.
-1
votes
1answer
52 views

Pi calculator outputing 0

I am building a series of small programs for practice. I am building a Pi calculator to practice numbers. However, when I run the program the result is zero. No errors are thrown. More than likely the ...
-1
votes
0answers
24 views

How illegal forward refrence compilation error occurs? [duplicate]

Please explain in detail,I am not getting how illegal forward refrence error is occuring here- class Lab{ public static void main(String [] args){ Hello h=new Hello(); ...
0
votes
1answer
7 views

Liberty Profile + Servlet 2.4

Hi i hope you can help me please:), i have a web application that uses servlet 2.4, i Know is very old but i am trying to deploy this app on Liberty Profile 8.5.5.3 , Liberty Profile works with ...