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.
0
votes
1answer
44 views
Making a database and related operators using files and JSON in java
I'm trying to write a program that reads operations from a file. these operators look like below :
CREATE TABLE student(id:integer, gpa:decimal, name:string, family:string,isMale:Boolean)
INSERT ...
-3
votes
0answers
14 views
Selenium Web Driver logger work [on hold]
I am using selenium web driver for Chrome and want to log steps of script
but it always overwrite previous logs.
I'm using the following code for logging:
...
-4
votes
0answers
31 views
I wrote a Java program to load and play an audio file, can anyone point out what the problem in the code is? [on hold]
package rico;
import java.applet.*;
import java.awt.*;
import java.awt.event.*;
import javax.swing.*;
public class Rico extends JApplet {
private AudioClip sound1, sound2, currentSound;
private ...
0
votes
1answer
36 views
Reading from html page that needs cookies passed and form data
I am writing a program in java in order to practice tough coding problems and learn more.
Program description
The program reads first names from a text file one by one, then enters them into facebook ...
0
votes
1answer
44 views
Using XML to store and edit data records in Java
I want to use XML to store data for an assignment .
In this Java assignment I'll get data from the user in form of lines in a file below
INSERT INTO student(id,name,family,isMale) VALUES ...
-2
votes
1answer
44 views
Java Non-static method cannot be referenced from a static context [on hold]
I want to make a reservation system for a camping. I also wanna know how many people already have made a reservation. Im using the iterator but I get the error "Non-static method getPersons() cannot ...
3
votes
1answer
321 views
Scheduling a few CPU-intensive tasks
I need to schedule a small number of CPU-intensive tasks to run every so often, reading from shared data and writing to dedicated buffers. I don't necessarily want to roll my own scheduling, but am ...
0
votes
1answer
337 views
MVC: How to Implement Linked Views?
I'm developing a java application to visualize time series. I need (at least) three linked views, meaning that interaction with one of them updates the others.
The views are:
A list represents the ...
-1
votes
0answers
34 views
Monitoring an .mp2 file in Linux to see if it's used by another process
I'm working with an application that creates .mp2 audio files.
I need to make sure the audio files are completely released by the application before moving the file to another directory.
I have a ...
0
votes
1answer
135 views
Should I always call super in Java? [duplicate]
Anti-pattern considerations aside, should I always call super in Java when overriding methods, even when the method is empty?
Take a look at the code below, this is an excerpt from AsyncTask and can ...
26
votes
5answers
3k views
Dynamic Code Evaluation in Java - Clever or Sloppy?
I am trying to create a flexible ACL framework in Java for my application.
Many ACL frameworks are built on a whitelist of rules, where a rule is in the form of owner:action:resource. For example,
...
1
vote
2answers
238 views
A 'task' system which has an ending, to get ready for next task
I want to make a system, so that there are certain tasks. For example, let's talk about a game. I want to make it so there are 100+ tasks doing different things, but when the player's magic level is ...
0
votes
2answers
217 views
How to manage data flow between UI components?
I have been trying to use classes that implement ActionListener to respond to user input. I'm consistently noticing that for an action listener to communicate the event to other objects, it has to ...
0
votes
0answers
34 views
Spring Boot Hibernate and JSR 303 - response formatting
Sifting through forums I can't seem to stumble into an issue solution I've been haveing with Spring Boot + JPA and JSR303 bean validation.
Simply put validation works but but when say
...
0
votes
0answers
52 views
How to create methods at runtime for scripting purposes? [on hold]
!!! There's a TL;DR question at the bottom of this !!!
I'm looking into writing a Java API that developers can implement that will allow users to write their own scripts that can interact with a ...
2
votes
1answer
257 views
DataMapper for a MMO game plugin to send packets
I am working on an plugin for some game-server. The information about the plugin is not really necessary.
Few points you might find helpful to answer to this question:
The server
The server is ...
-3
votes
1answer
74 views
Creating multiple houses in Java? [on hold]
everyone!
I created a program that would draw a house in Java, which is:
import java.awt.*;
import java.applet.*;
// Program to draw a house
public class House extends Applet
{
public void ...
-1
votes
0answers
84 views
Error: Code too big for 64k [on hold]
Im having a bit of an issue with a simple program I'm trying to build.
Im using an IDE to code a program I wish to turn into an app in a few months.
After 7500 lines of code I receive and error ...
1
vote
1answer
73 views
Non-fixed-size Fenwick Tree implementation
I'm planning to implement a non-fixed-size Fenwick tree. That is, a Fenwick tree that allows interleaving range queries with adding/removing elements.
All implementations and samples I've seen so far ...
1
vote
2answers
81 views
Pattern for validating rules having different signatures
I have a class in charge of responding to an input event and maybe triggering another event. To decide, it has several rules to check.
I'm trying to get away from a class looking like this:
public ...
0
votes
0answers
4 views
Java j2ee JSTL cannot print a list of objetcs [migrated]
i'm currently working on a small Java J2E project.
I want to print a list of objects in a *.jsp page, but there's an error i can't seem to get rid of.
My .jsp page :
<%@ page language="java" ...
-3
votes
0answers
52 views
Generate random numbers in java…! [on hold]
I'm writing a code for a command line game in which I want to shuffle numbers randomly.
i created 3 different functions. Each function generates a number different from other.
and those 3 functions ...
0
votes
2answers
427 views
Is factory pattern a right pattern for the situation described here?
Is factory pattern a right pattern when we want to consolidate the related objects?
Problem - In the Set-top box, I have a user-io, basically the interface to control the settop box - The user-io can ...
-2
votes
0answers
14 views
Java Robot class highlighting text help [migrated]
I'm trying to write a program that copies text from TinyChat(https://tinychat.com) and copies it to the clip board. Eventually it will take everything said in chat and paste it in Skype. Every message ...
2
votes
2answers
105 views
When to use ANTLR and when to use a parsing library
I've always wanted to learn how to write a compiler - I've decided to use ANTLR, and am currently reading through the book (its very good by the way)
I'm pretty new to this, so go easy, but the jist ...
0
votes
1answer
80 views
Architecture for my Java application [on hold]
I try to create small Java tools to help me at my work every now and then. Usually these do not have to be pretty and I find myself coding a single, sometimes massive, Java class. However, now my plan ...
1
vote
1answer
160 views
Debugging xml and annotations
By now, most web containers have an annotation variant of their xml configurations for Java EE. I'm guessing this is because it's better to keep things in Java where they can be managed, coded with ...
0
votes
1answer
406 views
Dynamic query in MySQL
I'm doing a J2EE web application with Struts2, MyBatis and a MySQL database, so what I want is to allow the user to be free to choose different parameters to perform a select to a table in the ...
2
votes
1answer
63 views
Advantage of Declaring and Initializing Different Object types?
I am learning how to use java to program, and am just learning about abstract classes and how they are useful.
Say I have a class which extends another abstract class, which has 2 methods, one of ...
-2
votes
0answers
30 views
Is there a CMS that can be hosted online but is merely a backend for a desktop application? [closed]
All the CMS's I've used and read about are geared toward building websites. I need to make a desktop application that connects to and grabs data and settings from a CMS-backed online source. There ...
1
vote
1answer
219 views
Is this database design good? What JPA Entities should I create for this design?
I am trying my hands on JPA. For this I am thinking of using the example of a student admission process as shown in the diagram below.
Is this design good ?
Any suggestions for improvement are ...
0
votes
0answers
52 views
What are the different types of whitespace referred to by Perl? [migrated]
I am trying to find the Java equivalents of the Perl regular expressions not supported by Java. These are, as listed in the Java Documentation:
\h A horizontal whitespace
\H A non horizontal ...
1
vote
1answer
36 views
DataThread class that doesn't extend Thread, poor naming?
I created a DataThread class that doesn't extend a Thread, but has one as a member variable.
Favor composition over inheritance, is a rule that I heard of, but I am thinking that the name of the ...
-2
votes
0answers
36 views
Get from object or use variable [closed]
Which one is better
//somewhere here i have Test test = new Test(); object
String name = "default";
if(test.getName() != null) name = test.getName();
or
String name = "default";
String ...
0
votes
0answers
35 views
what is the relationship between CORBA, JMS and MDB?
In the context of my previous fuzzy question on microservices, please help me break down the terminology involved in these technologies:
CORBA
JMS
MDB
Utilizing JNDI, I believe it's possible to do ...
-1
votes
1answer
31 views
What's the best way to implement a real time show board to show results from concurrent result producers in Java?
I'm making a load test tool that launches multiple thread to simulate load on the target server. Each thread executes a predefined set of commands in the structure of TestSuite - TestCase- TestStep ...
0
votes
2answers
59 views
How is the best way to work with step by step documentation to software maintenance [closed]
I'm working on a web project in java and I have a problem with the documentation we are making.
The goal is to has step by step how to do some basic stuff for system maintenance, like add fields to a ...
-2
votes
0answers
42 views
Java Web Framework for Functional Reactive Programming [closed]
Given Java intricate relationship with web applications it appears to have shaped the design applied to how developers create web based applications. From Java 1 through Java 7 from around 1999 the ...
8
votes
6answers
867 views
Static functions vs classes
Let's say that I want to build some utility functions to do some basic maths with the BigDecimals, for example I want to have a function that computes the average of a List<BigDecimal>.
What is ...
2
votes
0answers
115 views
Testing a method that reads from standard input and outputs to standard output [migrated]
I have a method which reads lines from standard input and outputs them to standard output. In a JUnit test, how can I have it send standard input to the method and how can it make assertions about the ...
4
votes
1answer
184 views
Is it possible to use the Android layout system in a desktop java application?
I am lazy, thus, if possible, I would like to only have to design and program a UI once. If I want to create an App for Android and as a basic Java desktop application, is there a way to reuse the UI ...
-3
votes
0answers
30 views
Multiple URLmapping using annotation not working in servlets [closed]
I am using an annotation like this :
@WebServlet("/Document/*")
and trying to redirect using sendRedirect
response.sendRedirect("Document/manpreet121FECF23A-D4D2-E411-BEC4-FCDD55FFFFFF");
I get ...
-3
votes
0answers
99 views
How much programming should I know at the age of 17? [closed]
I love programming, I will study computer science in college, I am a junior in high school right now. I want to work for big IT companies such as Facebook, Google, Dropbox, Apple.. I want to have a ...
1
vote
3answers
97 views
What is the best way to store and use an application level runtime parameter? [closed]
I have to design a java console application which accepts a runtime parameter as an argument to the main method. The application will be eventually used by multiple scripts. I would prefer to avoid ...
-2
votes
0answers
40 views
Printing out 2d arrays which contain null values (java)? [closed]
I'm very new to Java and was wondering if there was a way to print out a 2d array which contains null values, but instead of writing null it just prints a space.
My code so far is:
for(int i=0; ...
-3
votes
0answers
24 views
Setting up Struts 1.x in eclipse EE luna [closed]
I need to set up Struts 1.x in Eclipse. I looked into a previous post in the link below . In one the the answers the link given is dead. The website where that tut is does not work
...
5
votes
1answer
181 views
Sometimes, “programming to interfaces” introduces possible (and avoidable) runtime exceptions?
Please consider the com.google.common.collect.ImmutableMap
Programming to its interface, Map , creates a bug that could blow-up in the runtime as such:
Map<String, Integer> myMap = ...
2
votes
2answers
90 views
Immutable vs Read-only vs Unmodifiable naming difference
So, I've looked at some similar questions asked here in regards to how these three should be used in naming. Usually, the answer is something along the lines of "it's conventional" and "just be ...
-2
votes
0answers
55 views
interoperability java and c++ [duplicate]
i want to write a program in two different languages java and c++ that needs a dynamic and interactive communication between its c++ component and java component.i know there is jni and jna for ...
-9
votes
0answers
78 views
How do I translate my source file to Java bytecode? [closed]
I'm creating a new programming with JavaCC which is the parser. I want the parsed data to be translated to Java bytecode and compiled to Class file which later will be executed by JVM
Edit: I'm a ...