So, I'm making RuntDeale, and I tried compiling a test I made, it compiled with no (visually displayed (as they WOULD be, if there were any)) errors, and it creates the .jar
file, but when I double click it, it doesn't run (or rather, does not do what it's supposed to do (which is to create a window with the title "RuntDeale
", that has a black background, and is NOT resizable)).
So, I try running tests where I know how to test best, VSCode, and, this time, I do see an error. Specifically:
Exception in thread "main" java.lang.Error: Unresolved compilation problem:
at RuntDeale.code.Main.main(Main.java:44)
Main.main(String[] args)
looks like this:
public static void main(String[] args) {
Main program = new Main();
try {
program.run();
} catch(Exception exc) {
program.setTitle("Exception: "+exc.getLocalizedMessage());
}
}
I only really have one theory, that it (for some reason) can not resolve the class RuntDeale.code.Backpack
(which is just meant to be something to help me save time, so I don't have to rewrite code).
If any additional information is needed, please ask, but please, tell me what you think the problem is.
Thanks
Cheers!
Cheers!
Top comments (28)
Maaaan, I can't believe I even considered Java for this.
I'm so glad I moved this project to Rust.
off-topic question have you tried using JavaFX instead of Swing? and what type of game are you trying to make?
Just looked at the example code, and dear God, what the fuck is that library!?
It looks like the Java equivalent of TKinter, and I switched to Java because TKinter was complicated (but also mostly because Python is slow, and not compiled).
Fair enough. There are game libraries for python which also take care of creating a runnable executable.
I'm trying to make a game like Undertale. And no, I haven't, because I've never heard of it.
I don't think the slowness of a programming language would matter for a game like Undertale. What game libraries have you tried so far? (doesn't matter if it is Java or Python)
Actually, to me, speed matters for performance maximization.
Plus, that isn't the only reason I left, I left because I also wanted the language I'm using to be compiled, and I also wanted the language to be strongly typed (to save me a hassle in debugging).
Libraries for what, Python?
PyGame (which fucking sucks ass).
And TKinter (which works well, but is exceptionally complicated, and underpowered).
One reason I wouldn't use Java for gamedev, is that it requires the user to install the Java runtime.
If your main priority is speed and performance, I would suggest looking at either C++ or Rust. Both have a steep learning curve, but I am sure that you will benefit from them in your career as a game developer.
Wouldn't Rust require you to install something as well (since it doesn't sound like a native language)? Is it compiled? And will the compiled product work on all devices, like it would Java or C#?
Also, again, I said I'm bad with tools, and tried dipping my toes into C#, but I can't even figure out how to compile my
.cs
file with .NET through Command Prompt, like I do Java.When you compile your game, a statically linked binary will be created. This means end-users will not have to install anything.
Yes, and it is the fastest language out there (just behind C/C++)
You just have to compile for each platform you need to target.
The best thing about Rust is Cargo which is a modern package manager / build tool that just works™.
If you're interested, check macroquad which supports Windows, macOS, Linux, Android, iOS and HTML5.
Regarding question three's answer, is there ANY way I don't have to recompile for EACH platform, is there like some "master-platform" compilation?
If not, how do I compile for a specific platform? And can I merge the binaries in to one whole so that they will work on any device when installed?
What people usually do is to setup CI/CD pipeline that automatically builds the project for each target when a new release is made.
For example, you can see in the assets section of this project, the different binaries that target different platforms.
However, you could always write a script to do this step locally. Take a look at rust-lang.github.io/rustup/cross-c...
I believe having a seperate binary for each platform, will lead to smaller and faster binaries.
A lot of this confused my since I hate (am not friends with (never got to know)) external tools outside of compiling. Wjy can't it just be Files -> Compiler => Product, instead of all this extra vomplex BS??
Though, thanks for the advice, I'll try to look in to it further, and see if I can learn anything.
Adding line numbers would help.
I thought about this more, since I'm awake now, and, line numbers are (implicitly) shown, line 44 to 51. What do you want me to do, add the rest of the
Main
class, and number that?Not sure where it did say the code started at line 44 initially but erm. Having every line numbered is the way to make it easier for people to help you. Screenshot would be fine imho.
Is this good? This is all of
Main.java
:Ha. Perhaps it is. I'll have a quick look tomorrow.
Do you not have teachers or colleagues to help with your stuff?
I don't have teachers, I'm 14, and don't have any classes pertaining.
Also, I live alone (excluding family), so I don't really have colleagues either.
So no, sadly.
If you feel like, drop by here: discord.gg/Y4MJgc244A
If you introduce yourself in general, it's mostly a tiny coder hideout I run.
The line number was shown (44)?
Probably missed this.
Did you solve your problem?
No, not yet.
Somewhere on SO: "Either way a sequence of refresh and clean build [...] should surface the problem".
I think there's a little flair to this. Errors where the compiler doesn't know what the error is are more often some refresh issues like happens when sources have moved/been repackaged perhaps creating dupes and so forth.
They were both created in the same package initially, and still are(?).
Well, doing a full refresh is more a thing to try than to reason with, unless the problem becomes chronic.
Full refresh?
What? How? Where(?)?