9 Replies - 5741 Views - Last Post: 06 June 2010 - 07:53 PM Rate Topic: -----

#1 Guest_Smiley*


Reputation:

How do you make your java project into a .jar or a .exe file?

Posted 05 June 2010 - 08:22 PM

How do you do make your project into a .jar or .exe file?

Im using the BlueJ editor and there is an option for making your project into a jar file, but all my images are lost.
Is This A Good Question/Topic? 0

Replies To: How do you make your java project into a .jar or a .exe file?

#2 pbl  Icon User is offline

  • There is nothing you can't do with a JTable
  • member icon

Reputation: 8346
  • View blog
  • Posts: 31,908
  • Joined: 06-March 08

Re: How do you make your java project into a .jar or a .exe file?

Posted 05 June 2010 - 09:34 PM

View PostSmiley, on 05 June 2010 - 09:22 PM, said:

How do you do make your project into a .jar or .exe file?

Im using the BlueJ editor and there is an option for making your project into a jar file, but all my images are lost.

Not sure about BlueJ but in Eclipse you cannot just copy images into one of your project subdirectory. You have to make your project "awared" of this new files by doing:
- project
--- import files
------ file system

so that the project knows that these files are part of the whole thing
Was This Post Helpful? 0
  • +
  • -

#3 zim1985  Icon User is offline

  • Grand Inquisitor
  • member icon

Reputation: 75
  • View blog
  • Posts: 568
  • Joined: 19-February 10

Re: How do you make your java project into a .jar or a .exe file?

Posted 05 June 2010 - 10:23 PM

Make sure all your images are within the package. Meaning they can't be on the desktop somewhere, they need to be within the project package you are working with.

As long as all the images are in a subdirectory of the project as pbl mentioned above everything should jar up, including your resource files.
Was This Post Helpful? 0
  • +
  • -

#4 Guest_Smiley*


Reputation:

Re: How do you make your java project into a .jar or a .exe file?

Posted 06 June 2010 - 09:16 AM

Im sure that they are all inside the package

and I dont know how to use eclipse >.< especially since I have a blueJ package file
Was This Post Helpful? 0

#5 m-e-g-a-z  Icon User is offline

  • Winning
  • member icon


Reputation: 497
  • View blog
  • Posts: 1,453
  • Joined: 19-October 09

Re: How do you make your java project into a .jar or a .exe file?

Posted 06 June 2010 - 12:09 PM

Have a look at this.
Was This Post Helpful? 0
  • +
  • -

#6 Guest_Smiley*


Reputation:

Re: How do you make your java project into a .jar or a .exe file?

Posted 06 June 2010 - 03:27 PM

ohh thanks, but how do you make a class the "main" class? So it is executable?
Was This Post Helpful? 0

#7 m-e-g-a-z  Icon User is offline

  • Winning
  • member icon


Reputation: 497
  • View blog
  • Posts: 1,453
  • Joined: 19-October 09

Re: How do you make your java project into a .jar or a .exe file?

Posted 06 June 2010 - 03:36 PM

A main class is the class that has the main() method, so a class that has this in it.

public static void main(String[] args)

Was This Post Helpful? 0
  • +
  • -

#8 pbl  Icon User is offline

  • There is nothing you can't do with a JTable
  • member icon

Reputation: 8346
  • View blog
  • Posts: 31,908
  • Joined: 06-March 08

Re: How do you make your java project into a .jar or a .exe file?

Posted 06 June 2010 - 04:00 PM

View Postm-e-g-a-z, on 06 June 2010 - 04:36 PM, said:

A main class is the class that has the main() method, so a class that has this in it.

public static void main(String[] args)

And in the .jar you should have a manifest.mf file (it is generated by Eclipse it should be also my BlueJ) that inform the runner which main() to run from which class. Something like

manifest.mf
Main-Class: ca/pblinc/eurostyle/EuroStyle2


when you build the .jar file you pass this manifest file name on the command line

http://java.sun.com/...asicsindex.html
Was This Post Helpful? 0
  • +
  • -

#9 Guest_Smiley*


Reputation:

Re: How do you make your java project into a .jar or a .exe file?

Posted 06 June 2010 - 07:25 PM

well, my main method is in the class... and it does work in blueJ, but when I create a jar with blueJ, all my images are gone.

So I tried using command prompt, but when I use command prompt, I am not able to run the jar file.
Was This Post Helpful? 0

#10 YasuoDancez  Icon User is offline

  • D.I.C Head

Reputation: 20
  • View blog
  • Posts: 135
  • Joined: 30-September 09

Re: How do you make your java project into a .jar or a .exe file?

Posted 06 June 2010 - 07:53 PM

View Postpbl, on 05 June 2010 - 08:34 PM, said:

View PostSmiley, on 05 June 2010 - 09:22 PM, said:

How do you do make your project into a .jar or .exe file?

Im using the BlueJ editor and there is an option for making your project into a jar file, but all my images are lost.

Not sure about BlueJ but in Eclipse you cannot just copy images into one of your project subdirectory. You have to make your project "awared" of this new files by doing:
- project
--- import files
------ file system

so that the project knows that these files are part of the whole thing



I'm pretty sure that you can copy files into eclipse.
That is the normal way i usually import files. I drag and drop the image from windows explorer into a directory i've created for my images in my Package Explorer src folder.
Was This Post Helpful? 0
  • +
  • -

Page 1 of 1