beginner to java - how to run outside jcreator/netbeans ?
Im a beginner to Java, started in university this year. I was wondering how a java application can be run outside the IDE, say, by clicking an icon? I know it can be run in the command prompt, are there other ways?
I think you can create executable .jar files
I hope this helps
quick way to do this...
1. make a txt file called say 'mc.mf' at the root of your application
2. open the file and enter: 'Main-Class: Driver' on the first line where Driver is the name of your class that contains the main method.
3. create a jar file like so: 'jar cvfm thejar.jar mc.mf *.class' replace thejar.jar with the name you want.
4. now simply double click the jar and it runs that main method
cool thanks for your help, ill give it a try
I tried what you said above, but I got an error message saying:
Failed to load Main-Class manifest attribute from C:\Bluff\bluff.jar
Its a java application called bluff, a card game.
Have you tried opening a "DOS window" - or other operating system command window, and just typing "java THENAMEOFYOURCLASSWITHMETHODMAIN" ? This is a problem with starting your introduction to Java by using an IDE - you don't learn to work outside of the boundary of the IDE.
It looks like it can't find the class you entered in the manifest file. In your manifest file it should be...
Main-Class: 'The name of the class that contains your main method without the .class'
then recreate the jar...Also make sure you have jarred all the classes you need especially the main-class one... hmmm does anyone else sayed jarred?
I agree with nspils... I started out doing all my programming from command line with Unix. Then moved on too different fancy IDE's with a better understanding in place.
Last edited by Joe Beam; 12-04-2005 at 02:13 PM.
If you're using Netbeans, then all you have to do is press F11 to build the project. Then, in your project folder/dist/ will exist a .jar file with the name of your project. Just double click that jar and it will execute the classes itself.
This would be the alternative of creating .jar files manualy... if you use netbeans.
Alright, thanks everyone for all your help. Ill give it another try.
Last Post: 06-14-2006, 04:16 PM
By jackbauer in forum Java
Last Post: 08-18-2005, 11:33 AM
By Lori Piquet in forum Talk to the Editors
Last Post: 10-10-2002, 07:01 AM
By Sergio Pereira in forum Java
Last Post: 05-25-2001, 05:19 PM
By H. Wilson in forum Java
Last Post: 04-14-2000, 12:25 PM
Top DevX Stories
Easy Web Services with SQL Server 2005 HTTP Endpoints
JavaOne 2005: Java Platform Roadmap Focuses on Ease of Development, Sun Focuses on the "Free" in F.O.S.S.
Wed Yourself to UML with the Power of Associations
Microsoft to Add AJAX Capabilities to ASP.NET
IBM's Cloudscape Versus MySQL