Questions tagged [java]

Java is both a popular object-oriented programming language and runtime environment which allows Java programs to run unchanged on most hardware and software platforms.

java logo

Initial help

Before asking a question, use the search box in the upper right corner to see if it has been asked before by others (we have many duplicates), and please read Writing the perfect question to learn how to get Jon Skeet to answer your question.


Background

Java is a high-level, platform-independent, object-oriented programming language originally developed by Sun Microsystems and released in 1995. Java is currently owned by Oracle, which purchased Sun on April 20, 2009.

Very few computers can run Java programs directly. Therefore the Java environment is normally made available by installing a suitable software component. For Windows computers, this is usually done by downloading the free Java Runtime Environment (JRE) from Oracle which allows the system to run Java programs. The easiest way to do this is from java.com.

Developers frequently need additional tools which are available in the free Java Development Kit (JDK) alternative to the JRE, which for Windows must be downloaded from Oracle and installed manually.

Note: Other vendors exist but usually have license fees. For Linux and other platforms consult the operating system documentation.

More information:

Java source code is compiled to an intermediate form (bytecode instructions for the Java Virtual Machine) that can be executed with the java command.

Beginners' resources

  • The Java Tutorials - Starts from scratch on Windows/Linux/Mac and covers most of the standard library.

Day to day resources

Advanced resources

3431 questions
21
votes
2 answers

How can I define items in my RPG like Java game?

I am casually working on an RPG type game in Java but I am having trouble figuring out how I can have items that can do many different things without creating a different class for every item. As an example, how would I create an Axe that could chop…
MESLewis
  • 499
  • 1
  • 5
  • 13
12
votes
5 answers

Is there an XNA-like library for Java?

I'm curious to know if there is an XNA-like library for Java; that is, a library that Handles the game loop - i.e. you just implement an existing method, and it will get called every frame. Handles the rendering - i.e. you just tell it what to…
Oak
  • 1,242
  • 12
  • 20
7
votes
2 answers

Where can I find some beginners to learn and work with?

I am very new to game programming. I am currently studying Java (Android mainly) and I know what it takes to make a game, as well as how to render it via OpenGL. Finding some others at nearly my level I think would motivate me more and give me some…
user8911
  • 11
  • 1
6
votes
5 answers

Has Java 3D changed much since 2005?

I'm thinking of picking up the book called "Killer Game Programming" by Andrew Davidson, but its pretty old, now. I know Java, and I've been messing with jMonkeyEngine for a few days, but I'm curious to see if I would benefit from the 3D chapters of…
shadowprotocol
5
votes
3 answers

Is this really the reason for smoother movement?

Actually i'm watching a tutorial series on youtube about 2D Game programming in Java. My question is about the player-movement. The first version: public void keyPressed(KeyEvent e) { int key = e.getKeyCode(); if(key…
user3146246
  • 85
  • 1
  • 2
  • 5
5
votes
2 answers

Separate loops for logic (tps) and rendering (fps)

I'm converting a game that was using a very basic game loop that executed update/render methods 20 times per second to lwjgl. I'm using the fps loop examples in their wiki, but have found that while this is great for rendering, it's not where I…
BotskoNet
  • 919
  • 1
  • 12
  • 36
5
votes
3 answers

Why is Canvas used more than JPanel for making games in Java?

I saw many Ludum Dare games, which are written in Java (using its standard library). I checked the code of one or two of them and the thing that I saw is in their Game class, they extend Canvas. So my question is why would they extend Canvas, not…
sn0k3
  • 59
  • 1
  • 3
4
votes
3 answers

How to give delay in java

I wan tto give delay in java without using thread. I need to load images one by one with approx half second delay. Is there any way to do this other than thread because if I am using thread my whole game is going into the sleep mode.
Muhammad
4
votes
1 answer

Collision Code Organization

Im making a game in java as a hobby and ive reached a part where i have a few game elements which i want to have collision. Since im using a tilemap, the collision with the wall tiles is pretty simple and since every game element has a pointer to…
Xkynar
  • 601
  • 5
  • 16
4
votes
2 answers

Graphics card settings tampering with my Java game

I'm working on a simple 2D side scrolling platform game in java. It is a canvas with a bufferstrategy which is placed inside a jframe, and that jframe is set as the fullscreenwindow on the graphics device. Now my computer has a decent nvidia card.…
Lord Exin
  • 51
  • 3
4
votes
1 answer

Implementing a hook (Like pudge in Dota)

I'm coding a new game, which involves hooking. Ive been testing a couple of ideas now and im quite stuck. The player can throw a "hook" which fires away in the aimed direction, until it hits something, it will bounce on some obstacles and will…
najk
  • 41
  • 3
4
votes
2 answers

How can I generate random meaningful words in a typing game?

I want to make a typing game where users have to type the words displayed on the screen. But I don't know how to generate meaningful English words not gibberish. What technique can I use to achieve this?
anonymous
  • 514
  • 1
  • 8
  • 21
4
votes
0 answers

Why aren't my pieces rotating on my chess board in Java?

I am developing chess game in Java using the Netbeans IDE. Instead of rotating the whole board at each move, I thought of changing position of the pieces themselves, while the board remains same. All my pieces and squares are JLabels and are in a…
4
votes
3 answers

Is using two languages in a game engine a good idea?

I'm thinking about making a game engine, as a learning project. I know Java the best, and I figure most of the code is not going to be running that much of the time, given the 20/80 rule. Why not write most of it in a language I know? For the part…
Ryan Stull
  • 473
  • 4
  • 8
3
votes
1 answer

Dynamic object creation with HashMap

I want to use a HashMap to dynamically create objects based on the key. I have a Random Map Generator that stores the maps in 3D Arrays of Type Integer[][][]. Upon creation of the actual map I iterate through this array and based on the Integer I…
Salor
  • 31
  • 1
  • 2
1
2 3
11 12