r/javahelp • • Oct 12 '25

Need help with running via console

Hi!

I wanna build a little game in Java. The problem is I can’t run/compile project via console

I usually use “java/javac Main.java” to run code. But when I use more than 1 source file it just doesn’t work. I tried compiling it as JAR, but when I ran it, it said it lacks some Manifest I know nothing about.

I know only very basics of Java. So asking here.

Thanks in advance

P.S. Compiling via console is one of the main points of this project. So, no, I can’t just use IDE

2 Upvotes

6 comments sorted by

View all comments

Show parent comment

1

u/ScaryGhoust Oct 13 '25

I just wanna fully understand how it works under the hood — fully enough to be able to compile/run it by hands.

Btw, I’m coming from C++. So it’s highly likely might be an old habit, that dies hard.

Before starting using C++, I’ve learnt pretty basics of Java. Now I wanna compare them and see if Java is easier for gamedev.

And about project managers, I use Makefile. (Again it’s old habit from C++). But maybe I’ll give Maven or other managers a try.

When I was learning Java, I was using IntelJ IDE. Why do I use just text editor (I use Kate, to be exact) now? I like controlling everything. For me, personally, using IDE feels like using wheelchair, while being able to walk on my own.

2

u/OneHumanBill Oct 13 '25

Ah, that makes a lot of sense. Sort of.

A lot of times when I'm teaching Java to a class or mentoring a brand new user, I'll have them do their initial Hello World in a text editor and use javac by hand for this very reason. You're right in that everybody should understand what's going on behind the scenes. But there's very rapidly diminishing returns for continuing to do it by hand after one file.

Makefile is not your friend in this. At all. Java projects have evolved over time to fit standard project layouts (standard Maven) that are repeatable, with tooling that operates on a declarative basis rather than trying to wire up javac instructions. I could have hundreds of Java files in a project and dozens of third party dependencies and the Maven pom file will not be very large or complex compared to how finicky the equivalent makefiles would have to be. And then when you have dozens of Java projects to manage, they all work the same, and you work with build artifacts in a very standardized way in a Maven repository, you're going to not want to live in your build tools. Especially if you want to do game dev, these aren't conveniences, they're essentials. (Btw even if you're using Gradle you're still using Maven standard everything. Gradle is really just for people with severe allergies to XML.)

In early days of Java back in the 90s I used makefile because there wasn't anything else. Then I used Ant because it was a lot better. But Maven was a quantum leap forward. Nobody uses even Ant anymore. You're doing yourself a huge disservice to try to wire the javac commands yourself; there's zero advantage to knowing how the increasingly complex build instructions are wired together.

For IDEs, think of them less as a wheelchair and more of a bicycle. If you're in a very bicycle-friendly city, would you walk? You could but you'll always be at a disadvantage to the people who can change gears and let their tools free them up for more strategic thinking. And as I said before, an interactive debugger is essential once you start getting deep into complex code, particularly when it's third party code. The third party library ecosystem is vastly larger in the Java world than in C++, so you'll need to adjust your thinking on this. Also? I don't like IntelliJ because I don't think it gives you enough control. You might take better to using Eclipse like me. (Also it's much less a memory hog.). You do not want to rely on your ide for build pipelines but like I said, they will work very nicely with Maven so you can achieve IDE independence while still getting the advantages of an IDE.