java -xmx1024m -xms1024m -jar minecraft_server.jar nogui

Discussion in 'Linux' started by securityhope, Sep 18, 2016.

  1. securityhope

    securityhope Administrator Staff Member

    Aug 3, 2016
    Likes Received:
    Trophy Points:
    Java Programming Exercises?

    I am fairly new to java coding. I took a camp for two weeks during the summer, and I learned stuff like loops, constructors, arrays, if statements, etc. Basically it was all in the console, I never actually learned how to make a program. I was wondering if any of you guys had any cool little exercises I could do to enhance my Java knowledge. (This includes things that I may have to research to be able to code).

    Just an example - I felt like I would make a Hi-Low game.

    import java.util.Scanner;
    public class Test {
        public static void main(String[] args) {
            Scanner input = new Scanner(;
            Random generator = new Random();
            int num1 = generator.nextInt(9)+1;
            int num2 = generator.nextInt(9)+1;
            int num3 = generator.nextInt(9)+1;
            int num4 = generator.nextInt(9)+1;
            int right = 0;
            num1 = num1*1000;
            num2 = num2*100;
            num3 = num3*10;
            int code = num1 + num2 + num3 + num4;
            System.out.println("Lets play High-Low");
            while(right == 0){
                System.out.println("Guess a four digit number");
            int guess = input.nextInt();
            if (guess < code){
                else if (guess > code){
                else if (guess == code){
                System.out.println("You win! The code was " + code + "!");
                right = 1;
    Yeah I hope that was as almost as efficient as I could have done it, but any ideas? I'm kind of out of them, and I keep seeing people recommend projects that actually run as programs like a file explorer, and I don't know how to do those.


    Well first of all, Welcome to the community! But regarding your question there are many exercises you are able to do. For example, if you are willing to spend some money, the book "Java for Dummies" (make sure it is the all-in-one version) has many tutorials for creating a working program ('pong' game clone, image viewer, drawing board program). If you don't want to spend the money I suggest Udemy ( It has many great courses for the question you are currently asking.

    Hope it will help :)

    Java on Ubuntu server 12.04?

    I'm a little confused at the moment.

    My back story in short, is that I'm trying to set up a Minecraft server on an Ubuntu server I've recently set up, obviously to do this I needed Java, but after googling for a short while I wasn't entirely sure whether it is possible (or legal?) to do so in Ubuntu 12.04 due to licensing type issues - so I installed open JDK instead which appears not to work properly with the Minecraft server software (I half expected this)

    I'm now considering uninstalling open JDK and instead trying to get proper Java on there instead, my question is, is this possible? Is it Legal? And if so how do I go about doing it? Because I'm finding it very difficult to find any instructions on how to do so for 12.04 . . .


    The legal problems you are referring are about the distribution of Oracle Java. Its license prevents that it could be provided in the default repositories, but its perfectly legal to download and install it.

    Probably the easiest way is to use the WebUpd8 ppa:
    sudo add-apt-repository ppa:webupd8team/java
    sudo apt-get update
    sudo apt-get install oracle-java7-installer
    This will run a script that will download and install Oracle Java 7 (JDK) from the official website, so it is perfectly legal.

    If you just want JRE the best way is probably download and install it manually from Oracle website.


    Are "PPA's" safe to add to my system, and what are some "red flags" to watch out for?

    Ubuntu. Oracle Java 7. Install the Oracle JDK 7.

    Install the Oracle JRE 7.

    Install the Firefox/Chrome Oracle Java 7 plugin


Share This Page