JCreator Forum Board: Jar Files - JCreator Forum Board

Jump to content

Page 1 of 1
  • You cannot start a new topic
  • You cannot reply to this topic

Jar Files how to create them

#1 User is offline   gpcprog 

  • Newbie
  • Pip
  • Group: Members
  • Posts: 1
  • Joined: 27-March 05

Posted 27 March 2005 - 06:49 PM

Does any one know how to create JAR files with JCreator. I tried it, it made a JAR file, but when I tried to execute it, it said that the Main Class was not found. I tried to mess with the mainfest file, but nothing helped. So in the mean time I am using NetBeans, but my comp is kind of old, so it doesn't work well.
0

#2 User is offline   jeef 

  • Advanced Member
  • PipPipPip
  • Group: Members
  • Posts: 344
  • Joined: 20-March 05
  • Location:New Zealand

Posted 28 March 2005 - 08:23 AM

have you got your package set properly? the jar archive will need packages to be in folders within the jar. and (i think) the manifest needs to specify which class to execute the "static main void(String args[])" from
no point making your program so simple a dummy can use it cause the universe just keeps making a better dummy!
0

#3 User is offline   E-E-R 

  • Advanced Member
  • PipPipPip
  • Group: Members
  • Posts: 1,367
  • Joined: 16-March 05
  • Gender:Male
  • Location:The Netherlands
  • Interests:Programming, Gaming, DC

Posted 28 March 2005 - 11:21 AM

A working Manifest:
CODE
Manifest-Version: 1.0
Created-By: 1.5.0 (Sun Microsystems Inc.)
Main-Class: RC5StatsFrame



please note the two <ENTER>s after the last attribute, they are mandatory, or it won't work.
"Many are persistently in pursuit of the way they have chosen; few in pursuit of the goal"
0

#4 User is offline   docevi1 

  • Newbie
  • Pip
  • Group: Members
  • Posts: 2
  • Joined: 27-March 05

Posted 31 March 2005 - 10:45 AM

no no, I can make jar files using the command line fine, but can JCreator make them automatically using the way it's set up.

Seems strange that it can't hence my asking.

thanks for the reply either way
0

#5 User is offline   E-E-R 

  • Advanced Member
  • PipPipPip
  • Group: Members
  • Posts: 1,367
  • Joined: 16-March 05
  • Gender:Male
  • Location:The Netherlands
  • Interests:Programming, Gaming, DC

Posted 31 March 2005 - 01:18 PM

It cannot make executable jar files directly, you would have to change the parameters JCreator uses to create a jar file to match those you use from the command line (since that works).

Configure
> Options
> + next to Tools
> create Jar File
> somewhere on the right you can fill in the parameters
"Many are persistently in pursuit of the way they have chosen; few in pursuit of the goal"
0

#6 User is offline   twinbee 

  • Newbie
  • Pip
  • Group: Members
  • Posts: 2
  • Joined: 31-March 05

Posted 31 March 2005 - 02:04 PM

It'd be nice if JCreator could automatically create JAR and EXE files for the next version of JCreator. Unless that'll bloat the software.

Here's hoping!
0

#7 User is offline   evdg 

  • Member
  • PipPip
  • Group: Members
  • Posts: 17
  • Joined: 31-March 05

Posted 31 March 2005 - 02:57 PM

QUOTE(twinbee @ Mar 31 2005, 04:04 PM)
It'd be nice if JCreator could automatically create JAR and EXE files for the next version of JCreator. Unless that'll bloat the software.

Here's hoping!
View Post


Exactly what I asked for. I used to use JBuilder and the one cool feature that I liked was that it could build complete self contained project jar files.

I now have a trick, have written a very simple .cmd file which has project related entries and I call this from withing jcreator to build my 'customised' project libraries.


0

#8 User is offline   Abyzmic 

  • Member
  • PipPip
  • Group: Members
  • Posts: 28
  • Joined: 16-March 05
  • Location:Virginia, USA

Posted 31 March 2005 - 06:05 PM

QUOTE(evdg @ Mar 31 2005, 09:57 AM)
Exactly what I asked for. I used to use JBuilder and the one cool feature that I liked was that it could build complete self contained project jar files.

I now have a trick, have written a very simple .cmd file which has project related entries and I call this from withing jcreator to build my 'customised' project libraries.
View Post


You should post your .cmd file contents so people can use it too :P
0

#9 User is offline   javacollege 

  • Newbie
  • Pip
  • Group: Members
  • Posts: 1
  • Joined: 01-April 05

  Posted 01 April 2005 - 12:09 PM

