Java is a high-level, platform-independent, object-oriented programming language originally developed by Sun Microsystems. Java is currently owned by Oracle, which purchased Sun in 2010.

learn more… | top users | synonyms

-2
votes
0answers
20 views

How to make a String variable work when writing a do…while loop?

While I was learning the do...while loop, I wondered whether a String variable could work. My intention was to make the user type names until the correct name was typed and have a greeting sentence as ...
1
vote
0answers
33 views

Change object state in different point in process

This is not about whether or not getters/setters are wrong. I understand its impact to encapsulation and that question has been raised here and SO several times already. I also do not want to just ...
-4
votes
0answers
53 views

Writing good Java [on hold]

Programming languages often have several legal ways to do something, and certain ways that experienced programmers tend to go. I’ve heard it called “idiomatic”. This is different from a style guide ...
-5
votes
0answers
14 views

Several alternatives to render image from STL files [on hold]

Can anybody here put some light on this post by giving some information of possibilities to render STL files into image? I am looking several possibilites either using some Java library/Blender ...
1
vote
1answer
38 views

Data Structure for Form or Survey

I am planning an app which allows users to complete surveys/forms. I'm having trouble planning the data schema for the forms. I really want to have a data structure which can be mostly automatically ...
-2
votes
0answers
28 views

Which one needs to upgrade first [on hold]

I have a situation, the question is which one to upgrade first Java or Tomcat. We are migrating tomcat 6 to 7 and Java 6 to Java8. Do we have any guidlines anywhere and which is the best way to ...
1
vote
0answers
50 views

Is Shiro's use of Auth Exceptions an example of control flow? [duplicate]

In Java/OOP-land, it is a well established anti-pattern to use exceptions for control flow. Apache Shiro is one of the standard Java security frameworks. When using Shiro, especially when ...
0
votes
2answers
149 views

How to reduce size of jar file?

I dont know how to reduce the size of jar file. When we normally code in Java Swing the jar file is created, is there any way to reduce the size of jar file? I can't remove the images and other stuff ...
0
votes
0answers
18 views

Approach for querying an arbitrary set of user submitted fields and values in Spring application? Like a shopping site sidebar search?

I am working on a Spring Boot and Angular application which has a requirement to search based on any number of the available filters being applied to a list. For example, a user searches on 'Title' ...
-5
votes
0answers
22 views

java-gnome Builder: GtkSoureView invalid object type

I'm trying to use java-gnome with Glade but when I run it then Java write this error: Exception in thread "main" java.text.ParseException: Invalid object type „GtkSourceView“ on line 255 at ...
-6
votes
0answers
44 views

How to update null value in MySQL boolean (tinyint) field instead of boolean value [on hold]

I want to update null value in MySQL boolean field through Hibernate which is initialized ones with boolean value.
0
votes
0answers
22 views

use of minOccurs=“0” without nillable=“true” in SOAP

I have received an XSD from a 3rd party supplier generated from a Java based system; which is to be used to create a SOAP endpoint for us to receive data transfers. Their XSD does not make any use of ...
0
votes
0answers
15 views

Implementing logging interceptor next to BeanPostProcessors and BeanNameAutoProxyCreator

I want to implement simple mechanism based on annotation on method in different classes. The case is, that I have some beans created as a proxies with transaction interceptors like this: <bean ...
-4
votes
0answers
17 views

Getting directions using my own voice samples regarding a gpx track [on hold]

My goal is to create an app in android that loads a gpx track Compares my gps position to the track and gives me directions using my own voice (samples) as in Go to the right soon Go to the left ...
-6
votes
1answer
81 views

How to enable 'for-each' loop in my own linked list class? [closed]

Please guide me on code additions that will allow someone to iterate over a custom linked list implementation using "for-each" loop, just like existing collection classes or arrays. All I know is that ...
0
votes
0answers
29 views

How can I paint a custom circular JComponent without an “invisible box” around it? [migrated]

