How do I make a .jar file?

Hello, I want to learn java, and I got a book for it. Now, the book doesn't cover how to make a .jar file (i think), so how do i make one?
16 Replies
JavaBot
JavaBot6d ago
This post has been reserved for your question.
Hey @MrTomiCZ! Please use /close or the Close Post button above when your problem is solved. Please remember to follow the help guidelines. This post will be automatically marked as dormant after 300 minutes of inactivity.
TIP: Narrow down your issue to simple and precise questions to maximize the chance that others will reply in here.
dan1st
dan1st6d ago
Are you using a build tool? Are you using an IDE? What do you want to create a JAR file for?
MrTomiCZ
MrTomiCZOP6d ago
no, no, System.out.println("Hello, World"); im just starting only thing i know is jshell
dan1st
dan1st6d ago
Then why do you want to create a JAR file?
MrTomiCZ
MrTomiCZOP6d ago
so i have an exec utalbe executable*
dan1st
dan1st6d ago
If you are just writing hello worldapplication, you probably don't want to deal with JAR files right now. But the first step is putting your code in a .java file and then you can execute it with java YourJavaFile.java
MrTomiCZ
MrTomiCZOP6d ago
so i just put the raw code there? or how
dan1st
dan1st6d ago
You'd create a main class and put your code there But if the book you are using starts with jshell, it should be included at some point there
no shower
no shower6d ago
public class test {
public static void Main(String[] args) {
System.out.println("teset");
}
}
public class test {
public static void Main(String[] args) {
System.out.println("teset");
}
}
like this
This message has been formatted automatically. You can disable this using /preferences.
MrTomiCZ
MrTomiCZOP6d ago
right
dan1st
dan1st6d ago
if your file is called test.java, almost
MrTomiCZ
MrTomiCZOP6d ago
it is
dan1st
dan1st6d ago
the method needs to be called main, not Main
MrTomiCZ
MrTomiCZOP6d ago
yeey it works and i got argumentsss yeey thanks
JavaBot
JavaBot6d ago
If you are finished with your post, please close it. If you are not, please ignore this message. Note that you will not be able to send further messages here after this post have been closed but you will be able to create new posts.
JavaBot
JavaBot6d ago
Post Closed
This post has been closed by <@818109259048157226>.

Did you find this page helpful?