Java

Java (not to be confused with JavaScript or JScript or JS) is a general-purpose 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.

48 votes
8 answers
432 views
jdbc: Get the SQL Type Name from java.sql.Type code

I have an array with Field Names and jdbc Type codes. (Those int codes that you can find in http://download.

avatar
Clarice
0 1 0 9
asked 07 September, 2021
57 votes
6 answers
1.5K views
Using a java library from python

I have a python app and java app. The python app generates input for the java app and invokes it on the comman

avatar
Solomon
0 1 0 9
asked 07 September, 2021
52 votes
4 answers
812 views
How can I install various Python libraries in Jython?

I know that I can install Jython with Java and that I can use Jython where I use Python. The Jython shell is w

avatar
Wilfredo
0 1 0 9
asked 07 September, 2021
56 votes
3 answers
601 views
log4j with timestamp per log entry

this is my log output INFO main digestemails - process inbox INFO main digestemails - checking for emails in

avatar
Corey
0 1 0 9
asked 07 September, 2021
67 votes
12 answers
1.3K views
Calling Python in Java?

I am wondering if it is possible to call python functions from java code using jython, or is it only for calli

avatar
Clarice
0 1 0 9
asked 07 September, 2021
59 votes
12 answers
1.9K views
Even though JRE 8 is installed on my MAC -" No Java Runtime present,requesting to install " gets displayed in terminal

Even though JRE 8 is installed on my MAC OS Yosemite 10.10.3,while running the Android present in tools in

avatar
Keith
0 1 0 9
asked 07 September, 2021
55 votes
16 answers
343 views
JAVA_HOME is set to an invalid directory:

I have set JAVA_HOME in my system C:\Program Files\Java\jdk1.8.0_ 131\bin; and I am trying to run cordova comm

avatar
Fabian
0 1 0 9
asked 07 September, 2021
54 votes
6 answers
767 views
javax.websocket client simple example

Can someone please provide me very simple example of websocket client using javax.websocket? I want to connec

avatar
Boyd
0 1 0 9
asked 07 September, 2021
53 votes
7 answers
2.5K views
How to use Servlets and Ajax?

I'm very new to web apps and Servlets and I have the following question: Whenever I print something insi

avatar
Frederick
0 1 0 9
asked 07 September, 2021
55 votes
20 answers
2.9K views
How to print binary tree diagram in Java?

How can I print a binary tree in Java so that the output is like: 4 / \ 2 5 My node: public cla

avatar
Alba
0 1 0 9
asked 07 September, 2021
59 votes
14 answers
2.2K views
Get keys from HashMap in Java

I have a Hashmap in Java like this: private Map<String, Integer> team1 = new HashMap<String, Integer

avatar
Daniel
0 1 0 9
asked 07 September, 2021
50 votes
6 answers
3K views
Why should I use Deque over Stack?

I need a Stack data structure for my use case. I should be able to push items into the data structure and I on

avatar
Omar
0 1 0 9
asked 07 September, 2021
56 votes
19 answers
1.5K views
Why doesn&apos;t java.util.Set have get(int index)?

I'm sure there's a good reason, but could someone please explain why the java.util.Set interface lac

avatar
Kisha
0 1 0 9
asked 07 September, 2021
56 votes
18 answers
1.7K views
How to convert List to Map?

Recently I have conversation with a colleague about what would be the optimal way to convert List to Map in Ja

avatar
Benton
0 1 0 9
asked 07 September, 2021
56 votes
26 answers
1.7K views
How to detect a loop in a linked list?

Say you have a linked list structure in Java. It's made up of Nodes: class Node { Node next; //

avatar
Shantay
0 1 0 9
asked 07 September, 2021
50 votes
24 answers
694 views
How to implement a tree data-structure in Java?

Is there any standard Java library class to represent a tree in Java? Specifically I need to represent the fo

avatar
Chaya
0 1 0 9
asked 07 September, 2021
60 votes
30 answers
519 views
How can I convert a stack trace to a string?

What is the easiest way to convert the result of Throwable.getStackTrace() to a string that depicts the stackt

avatar
Lashawna
0 1 0 9
asked 07 September, 2021
53 votes
30 answers
1.9K views
What does "Could not find or load main class" mean?

A common problem that new Java developers experience is that their programs fail to run with the error message

avatar
Xavier
0 1 0 9
asked 07 September, 2021
60 votes
30 answers
685 views
How do I create a Java string from the contents of a file?

I've been using the idiom below for some time now. And it seems to be the most wide-spread, at least on t

avatar
Vi
0 1 0 9
asked 07 September, 2021
55 votes
30 answers
1.8K views
How to fix java.lang.UnsupportedClassVersionError: Unsupported major.minor version

I am trying to use Notepad++ as my all-in-one tool edit, run, compile, etc. I have JRE installed, and I have

avatar
Trudy
0 1 0 9
asked 07 September, 2021