so how i can make them into jar?
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.
so how i can make them into jar?
if your using eclipse Create JAR file in Java & Eclipse | Update JAR file in Java | ViralPatel.net
but when i try to run it it says cant find main-class -.-
1) Compile all of the .java files to create .class files.
2) Create a zip folder.
3) Put all of your .class files into the zip folder.
4) Create a folder named (case sensitive): META-INF
5) Create a .mf file named (case sensitive): MANIFEST and put in META-INF folder. Here is a copy of a manifest from one of my programs:
The Class-Path variable indicates any external libraries you are using and provides full paths to those libraries. For this example, it is saying that the SX.jar library is in the same folder as the executing jar. The Main-Class variable indicates the name of the .class file inside the jar that will be the class with your main. Notice how there is no extension on on the Main-Class variable. Lastly, make sure there is at least 1 extra blank line at the bottom.Manifest-Version: 1.0
Created-By: 1.6.0_14 (Sun Microsystems Inc.)
Class-Path: SX.jar
Main-Class: EventData
6) Put the META-INF folder inside your zip folder.
7) Rename the zip folder to be a .jar instead of a .zip.
8) Double-click to run program.
NOTE TO NEW PEOPLE LOOKING FOR HELP ON FORUM:
When asking for help, please follow these guidelines to receive better and more prompt help:
1. Put your code in Java Tags. To do this, put [highlight=java] before your code and [/highlight] after your code.
2. Give full details of errors and provide us with as much information about the situation as possible.
3. Give us an example of what the output should look like when done correctly.
Join the Airline Management Simulation Game to manage your own airline against other users in a virtual recreation of the United States Airline Industry. For more details, visit: http://airlinegame.orgfree.com/
Do you have an IDE? Such as Eclipse, Netbeans, JCreator, ect. If so, you just have to find the .class files that are made when you compile your program in the IDE.
If you do not have an IDE, you can use the Windows Command Prompt (if you run Windows) to compile the .java files and create .class files.
NOTE TO NEW PEOPLE LOOKING FOR HELP ON FORUM:
When asking for help, please follow these guidelines to receive better and more prompt help:
1. Put your code in Java Tags. To do this, put [highlight=java] before your code and [/highlight] after your code.
2. Give full details of errors and provide us with as much information about the situation as possible.
3. Give us an example of what the output should look like when done correctly.
Join the Airline Management Simulation Game to manage your own airline against other users in a virtual recreation of the United States Airline Industry. For more details, visit: http://airlinegame.orgfree.com/
umm okay i have eclipse where u can compile the files but there is a problem :/
it gives alot of errors coz there is different .jar file where is the rest of the methods... so i need to know how to add it there but not inside the project witch i made? so it would use other .jar methods?
Last edited by sibbe; December 4th, 2010 at 02:50 PM.
In Eclipse, right click the project and go to Export. Go to Java->Runnable Jar (if you want a runnable jar). In the following window, choose your class containing the main method you wish to launch with, select how to repackage any external jar files, and define where to save the jar. Click Finish.
javapenguin (December 6th, 2010)
Do you have a main method defined, or is this just a class library? If it's the latter, you can create a simple main method in one of your classes and declare it to do nothing. You can also try using the export as a Jar (not a Runnable Jar).
public class SomeClass { public static void main(String[] args) {} // ... other code }
pleaseany1?
It won't do anything because it's defined to do nothing
You need to put code inside the main method to launch the game client (I have no idea what this would be, though).
okey i found the problem...
the problem is that the eclipse gives compile errors when i try make it into .class file and thats why it wont make that full java code inside to the .class... but the client works with that code witch is in the eclipse but i cant get it into .class file :/ so any ideas how to convert it into .class file with errors etc?
make sure you have imported the external .jar file you are using into your eclipse project,
Project > Properties > Build Path > Libraries > add Jar
now i cant modify it at all.... when i modifield it and export them to runnable jar it makes them back to the original code -.-
i need modify it :/ so any other ideas?
it replaces the code where error appears with this:
do i need to fix it or is there any way to that it wont replace that code with that error :/public final void createFrame() { throw new Error("Unresolved compilation problem: \n\tThe constructor Class26(int, int, Component, int) is undefined\n"); } public final void createMenu() { throw new Error("Unresolved compilation problems: \n\tThe constructor Object(Menu) is undefined\n\tval$scriptMenu cannot be resolved or is not a field\n"); }
and if i need fix it? How i can do it?
atm menu code is this:
thiever.addActionListener(new ActionListener(scriptMenu) { public void actionPerformed(ActionEvent arg0) { while (true) { if (BSBotClient.username == null ? "" != null : !BSBotClient.username.equals("")) if (BSBotClient.password == null ? "" != null : !BSBotClient.password.equals("")) break; BSBotClient.username = JOptionPane.showInputDialog("Enter username:"); BSBotClient.password = JOptionPane.showInputDialog("Enter password:"); if (BSBotClient.username == null ? "" != null : !BSBotClient.username.equals("")) if (BSBotClient.password == null ? "" != null : !BSBotClient.password.equals("")) continue; JOptionPane.showMessageDialog(null, "Please enter something atleast"); } BSBot.bsBot.scriptHandler.playScript(new BSScriptPaladinThiever(BSBot.bsBot)); this.val$scriptMenu.setEnabled(false); } });
bumbbumbumbumbumbnumb