QUOTE(gpcprog @ Mar 27 2005, 06:49 PM)
Does any one know how to create JAR files with JCreator.  I tried it, it made a JAR file, but when I tried to execute it, it said that the Main Class was not found.  I tried to mess with the mainfest file, but nothing helped.  So in the mean time I am using NetBeans, but my comp is kind of old, so it doesn't work well.
View Post


=============================================
I have encountered the same problem. Clearly it is malfuction on part of JCreator and has to be fixed as soon as possible!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!

0

#10 User is offline   xinox 

  • Administrator
  • Group: Admin
  • Posts: 502
  • Joined: 09-March 05

Posted 01 April 2005 - 01:49 PM

Open the jar file with an archive utility and check if it has the corresponding main class included.
0

#11 User is offline   lordSauron 

  • Advanced Member
  • PipPipPip
  • Group: Members
  • Posts: 192
  • Joined: 22-March 05
  • Gender:Male
  • Location:California, United States
  • Interests:Dominating Middle-earth, enslaving all the free peoples and keeping my Silmaril stones nice and shiny.

Posted 05 April 2005 - 08:45 PM

I tried to make a jar file too... It ATE an entire file <sob>.

Post that .cmd file, and Xinox... you need to fix up this problem - really bad. I tried making a new tool to create a jar file. The default user tool for creating a jarfile murdered my source code. I shouldn't need to be a ph.d to create a jar file, especially when JBuilder can make one out of a project just like that. If I were Xinox, I'd be very embarrassed this error had persisted long enough to weasle into a whole product release!
Lord Sauron the Great
lordSaurontheGreat@gmail.com
JDK 6 Documentation - READ IT! LOVE IT! LIVE IT!
THOU SHALT GOOGLE BEFORE POSING THY QUERY!
If you're reading this you have given me control of your mind.
Why do accesses to your mind throw a "null pointer exception?"
0

#12 User is offline   E-E-R 

  • Advanced Member
  • PipPipPip
  • Group: Members
  • Posts: 1,367
  • Joined: 16-March 05
  • Gender:Male
  • Location:The Netherlands
  • Interests:Programming, Gaming, DC

Posted 05 April 2005 - 09:05 PM

lordSauron >
there is nothing wrong with the default jar creation script that is default in JCreator. I have used it for some time now and it works perfectly. It does exactly what it says it does: 'create a JAR file'.

I do not know how you have managed to destroy your source code using the jar tool, but the default JAR creation script is all right.

If you would like to know how to configure JCreator to create an executable JAR file, please read this topic for detailed instructions.
"Many are persistently in pursuit of the way they have chosen; few in pursuit of the goal"
0

#13 User is offline   Phil^ 

  • Advanced Member
  • PipPipPip
  • Group: Members
  • Posts: 175
  • Joined: 19-March 05

Posted 05 April 2005 - 09:05 PM

QUOTE(lordSauron @ Apr 5 2005, 08:45 PM)
I tried to make a jar file too... It ATE an entire file <sob>.

Post that .cmd file, and Xinox... you need to fix up this problem - really bad.  I tried making a new tool to create a jar file.  The default user tool for creating a jarfile murdered my source code.  I shouldn't need to be a ph.d to create a jar file, especially when JBuilder can make one out of a project just like that.  If I were Xinox, I'd be very embarrassed this error had persisted long enough to weasle into a whole product release!
View Post


from what i can gather, all that JCreator does is call jar.exe with some parameters to make the jar file.
Its sun microsystems your rage should be directed at for eating the source code , not xinox :)

0

#14 User is offline   lordSauron 

  • Advanced Member
  • PipPipPip
  • Group: Members
  • Posts: 192
  • Joined: 22-March 05
  • Gender:Male
  • Location:California, United States
  • Interests:Dominating Middle-earth, enslaving all the free peoples and keeping my Silmaril stones nice and shiny.

Posted 06 April 2005 - 08:07 PM

True, I was vauge.

Xinox should have a tool to create a jar file out of a project - a self-executing jar file. I shouldn't have to fool around with all this manifest nonsense! I mean, JBuilder found it such a small feature they didn't even bother to note it in the advertising (JBuilder 4). It can't be that difficult... I know I'm ignorant, but hey, it's real bliss. I don't want to learn how to create a manifest file!!! Forget saving the whales, save my ignorance!
Lord Sauron the Great
lordSaurontheGreat@gmail.com
JDK 6 Documentation - READ IT! LOVE IT! LIVE IT!
THOU SHALT GOOGLE BEFORE POSING THY QUERY!
If you're reading this you have given me control of your mind.
Why do accesses to your mind throw a "null pointer exception?"
0