I'm writing a JApplet that displays a diagram with numbers in circles and lines connecting the circles. I've created a class that extends JComponent to act as the circles. I overrode the ...
0
votes
0answers
20 views

WCF security with Java client

I'm about to develop a WCF service which is going to be called by an external Java client. I've developed a couple of services before but they were called internally, so security is now a concern. ...
-6
votes
4answers
164 views

Java constructor: I can't understand [on hold]

I am learning Java and I have a problem understanding the concept of constructor for the field variables. What is the problem with the following code. It shows "null" as an output. public class ...
1
vote
1answer
38 views

TreeItem containing non-String object displaying strange text

Hello StackExchange community! This is my first post and appreciate any help anyone can offer. I'm new to Java, and I'm sure this issue is simply due to my misunderstanding of the fundamentals. I ...
3
votes
2answers
290 views

Is turning a method into a class to use it across many classes bad practice? [closed]

Let's say I have a sort method inside of my class and another class that has no relationship with that class needs the same method. Instead of writing that method twice and breaking the do not repeat ...
-5
votes
0answers
39 views

Measuring sound frequency [closed]

I've been looking around for a Java API that measures the frequency of the sound, the project idea is to browse an audio file from the computer (contains only piano music) and to convert these music ...
3
votes
1answer
72 views

How to access environment-specific configuration in an enterprise application?

My application is a generic enterprise application which can be deployed on any application server running on any OS. I don't know how/where to configure my application, except for the database ...
-2
votes
3answers
145 views

What is the most elemental workflow for TDD?

Gradle is such an interesting build tool that it prompted me to look at Spock and JUnit -- which I've never done before. What is the basic workflow with TDD? My approach has been to do frequent ...
0
votes
2answers
128 views

Whether to use enum vs map vs config file?

I have ~30 resources each having ~10 attributes. I want to store some information about each attribute. Ex: its multiplicity, it RW (Read/Write), RO (Read only), longName, shortname. So I was ...
5
votes
9answers
334 views

Why is using an optional preferential to null-checking the variable?

