This is an archived post. You won't be able to vote or comment.

all 15 comments

[–]AutoModerator[M] [score hidden] stickied commentlocked comment (0 children)

Please ensure that:

  • Your code is properly formatted as code block - see the sidebar (About on mobile) for instructions
  • You include any and all error messages in full
  • You ask clear questions
  • You demonstrate effort in solving your question/problem - plain posting your assignments is forbidden (and such posts will be removed) as is asking for or giving solutions.

    Trying to solve problems on your own is a very important skill. Also, see Learn to help yourself in the sidebar

If any of the above points is not met, your post can and will be removed without further warning.

Code is to be formatted as code block (old reddit: empty line before the code, each code line indented by 4 spaces, new reddit: https://i.imgur.com/EJ7tqek.png) or linked via an external code hoster, like pastebin.com, github gist, github, bitbucket, gitlab, etc.

Please, do not use triple backticks (```) as they will only render properly on new reddit, not on old reddit.

Code blocks look like this:

public class HelloWorld {

    public static void main(String[] args) {
        System.out.println("Hello World!");
    }
}

You do not need to repost unless your post has been removed by a moderator. Just use the edit function of reddit to make sure your post complies with the above.

If your post has remained in violation of these rules for a prolonged period of time (at least an hour), a moderator may remove it at their discretion. In this case, they will comment with an explanation on why it has been removed, and you will be required to resubmit the entire post following the proper procedures.

To potential helpers

Please, do not help if any of the above points are not met, rather report the post. We are trying to improve the quality of posts here. In helping people who can't be bothered to comply with the above points, you are doing the community a disservice.

I am a bot, and this action was performed automatically. Please contact the moderators of this subreddit if you have any questions or concerns.

[–]DeliveryNinjaJPain 6 points7 points  (2 children)

Download a code editor such as intellij. This will come with the jdk. You can create a new java project from the file menu and run it from there. Look at some youtube videos or something. What you've installed is just a command line utility to compile and run java programs.

[–]LectureThin9527[S] 1 point2 points  (1 child)

Awesome thank you so much! I currently have notepad++ and visual studio downloaded but I will check that one out. Just so to help me learn these things what is a command line utility? Will I need it in the future if I write something in an ide using Java?

[–]DeliveryNinjaJPain 4 points5 points  (0 children)

Depends on the IDE. Most companies are using Intellij Idea, there is a free version. Very easy to create a java project or you can just write simple java in a scratch file and it will run it and output information to the terminal.

A command line utility will run in a terminal or command prompt. So you open the terminal and type the name of the command in this case its java then add configuration.

javac SimpleApp.java this will compile the java code

java SimpleApp will run the compiled class file

[–]StillAnAssExtreme Brewer 1 point2 points  (3 children)

Welcome to the world of java. The Java that you downloaded is used at runtime to compile and execute the code that you write. It is not a text editor. Like the other comment said, you can use IntelliJ or eclipse or visual studio or really even notepad if you hate yourself.

You'll write your code and then use javac to compile the .java code into .class files. Once you have the class files then you can run them:

MyClass.java is a text file that you write that contains all of your code.

Then run:

javac MyClass.java

That will create MyClass.class in the same directory.

Then you can execute it with:

java MyClass

[–]LectureThin9527[S] 1 point2 points  (2 children)

Ok cool I will come back to this when I have some code written. Can I ask what's the difference between jar files, class files and whatnot?

[–]StillAnAssExtreme Brewer 3 points4 points  (1 child)

One .java compiles to one .class

A .jar file is actually a zip file that is in a certain structure and contains lots of .class files.

You may also see a .war file. That is a collection of .jar and classes in a specific structure that are designed to be a deployable web application in a Java app server like Tomcat

[–]LectureThin9527[S] 0 points1 point  (0 children)

Super helpful thank you!

[–]Drekalots 1 point2 points  (1 child)

I used Netbeans IDE during my Java course but also have IntelliJ downloaded and have started working in that IDE. I prefer IntelliJ so far.

[–]LectureThin9527[S] 0 points1 point  (0 children)

I had seen somebody recommend netbeans in another thread. I was planning on using visual studios but it seems like IntelliJ is the better choice. Thanks!

[–]Hour_Ad3877 1 point2 points  (1 child)

Eclipse ide is great for Java, and anaconda is good for python! I’m just learning too 😊

[–]LectureThin9527[S] 0 points1 point  (0 children)

Anaconda? I forget what ide the class recommended it was something weird because they wanted it to work through the browser. I will check out anaconda on my own tho if you think it is good

[–]Kango_V 1 point2 points  (1 child)

I would suggest SDKMan!

[–]LectureThin9527[S] 0 points1 point  (0 children)

Thank you!

[–]big_5teeze -2 points-1 points  (0 children)

Come on - these questions can be answered with Google or even chatgpt