#15 User is offline   mko 

  • Newbie
  • Pip
  • Group: Members
  • Posts: 1
  • Joined: 09-April 05

Posted 09 April 2005 - 10:17 PM

After adding the crate jar file tool (explained bafore) you have to add a new file to the project. Right click on the project name->add new file. Name it "Manifest.txt".
in this file write:
Main-Class: MyPackage.MyClass

MyClass y the entry point to the jar file where the main method is. The text file must end with a new line or carriage return. This is very important or it won't work.
Save the file.

Now Configure->Options->+Tools->Create Jar File:

In the argumentrs field paste this:
cmf Manifest.txt $[PrjName].jar . .The dot after ...].jar must be pasted too.

That should work. It did work for me.
0

#16 User is offline   lordSauron 

  • Advanced Member
  • PipPipPip
  • Group: Members
  • Posts: 192
  • Joined: 22-March 05
  • Gender:Male
  • Location:California, United States
  • Interests:Dominating Middle-earth, enslaving all the free peoples and keeping my Silmaril stones nice and shiny.

Posted 10 April 2005 - 05:22 AM

Thanks for two things:

1) telling me how. I would have never figured that out.
2) proving my point that it's really quite a bit to do just to make a jar file.
Lord Sauron the Great
lordSaurontheGreat@gmail.com
JDK 6 Documentation - READ IT! LOVE IT! LIVE IT!
THOU SHALT GOOGLE BEFORE POSING THY QUERY!
If you're reading this you have given me control of your mind.
Why do accesses to your mind throw a "null pointer exception?"
0

#17 User is offline   evdg 

  • Member
  • PipPip
  • Group: Members
  • Posts: 17
  • Joined: 31-March 05

Posted 26 April 2005 - 05:26 PM

Sorry for not coming back earlier, don't read the forum often enough and did not think it too important.

anyway,

save this as a file e.g. BuildProjectJar.cmd

goto %1
goto end
:Dummy
del %2\..\..\ProjectJars\Dummy.jar
jar cvf %2\..\..\ProjectJars\Dummy.jar -C classes /it/jrc/dummy -C ../Other/classes it/jrc/other
goto end
:LSAParser
del %2\..\..\ProjectJars\LSAParser.jar
jar cvfm %2\..\..\ProjectJars\LSAParser.jar manifest.mf -C classes /it/jrc/lsa
goto end
:end

Of course your directory structure may vary, I just have one dir where I jar all my projects, this dir then contains the latest builds.

Setup the tool in JCreator to run this file and take the project name, project dir as the parameters.

arguments: $[PrjName] $[PrjDir]
initial directory: $[PrjDir]

You do have to manually insert an entry into this file for each project (obviously)

Because you control the jar cvf line, you control the inclusion of the manifest (second example)

The only problem I found was the -C directive in the jar line, which does not do what you expect. -C does not 'change' directory, it only does it for the next file (or dir)

What I am trying to say is that if you want to get 2 class files from a different dir, you have to prefix them both with -C somedir otherwise you will not get what you want.

This here works for me, but is really very simple..

Oh, and the manifest file for nr 2 looks like

--
Manifest-Version: 1.0
Main-Class: it.jrc.lsa.ParserTest

--

3 lines!! the CR at the end is important

Erik
0

#18 User is offline   amdmatt 

  • Newbie
  • Pip
  • Group: Members
  • Posts: 2
  • Joined: 20-September 05

Posted 20 September 2005 - 12:58 AM

sorry for the major bump but..

i tried making the jar file using the manifest.txt and im pretty sure i did everything right.. is there something wrong with what is written there? i can't use a command line jar maker becuase this is for school and all the comps are monitored and deepfroze and crazy stuff..
help thanks
0

#19 User is offline   E-E-R 

  • Advanced Member
  • PipPipPip
  • Group: Members
  • Posts: 1,367
  • Joined: 16-March 05
  • Gender:Male
  • Location:The Netherlands
  • Interests:Programming, Gaming, DC

Posted 20 September 2005 - 06:49 AM

it's a MANIFEST.MF

that might be a problem, but I'm not sure.

if you renamed it MANIFEST.MF and got it in the jar file in the dir META-INF and it still doesn't work, please post your MANIFEST.MF file here
"Many are persistently in pursuit of the way they have chosen; few in pursuit of the goal"
0

Share this topic:


Page 1 of 1
  • You cannot start a new topic
  • You cannot reply to this topic