Take the two code examples: if(optional.isPresent()) { //do your thing } if(variable != null) { //do your thing } As far as I can tell the most obvious difference is that the Optional ...
-2
votes
0answers
43 views

Android App - GPS Help [closed]

I'm currently working on a project that includes making an app for android phone using the phone's GPS. I'm looking for some insight into how to approach the project. The app needs to receive a ...
1
vote
1answer
47 views

Service/component based application in Java

I have a Java project whose architecture is quite component-oriented, and I am wondering if this is a common way to organize code which rules/patterns are used, if there is a name for this coding ...
1
vote
0answers
30 views

Handling multiple rest api versions within Android Java client

Actual architecture I have an app where a model is attached to every activity. The model ask a repository for information that can come from server or local db depending on many factors. When it asks ...
-1
votes
1answer
225 views

In which cases and examples String in Java is not immutable? [duplicate]

If Strings are immutable in Java, why is the output of this code 2GB, instead of 1GB? class Laptop { String memory = "1GB"; } class Workshop { public static void main(String args[]) { ...
2
votes
1answer
57 views

How to paginate local and remote data?

My team is currently facing a problem that we don't know how to tackle. Some technical details: we use Java 8, Hibernate, Spring, MySQL, and AngularJS for the front-end. We need to do pagination on ...
1
vote
2answers
91 views

Which layer should validation located?

I'm creating Rest API using (Spring Boot) and i using Hibernate Validation to validate request input. But I also need other validation, example when update data need to check, if company id not ...
-2
votes
0answers
28 views

Java 8 on Weblogic 12.1.3, Weblogic roadmap [on hold]

I would like to upgrade Java to 8 from 7. We use Weblogic 12.1.3 and 12.1.1 I wonder if my web application would work with Weblogic and Java 8. What could be the problems? We are using JavaEE, JMS, ...
-1
votes
0answers
29 views

Does java ee include java se? [duplicate]

I'm new to java EE. I am setting up my machine for java EE projects. If I install java EE package from oracle, do i have to install java SE also? Or does the java EE package already contain the SE ...
-1
votes
0answers
34 views

DAO only static methods [duplicate]

DAO public interface UserDao { boolean addUser(User user); User findUser(String email, String password); } DAO Impl public class UserDaoImpl implements UserDao { @Override public ...
5
votes
2answers
185 views

Is it an antipattern to use peek() to modify a stream element?

Suppose I have a stream of Things and I want to "enrich" them mid stream, I can use peek() to do this, eg: streamOfThings.peek(this::thingMutator).forEach(this::someConsumer); Assume that mutating ...
0
votes
1answer
88 views

Communicating with third party API

I am working on an App which basically communicate with a third party API, it has no back-end. The front-end will be a SPA. Here is the overall scenario: The external API needs current user's Id to ...
0
votes
0answers
49 views

Options for implementing database and programming logic for statistics application?

I am implementing a statistics driven web application. The statistics relate to sporting events. Right now I have a postgresql database with a table that holds a row for each match. This is a ...
1
vote
1answer
92 views

Compiler design prevent register override

I'm trying to write a compiler for a self-designed CPU with accompanying instruction set. The CPU has 3 registers, 2 input registers (B and C) and one output register (D). When for example an ADD ...
1
vote
1answer
142 views

Is stack allocation in Java implementation dependent?

I've looked through the different threads, and there are a lot of conflicting information out there. The most useful article I found was this: Java theory and practice: Urban performance legends, ...
15
votes
2answers
463 views

What are the reasons for why a Java/Linux stack fails to be “real time”?

I have often heard developers mention that Java can't "do Real Time", meaning a Java app running on Linux cannot meet the requirements of a deterministic real-time system, such as something running on ...
0
votes
2answers
86 views

Design pattern to holds API exchanges?

I'm developing a simple application that crawls in web pages to obtain some information. For this I used and tested some libraries, like crawler4j, jsoup, jaunt and htmlunit. I exchanged several ...
0
votes
0answers
88 views

Java Multi-threading

I was solving this question in Java where the user enters a partitioned array. The computer then determines what all elements from that array can be used as pivots. (Pivots are the same pivots that ...
-1
votes
0answers
131 views

Building a mini programming language for the end user

I'm developing a web application using Java EE that should provide a user-friendly interface which allows users to supply some algorithms using some variables (Some entity attributes of the ...
7
votes
2answers
289 views

Is using this complex data structure bad practice?

Right now in my current company I must "parse" a csv and extract some data out of it (in the sense of data mining). I surprised myself by defining the following data structure (Java 8): static ...
3
votes
1answer
89 views

How is this Java Keystore cert still valid?

I maintain an old Java app that deploys to Tomcat and which uses SSL (and hence a keystore). It is important to note that this app will not even start up if the SSL cert is bad/expired/invalid! Every ...
1
vote
2answers
103 views

Does an interface including several methods that return instances of Object make sense?

I am in the process of writing my first true API. In the process, I am defining an interface for mapping complex data structures onto other complex data structures. At the moment, the interface ...
0
votes
1answer
33 views

Concurrent and atomic updates to multiple properties/variable of an object

I have a class with multiple setters and want to make atomic updates to multiple properties/variables. As far as I can see there are three methods that could work: Call all setters in synchronized ...
0
votes
2answers
77 views

Moving Java static variables into XML

I've been working on a small Java project by myself for a department that does not do a lot of software development but mostly database stuff. I showed my boss the code I've been writing and he saw ...
0
votes
0answers
33 views

Libgdx texture and sound disposing

I'm writing a game and in the game, I use an asset manager that is in a singleton class, which holds my textures and sounds. If I create several enemies (lets say 4) which call upon my asset manager, ...
96
votes
13answers
15k views

Should we avoid language features that C++ has but Java doesn't to increase maintainability? [closed]

Suppose I am limited to use C++ by the environment in the project. Is it good to prevent the use of some language features that C++ has but Java doesn't have (e.g.: multiple inheritance, operator ...