Hey everyone, im pretty new to the java scene but I have a really quick question that hopefully someone can help me with.
I'm really interested in making a .jar file out of my code. And basically I just want to make one. but i understand there are certain things like main class's, etc. that need to be made in order to make a .jar file.
So, for instance, say I create a new project.
I create 1 new class called "HelloWorld"
I open that up and type this code:
class HelloWorld {
public static void main (String[] args)
{
System.out.println("Hello World");
}
}
I compile that. But now i want to make a.jar file.
I went to project> create .jar file, and it was made.
but i go into it and it says "cannot find main class"
The only class that i made has the name "main"
is there something im missing?
Help!
All i want is to create a jar file that will execute the above code!
I have: 1 class, named "HelloWorld", and the above code, Thats it!
What steps from there do i do to make a jar file and have it be able to be executed and SEE the "hello" printed somewhere NOT in blueJ??
(I understand there is something about a "static" method? Im not really sure but if somoene could enlighten me on how to make a .jar file that would be great.)
Thanks a lot everyone!
Tom
I'm really interested in making a .jar file out of my code. And basically I just want to make one. but i understand there are certain things like main class's, etc. that need to be made in order to make a .jar file.
So, for instance, say I create a new project.
I create 1 new class called "HelloWorld"
I open that up and type this code:
class HelloWorld {
public static void main (String[] args)
{
System.out.println("Hello World");
}
}
I compile that. But now i want to make a.jar file.
I went to project> create .jar file, and it was made.
but i go into it and it says "cannot find main class"
The only class that i made has the name "main"
is there something im missing?
Help!
All i want is to create a jar file that will execute the above code!
I have: 1 class, named "HelloWorld", and the above code, Thats it!
What steps from there do i do to make a jar file and have it be able to be executed and SEE the "hello" printed somewhere NOT in blueJ??
(I understand there is something about a "static" method? Im not really sure but if somoene could enlighten me on how to make a .jar file that would be great.)
Thanks a lot everyone!
Tom