Go to the folder with the class files and use the java command.
Read up on how to put an application into a jar file. Then others will be able to use it.
Welcome to the Java Programming Forums
The professional, friendly Java community. 21,500 members and growing!
The Java Programming Forums are a community of Java programmers from all around the World. Our members have a wide range of skills and they all have one thing in common: A passion to learn and code Java. We invite beginner Java programmers right through to Java professionals to post here and share your knowledge. Become a part of the community, help others, expand your knowledge of Java and enjoy talking with like minded people. Registration is quick and best of all free. We look forward to meeting you.
>> REGISTER NOW TO START POSTING
Members have full access to the forums. Advertisements are removed for registered users.
Go to the folder with the class files and use the java command.
Read up on how to put an application into a jar file. Then others will be able to use it.
Not the code. Turn it into a program.
Look. Guy gets paid to design software. Boss is not going to be happy if, on deadline day, he only has it in JGrasp and not as a program customers can use.
Now get what I'm asking?
You don't study to write programs that'll only work in JGrasp. You study it to write programs so you can make them into programs that'll run as computer applications, like video games. How do you use the code to make it run outside of the code maker program as a program of its own?
Is it complicated or something?
I'm looking for a make into program button in JGrasp, but can't find one.
Class files are not source code. They are executable.
Read up on how to put an application into a jar file. Then others will be able to use it.
javapenguin (June 14th, 2010)
You mean as code or to play it if it is a game?
I'm not talking about making it so others can use my code, well, I am but I'm not. In other words, let's say I used JGrasp to make a calculator. How do I get that calculator to run outside of JGrasp? i.e. the dudes who made Windows Calculator, how'd they get it as a separate application? I'm not asking how to make a calculator, just how to make software into software the users would normally see. I mean, where my code isn't showing in the background to the user.
Put the class files in a jar file that includes a manifest file.
javapenguin (June 14th, 2010)
What?
What's a jar file and a manifest file?
I've gotten jar files before. However, I don't know how to put anything in one. I have no clue what either really is.
javapenguin (June 14th, 2010)
What's a command prompt?
Might normally be able to figure it out on my own, but am pretty tired right now.
Actually, I just don't quite know what it is, though I am tired, which isn't helping any.
Never mind, I found it.
So am I just creating a zip drive or software by doing this?
Surly the IDE you should be using does this for you? Creating a jar file by hand with command prompt leads to a ugly huge mass of switches and semicolon separated arguments.
If your not using an IDE, then its time to get acquainted with ant: Apache Ant - Welcome
Do I have to have all of the handlers and exception classes that it uses all on there? I have them all on a flash drive. However, I have a big class file that s really big, and I'm wondering if it already contains all the button handlers and exception classes in it. If not, what do I do? How do I put it in the manifest file? I mean, do I put it as main, or what?
You need to put everything that is needed in the jar file.
Read the doc on how to use the jar command.How do I put it in the manifest file
Wait, do I need a manifest file before I made the jar file, or is that not a good idea?
I don't know how to make a jar without one.
the manifest file goes in the jar file.
javapenguin (June 15th, 2010)
So how do I make a jar file?
It won't let me.
It says, access denied.
Do i call the file Main-Class in the manifest file? I told it to make a manifest file and then create a jar file like this:
C:\"Program Files"\Java\jdk1.6.0_18\bin\jar cvfm battleshipGUICompiled.jar manifest.txt BattleshipGUI.class
I have a file called manifest.text, but the command prompt claims it can't find it.
Last edited by javapenguin; June 15th, 2010 at 12:00 PM.
When making the Jar file, do I need to save the class or the java files?
I mean, program.java or program.class?
Also, do I need to save all of my button handlers and exception classes used in program in the jar too, or can I use the big class file that probably contains all of that?
Also, as these programs are on a flash drive, including the exception classes, and the jar file is on the hard drive, will it always not work then until I copy all to the hard drive first?
When I save it, do I save it as something.jar or something.exe ?
Last edited by javapenguin; June 15th, 2010 at 12:44 PM.
Sounds like you need to read the Tutorial and the API doc about jar files.
javapenguin (June 15th, 2010)
what do I do about this problem?
The 'e' flag (for 'entrypoint'), introduced in JDK 6, creates or overrides the manifest's Main-Class attribute. It can be used while creating or updating a jar file. Use it to specify the application entry point without editing or creating the manifest file.
Also, should the package name be the name of the class or something different, or does it not matter if it is or not?
Last edited by javapenguin; June 15th, 2010 at 01:53 PM.
Main-Class: MyPackage.MyClass
Warning: The text file must end with a new line or carriage return. The last line will not be parsed properly if it does not end with a new line or carriage return.
We then create a JAR file named MyJar.jar by entering the following command:
jar cfm MyJar.jar Manifest.txt MyPackage/*.class
What is MyPackage supposed to be called?
You need to read about using packages when creating a program. Read about the package statement.What is MyPackage supposed to be called
I thought a package would be something like:
java.util
or
java.awt