Oops, I ran an application in java, now I need to get the .jar executable. How do I get .jar in VS Code?
Oops, I ran an application in java, now I need to get the .jar executable. How do I get .jar in VS Code?
Hello, you can use the command:
jar cf jar-file input-file(s)
Where input-file (s) are the classes you want in jar. The visual code has a built-in terminal.
If you have an updated version of Visual Studio Code you can set it to task.json
.
First you need to create a "project folder", click the Add workspace
button, as in the image:
java-teste
It will generate a default template like this:
{
"version": "2.0.0",
"tasks": [
{
"label": "echo",
"type": "shell",
"command": "echo Hello"
}
]
}
You can customize and add javac
to create .class
and then jar cf <nome do jar>
to create .jar
Note that .jar
is not an executable, but rather a package, as if it were an installer or something, if what you want is just run your script you can install an extension, follow one that is made for this :