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

0
votes
0answers
32 views

Proximity SDK alternatives for Android

Perhaps you used Wifi using Android SDK to get the device recognition each other. Or perhaps you used bluetooth for that purpose as well. But do you know that I found these two SDK(s) that provide the ...
0
votes
0answers
32 views

Why is my JFrame not visible when running my Java application in eclipse? [migrated]

Hi there and thanks for having a look at my question. I'm facing the following problem when developing swing applications in Eclipse: When I try to start a simple swing JFrame application (for example ...
0
votes
0answers
77 views

Interactive session with a command line program using Java?

I plan to write a website frontend for a free computer algebra system (Reduce, http://reduce-algebra.com/). On the webserver I have a Java virtual machine running, and Reduce is also installed. I can ...
39
votes
9answers
3k views

Programming for future use of interfaces

I have a colleague sitting next to me who designed an interface like this: public interface IEventGetter { public List<FooType> getFooList(String fooName, Date start, Date end) ...
0
votes
1answer
129 views

Why does this method return 2 values if I only ask for one and there is no sort of conditional statement anywhere?

I'm writing this very simple program from this one PDF called Think AP Java, and I can't seem to wrap my head around this: When I write public static double method_1(double x) { double ...
1
vote
1answer
104 views

How Jetbrain Phpstorm IDE is working without installed java?

As far as I know Jetbrains PHPStorm is programmed in Java but while I don't have Java installed in my Windows 7 PC, PHPstorm is installed and working without any problem. How It's done?
0
votes
2answers
224 views

how to approach pharmacy software project [closed]

I would like to complete a pharmacy software proof concept. But I have a few questions I do not know. Physician information In order to refill or dispense a new RX the software needs to have access ...
0
votes
2answers
89 views

Way for java program to read file from when it was stopped

I am working on an application that reads a log file, looks for a specific string, sends alert emails and saves data from the file into a database. The reading functionality is working well, but I am ...
0
votes
1answer
78 views

How can I perform a logical test to ensure that MY CUSTOM ERROR gets thrown instead of the NumberFormatException?

I am working on something that should be fairly simple. I have 95% of my program working, but one piece is still not fulfilling the requirement. (FYI, this is for a homework assignment, but I will ...
3
votes
2answers
139 views

Program Design clearness vs convenience

I've recently disputed with my colleague about the following situation: I've developed a framework that processes the resources (in java, although its not really important). It goes (simplified, ...
4
votes
3answers
80 views

Returning results of method on batch list?

The title is a bit vague so I'll try to elaborate. I have a function makeFoo(int bar) -> returns Foo or throws Exception. I also have a batch version of this makeFoos(int[] bars) -> ...
0
votes
3answers
167 views

When to use default access modifier?

I want to understand, from design point of view, in what situations I should use default access modifier, and when I shouldn't. I found this related question, that provides some basic explanations, ...
0
votes
1answer
82 views

Multilayered enterprise application use of JAXB objects

I am asked to refactor and maintain an enterprise application. Normally I'm used to using the MVC design pattern. This time however, I'd like to separate everything into layers (multilayered ...
-1
votes
0answers
47 views

Android Set Device DIscoverable (bluetooth) without any dialog [migrated]

How can I set the dialog to be hidden / suppress it to Yes when I try to execute the following code below? discoverableIntent = new Intent(BluetoothAdapter.ACTION_REQUEST_DISCOVERABLE); ...
1
vote
2answers
236 views

Is it okay if we use an arbitrary string as UUID?

I found the tutorial of client (android) and server (pc) bluetooth tutorial from here. But my question is about the UUID. Is that okay if we define it randomly without the proper format? Because I ...
0
votes
1answer
79 views

Automatically create or update object in database

I have a database class with the following interface: public Database { //returns false if p (its ID) is already available //otherwise adds p the the list and returns true public boolean ...
4
votes
2answers
174 views

Understanding JAVA generic keyword 'super'

Recently some people said that I was wrong when I explained why one cannot insert a Number object into a list declared as List<? super RationalNumber>. (This assumes that RationalNumber is a ...
-1
votes
1answer
52 views

Is any one of these the right way to write a license for your opensource project forked and modified from an existing one with different authors?

I've used parts of source from an existing Java library project with what appears to be a 3-clause BSD license. I've made significant changes to the library which makes it possible to use it in a new ...
3
votes
2answers
101 views

System state design composition

Consider the following Java code: public class HumanStateImpl implements HumanState { private boolean alive; private Color skinColor; // getters and setters, other state fields ...
0
votes
0answers
25 views

Remote limitations of hg4j?

I’m evaluating hg4j to see if it’s useable in my current project. I need a (preferably) pure Java hg library that can: Check out a working copy of a remote hg repo at, say, ...
1
vote
1answer
93 views

Pros and cons of custom exceptions [duplicate]

This may be an pointless question based on opinion, style, and context but I've been racking my brain trying to decide whether or not to make use of custom exceptions and would love to hear some pros ...
3
votes
2answers
673 views

Why does C# have much more features than Java? [closed]

Please note that this isn't meant to be a Java vs. C# argument. I'm a Java programmer with no C# experience, asking just out of curiosity. I did some reading on C#, and it seems it has much more ...
0
votes
0answers
82 views

How to design extension mechanism for java app

I have an application where I have a set of core features. The application itself HAS to work in core only mode. I would also want to make the application extensible such that, when certain ...
0
votes
0answers
8 views

Select design pattern - user stage [duplicate]

I'm struggling to point a finger into the right design pattern. I have a web site which user can register and interact with the system. I want to add the following abilities to a user: Each user ...
1
vote
3answers
162 views

In Java, what are some good ways to separate APIs from implementation of *entire projects*?

Imagine you have a software module, which is a plugin to some program (similar to Eclipse) and you want it to have an API which other plugins can call. Your plugin is not freely available, so you want ...
-1
votes
1answer
71 views

What is the recommended way to go about porting large code bases? [closed]

I am currently porting a large library (150+ files, 15k+ LOC) from Javascript to Java. Fortunately, the original library is already very object-oriented, so this has largely been a matter of ...
0
votes
0answers
3 views

What method call in HttpsURLConnection actually sends the HTTP request? [migrated]

I am new to the HttpsURLConnection class in java, and looked on the doc and found it not very enlightening. I have inherited this code on a project I am working on (I did not write it myself) and ...
0
votes
0answers
15 views

Best approach for storing banking information [migrated]

I am currently developing an auction desktop application. At the moment I am storing the buyer and vendor information in 2 separate tables within a MySQL Database. Currently the data for these tables ...
17
votes
4answers
546 views

How bad is it calling println() often than concatenating strings together and calling it once?

I know output to the console is a costly operation. In the interest of code readability sometimes it is nice to call a function to output text twice, rather than having a long string of text as an ...
3
votes
0answers
75 views

Does synchronization in java protect modified class fields? [migrated]

I saw this on Java's synchronization tutorial: public class SynchronizedCounter { private int c = 0; public synchronized void increment() { c++; } public synchronized void ...
-2
votes
0answers
24 views

how to read and write a ppm in Java [migrated]

I'm solving old exams. In Java, I would like to open an image file input.ppm, convert it to greyscale, and save it as output.ppm. So I have to read all its contents (RGB information for each pixel), ...
0
votes
1answer
126 views

How to convert a Java applet into a runnable jar? [closed]

I am a complete beginner to programming but I have managed to create a game as a Java applet. Can an applet be converted into a runnable jar file? If so, how ? Is there another way I can make my ...
2
votes
1answer
142 views

Structuring a storage system for a game

I am working on a multiplayer game, where a player has many storages to store items in. Storage Storage is the system that allows the user to deposit items, and take them back. Example of storage ...
0
votes
1answer
111 views

Dynamic query in Mysql

I'm doing a J2EE web application with Struts2, Mybatis and a MySQL database, so what I want to allow to the user is to be free to choose different parameters to perform a select to a table in the ...
1
vote
3answers
144 views

w3c library license: does it prevent the inclusion in/distribution with paid software?

From W3C Software Notice and License: Permission to copy, modify, and distribute this software and its documentation, with or without modification, for any purpose and without fee or royalty is ...
0
votes
1answer
61 views

Database Password problem when using GIT to manage project that uses Spring to initiate Datasource

Program Situation I use Spring Framework to code my Web Service, using Dependency injection to inject a DataSource bean into the DAO bean that will be used by the Web Service. I have all the ...
4
votes
1answer
405 views

In Java, why use bit hacks when non-bitwise technique it is more readable?

Is there any legitimate use for bit manipulation hacks in higher-level languages such as Java? I can see them being useful in speed-sensitive low-level and computation-intensive programs, e.g. ...
0
votes
1answer
80 views

DTO - service layer - statelessness best practices interfering with each other

I am designing a REST API coupled with a service layer that takes DTOs as input and produces them as output. This works fine for most service calls where the DTO is used to access an underlying ...
2
votes
1answer
173 views

How should object identification be managed?

I have a java/swing application in (hopefully good) MVC structure. Here is a overview of my model classes: One or more workers may work at one working location and one worker may work at different ...
32
votes
6answers
2k views

Good or bad practice to mask Java collections with meaningful class names?

Lately I've been in the habit of "masking" Java collections with human-friendly class names. Some simple examples: // Facade class that makes code more readable and understandable. public class ...
17
votes
4answers
712 views

How can I use unit tests and TDD to test an app that relies mostly on database CRUD operations?

At work, one of my projects is mostly about taking data passed in from an external client and persisting it in a database. It's a Java enterprise app using JPA and most of our logic revolves around ...
0
votes
2answers
131 views

IllegalStateException vs. IllegalArgumentException

In have written a function which expects the caller to pass in a configuration file like XML. Then I parse this given file and extract something which i then return. In this function (at least) two ...
0
votes
0answers
8 views

EBeans alternative to find() in JPA [migrated]

I was following the Play! Framework tutorial on creating a blog. They use JPA instead of EBeans and they use the find() function that extend from play.db.Jpa.Model . I am using EBeans and have ...
0
votes
1answer
114 views

Is Akka a good solution for a concurrent pipeline/workflow problem?

Disclaimer: I am brand new to Akka and the concept of Actors/Event-Driven Architectures in general. I have to implement a fairly complex problem where users can configure a "concurrent pipeline": ...
40
votes
7answers
3k views

Why is the finalize method included in Java?

According to this post, we should never rely on the finalize method to be called. So why did Java include it in the programming language at all? It seems like a terrible decision to include in any ...
0
votes
1answer
68 views

Implement RPC via SIP

Look at the following use case. I have a client (Java) application, which wants to get/set the state of another, remote application (C). The communication between them is done via SIP, which is run ...
25
votes
9answers
2k views

Is template “metaprogramming” in Java a good idea?

There is a source file in a rather large project with several functions that are extremely performance-sensitive (called millions of times per second). In fact, the previous maintainer decided to ...
0
votes
0answers
31 views

Overriding JDK classes [migrated]

I want to override the JDK implementation of sun.nio.ch.SocketChannelImpl so I have access to the FileDescriptor and can create a second SocketChannelImpl with an existing FileDescriptor. I can't ...
0
votes
3answers
276 views

Why do APIs generally consist of interfaces? [duplicate]

I am starting out in Java API design and in reading existing code bases, I have found that most APIs consist of interfaces only with their implementations bundled in a different package. Having read ...
-1
votes
0answers
38 views

Concept to Transfer Rater per Second while downloading [migrated]

i am being given a task from my senior to come out with a function to show size transfer rate per second. I have to download a file from web with my java code and display the transfer rate per ...