RPTools.net

Discussion and Support

Skip to content

It is currently Tue Oct 17, 2017 10:59 pm 






Reply to topic  [ 18 posts ]  Go to page 1, 2  Next

Previous topic | Next topic 

  Print view

Author Message
User avatar  Offline
Dragon
 
Joined: Wed Jul 03, 2013 4:58 am
Posts: 350
 Post subject: Exporting JAR from Eclipse (version: Kepler)
PostPosted: Fri Jul 05, 2013 5:40 am 
Azhrei wrote:
Use the prebuilt configurations. If you press and hold on the Run or Debug buttons in the toolbar you'll get a drop down menu of options. You should see ones like "MapTool (Std)" and "MapTool (German)". Those will execute the main application and set the locale for whatever your system default is (English, in my case) or force it to German (if you select the second one).)


Thanks for the info. I think the first time I checked out the wrong path and thus did not have those options. I re-did the checkout and now those options are available.

I have managed to modify MapTools for my purpose. I will be using it as a virtual card game table and thus I wanted to remove most of the token context menu options and, instead, make all the token level macros available in the root of the token context menu. I have managed to do this and I am able to run the revised version of MapTools from the Eclipse IDE.

Now that I am ready to compile the results into a JAR file, I did some studying online and the answer is supposedly very obvious: Export | Jar File.

My version of Eclipse (Kepler) provides two options "Export | Jar File" and "Export | Runnable Jar File". I have tried both but in both cases the compile generates errors indicating that there are compile errors. I am not sure what the problem is since I am able to run the modified MapTool version and I am not selecting anything out-of-the-ordinary during the Export process (as far as I know).

Can anyone, please, help a struggling beginner?

Attachment:
MapTools - Eclipse - Export 1.png
MapTools - Eclipse - Export 1.png [ 16.5 KiB | Viewed 2809 times ]

Attachment:
MapTools - Eclipse - Export 2.png
MapTools - Eclipse - Export 2.png [ 21.8 KiB | Viewed 2809 times ]

Attachment:
MapTools - Eclipse - Export 3.png
MapTools - Eclipse - Export 3.png [ 95.45 KiB | Viewed 2809 times ]


I have enclosed screen captures of the export process so that you can see the settings I selected.


Last edited by Azhrei on Mon Jul 08, 2013 9:56 pm, edited 1 time in total.
split from main topic: Getting RPTools apps into Eclipse


Top
 Profile  
 
 Offline
Cave Troll
 
Joined: Sun Apr 14, 2013 6:52 pm
Posts: 58
 Post subject: Re: How to get RPTools source via Eclipse and subversion
PostPosted: Fri Jul 05, 2013 11:22 am 
Scroll to the errors, please; warnings are just that, but the actual errors preventing JAR creation are not shown in that screen capture.


Top
 Profile  
 
User avatar  Offline
Great Wyrm
 
Joined: Mon May 10, 2010 11:59 am
Posts: 1680
Location: Chicagoland
 Post subject: Re: How to get RPTools source via Eclipse and subversion
PostPosted: Fri Jul 05, 2013 12:31 pm 
I get the same thing when ever I export a JAR or Runnable JAR, however it DOES generate the jar... Haven't figured out how why it does it either given it's nothing but warnings (no errors).

_________________
-Jamz
____________________
Custom MapTool 1.4.x.x Fork: maptool.nerps.net
More information here: MapTool Nerps! Fork | TokenTool Nerps! Fork
Custom TokenTool (version 1.0b33): TokenTool.exe


Top
 Profile  
 
User avatar  Offline
Dragon
 
Joined: Wed Jul 03, 2013 4:58 am
Posts: 350
 Post subject: Re: How to get RPTools source via Eclipse and subversion
PostPosted: Fri Jul 05, 2013 7:17 pm 
Wyrframe wrote:
Scroll to the errors, please; warnings are just that, but the actual errors preventing JAR creation are not shown in that screen capture.


Here is the bottom of the Export error...hope that helps identifying the problem.

Attachment:
MapTools - Eclipse - Export 4.png
MapTools - Eclipse - Export 4.png [ 104.52 KiB | Viewed 2797 times ]


JamzTheMan wrote:
I get the same thing when ever I export a JAR or Runnable JAR, however it DOES generate the jar... Haven't figured out how why it does it either given it's nothing but warnings (no errors).


In my case, and this may not be necessarily your case, it does create a jar file but the jar file does not seem to be runnable. I placed it in the same directory as my unmodified version of MapTools and then made a copy of the BAT file that launches MapTools which I modified to launch the new JAR file instead. When I run the BAT file, it gives an error related to running the JAR file as follows:

Attachment:
MapTools - Eclipse - Run 1.png
MapTools - Eclipse - Run 1.png [ 5.29 KiB | Viewed 2797 times ]


Just for information, in case it is relevant, I only modified a couple of MapTool files (AbstractTokenPopupMenu.java and TokenPopupMenu.java). As I said, the modification seems to run fine when I launch it from the Eclipse IDE so I don't think it is related to the changes I made. I did not, however, try making a JAR file from the unmodified MapTools source code. If you think this would be helpful, I can try that to determine if it is or isn't related to the modification.

Once again, you patience, with a beginner like me, is most appreciated.

_________________
"We often compare ourselves to the U.S. and often they come out the best,
but they only have the right to bare arms, while we have the right to bare breasts"
The Right To Bare Breasts by Bowser & Blue


Top
 Profile  
 
User avatar  Offline
Great Wyrm
 
Joined: Mon May 10, 2010 11:59 am
Posts: 1680
Location: Chicagoland
 Post subject: Re: How to get RPTools source via Eclipse and subversion
PostPosted: Sat Jul 06, 2013 12:56 am 
What i currently do as a work around is i copied the manifest.mf to my conf dir. And then instead of exporting as runnable jar i just export jar using the manifest i saved. I then place in the normal mt dir and run. I don't need to update the whole zip then.

_________________
-Jamz
____________________
Custom MapTool 1.4.x.x Fork: maptool.nerps.net
More information here: MapTool Nerps! Fork | TokenTool Nerps! Fork
Custom TokenTool (version 1.0b33): TokenTool.exe


Top
 Profile  
 
User avatar  Offline
Dragon
 
Joined: Wed Jul 03, 2013 4:58 am
Posts: 350
 Post subject: Re: How to get RPTools source via Eclipse and subversion
PostPosted: Sat Jul 06, 2013 5:00 am 
JamzTheMan wrote:
What i currently do as a work around is i copied the manifest.mf to my conf dir. And then instead of exporting as runnable jar i just export jar using the manifest i saved. I then place in the normal mt dir and run. I don't need to update the whole zip then.


If you don't mind expanding on that a little, it would be much appreciated. I googled Eclipse and Manifest files and Eclipse can create manifest files for you as part of the export process. Is that how you are getting your manifest.mf file or are you creating it some other way? I didn't find one in the MapTools checked out source code. Did I not check out the correct branch?

Trying to get Eclipse to generate my manifest.mf file for me does not seem to work because it gets created as part of the export process which is currently failing (both the Export Java and Export Runnable Java options are failing).

_________________
"We often compare ourselves to the U.S. and often they come out the best,
but they only have the right to bare arms, while we have the right to bare breasts"
The Right To Bare Breasts by Bowser & Blue


Top
 Profile  
 
User avatar  Offline
Great Wyrm
 
Joined: Mon May 10, 2010 11:59 am
Posts: 1680
Location: Chicagoland
 Post subject: Re: How to get RPTools source via Eclipse and subversion
PostPosted: Sat Jul 06, 2013 10:10 am 
Correct, if you build using eclipse via (using ant script for mt iirc), it generates the manifest for you. But you can open a previous jar and extract the manifest out (and modify the class path if needed). You can also create it using jar commands out manually, it is just the class path and starting class info.

I heard there are a few tricks to get a full build of my done and honestly haven't messed with doing so myself.

_________________
-Jamz
____________________
Custom MapTool 1.4.x.x Fork: maptool.nerps.net
More information here: MapTool Nerps! Fork | TokenTool Nerps! Fork
Custom TokenTool (version 1.0b33): TokenTool.exe


Top
 Profile  
 
User avatar  Offline
Dragon
 
Joined: Wed Jul 03, 2013 4:58 am
Posts: 350
 Post subject: Re: How to get RPTools source via Eclipse and subversion
PostPosted: Sat Jul 06, 2013 5:43 pm 
JamzTheMan wrote:
Correct, if you build using eclipse via (using ant script for mt iirc), it generates the manifest for you. But you can open a previous jar and extract the manifest out (and modify the class path if needed). You can also create it using jar commands out manually, it is just the class path and starting class info.

I heard there are a few tricks to get a full build of my done and honestly haven't messed with doing so myself.


Perfect. Sounds like extracting it out of the previous JAR file will be the easiest. I'll give that a try. Thanks for having patience with me.

_________________
"We often compare ourselves to the U.S. and often they come out the best,
but they only have the right to bare arms, while we have the right to bare breasts"
The Right To Bare Breasts by Bowser & Blue


Top
 Profile  
 
User avatar  Offline
Dragon
 
Joined: Wed Jul 03, 2013 4:58 am
Posts: 350
 Post subject: Re: How to get RPTools source via Eclipse and subversion
PostPosted: Sat Jul 06, 2013 9:20 pm 
Sorry but using the MANIFEST.MF file did not help. I still get the same (or at least similar - I did not compare) error.

Here are screen captures of the exporting process for reference in case I am selecting something wrong...

1. Export SRC portion of project...

Attachment:
MapTools - Eclipse Export - Screen 1.png
MapTools - Eclipse Export - Screen 1.png [ 50.91 KiB | Viewed 2780 times ]


2. Export SRC folder. I tried adding more options here but got the same results.

Attachment:
MapTools - Eclipse Export - Screen 2.png
MapTools - Eclipse Export - Screen 2.png [ 28.42 KiB | Viewed 2780 times ]


3. Not sure so when with defaults.

Attachment:
MapTools - Eclipse Export - Screen 3.png
MapTools - Eclipse Export - Screen 3.png [ 18.8 KiB | Viewed 2780 times ]


4. Select MANIFEST.MF file from previous JAR file

Attachment:
MapTools - Eclipse Export - Screen 4.png
MapTools - Eclipse Export - Screen 4.png [ 49.74 KiB | Viewed 2780 times ]


5. Still results in error

Attachment:
MapTools - Eclipse Export - Screen 5.png
MapTools - Eclipse Export - Screen 5.png [ 84.55 KiB | Viewed 2780 times ]


Any ideas?

_________________
"We often compare ourselves to the U.S. and often they come out the best,
but they only have the right to bare arms, while we have the right to bare breasts"
The Right To Bare Breasts by Bowser & Blue


Top
 Profile  
 
User avatar  Offline
Dragon
 
Joined: Wed Jul 03, 2013 4:58 am
Posts: 350
 Post subject: Re: How to get RPTools source via Eclipse and subversion
PostPosted: Sat Jul 06, 2013 9:40 pm 
Okay, I found a work around...

I figured since it ran in the Eclipse IDE, Eclipse needed to have a compiled version somewhere (i.e. Class files instead of Java files). I went searching through the settings and discovered that it puts the build in "maptools\builds". I had a look there and, low-and-behold, the builds directory had the whole build structure there. So I copied it to a different directory. I extracted the META-INF directory from a previous MapTools JAR file and placed it in the same directory, and then I zipped the whole thing up. Lastly I renamed it to JAR instead of ZIP.

I am not sure if the same process would work for significant changes to MapTools but it definitely worked for my mods. I am, now, able to launch my modified version of MapTools without issues.

_________________
"We often compare ourselves to the U.S. and often they come out the best,
but they only have the right to bare arms, while we have the right to bare breasts"
The Right To Bare Breasts by Bowser & Blue


Top
 Profile  
 
User avatar  Offline
Site Admin
 
Joined: Mon Jun 12, 2006 12:20 pm
Posts: 12101
Location: Tampa, FL
 Post subject: Re: Exporting JAR from Eclipse (version: Kepler)
PostPosted: Mon Jul 08, 2013 10:07 pm 
The warning can be ignored when building the JAR. If you've looked at the code, you know there are various warnings scattered through the source code from things like "serializable class doesn't contain version id" and similar types of warnings.

If you double-click a JAR file and it doesn't run, then follow the advice in the MapTool forum where they discuss general problem diagnosis. I would start by opening a command window and then running java -jar exported_jar_file.jar. That way instead of just getting a little dialog with "A Java exception occurred" you would actually see the stacktrace in the command window.

Last, your technique will not work in a general sense. During the ANT build process there are a couple properties files created. One is called version.txt (I think) and I believe there's another. Those files are placed deep into the build/ hierarchy and when ANT builds the final JAR the file will be there. I'm not sure what happens if the file doesn't exist (exception probably?) and since you executed MT before building the JAR that may be why it worked. (I would have expected your attempt to fail.)

In order to understand the build process and what the MT JAR normally contains you would need to browse the ANT build.xml file and see what the process is.

If you're just starting out with Java and/or Eclipse, I would recommend NOT choosing MapTool as your first project!! It's a sufficiently complex enough project that you'll get lost trying to find your way through the entire process. Heck, I've been writing Java code for years and I felt a little daunted when I started with it!


Top
 Profile  
 
User avatar  Offline
Dragon
 
Joined: Wed Jul 03, 2013 4:58 am
Posts: 350
 Post subject: Re: Exporting JAR from Eclipse (version: Kepler)
PostPosted: Wed Jul 10, 2013 7:11 am 
Azhrei wrote:
If you're just starting out with Java and/or Eclipse, I would recommend NOT choosing MapTool as your first project!! It's a sufficiently complex enough project that you'll get lost trying to find your way through the entire process. Heck, I've been writing Java code for years and I felt a little daunted when I started with it!


:D Yea, I know...at some point I am actually going to have to spend some time to understand Eclipse...Does Eclipse use the ANT Build for building the project when it is run from the IDE? When I built the JAR file contents manually I grabbed the whole NET sub-directory of {Eclipse Workspace}\maptool\build. I added the META-INF from the official JAR file and this seemed to have worked just fine. I ran the resulting JAR file both on my PC and another laptop (which does not have Eclipse or any previous version of MapTool) and it ran fine.

I am not saying that it is a correct process...all I am saying is that it seemed to have worked.

As for not starting with MapTools, that is kind of a toss up. I am a programmer and have been for years so I can handle making the changes that I want to make (and actually have already done most of them), its just this setting up of the IDE and creating build files and so on that I always have issues with because I am more used to languages which don't have crap like that.

But thanks for your advice in any case.

_________________
"We often compare ourselves to the U.S. and often they come out the best,
but they only have the right to bare arms, while we have the right to bare breasts"
The Right To Bare Breasts by Bowser & Blue


Top
 Profile  
 
User avatar  Offline
Site Admin
 
Joined: Mon Jun 12, 2006 12:20 pm
Posts: 12101
Location: Tampa, FL
 Post subject: Re: Exporting JAR from Eclipse (version: Kepler)
PostPosted: Thu Jul 11, 2013 12:21 am 
Lord.Ashes wrote:
:D Yea, I know...at some point I am actually going to have to spend some time to understand Eclipse...Does Eclipse use the ANT Build for building the project when it is run from the IDE?

No.

Quote:
When I built the JAR file contents manually I grabbed the whole NET sub-directory of {Eclipse Workspace}\maptool\build. I added the META-INF from the official JAR file and this seemed to have worked just fine. I ran the resulting JAR file both on my PC and another laptop (which does not have Eclipse or any previous version of MapTool) and it ran fine.

Cool. Then I guess those property files I mentioned above were put into your build/ directory. I wasn't sure they would be. :?

Quote:
As for not starting with MapTools, that is kind of a toss up. I am a programmer and have been for years so I can handle making the changes that I want to make (and actually have already done most of them), its just this setting up of the IDE and creating build files and so on that I always have issues with because I am more used to languages which don't have crap like that.

But thanks for your advice in any case.

Heh, sorry for any perceived "acid" in my comments. It's just that MapTool, while it isn't as complex as some projects I've worked on, it does tend to have tendrils extending all over. That version file I mentioned above: MT expects to find it and if it doesn't it assumes a version number of "DEVELOPMENT". That affects how campaigns are loaded and saved (when running a development version of MT certain things are relaxed in order to make debugging simpler) and can affect how the Campaign object is propagated to clients (IIRC). That's all different from the -DMAPTOOL_DEV=true that can be put on the command line when MT is executed, but which has to be added to the runtime configuration properties if executing MT from within the IDE.

Too many details... Sigh.


Top
 Profile  
 
User avatar  Offline
Great Wyrm
 
Joined: Mon May 10, 2010 11:59 am
Posts: 1680
Location: Chicagoland
 Post subject: Re: Exporting JAR from Eclipse (version: Kepler)
PostPosted: Thu Jul 11, 2013 12:46 am 
That's good to know btw. :) I usually run with a version.txt in my src dir and change it through my iterations so I don't get lost. Didn't know with the development tag so many things changed. But I usually like running it anyways from eclipse closer to what the user experience would be anyway.

_________________
-Jamz
____________________
Custom MapTool 1.4.x.x Fork: maptool.nerps.net
More information here: MapTool Nerps! Fork | TokenTool Nerps! Fork
Custom TokenTool (version 1.0b33): TokenTool.exe


Top
 Profile  
 
User avatar  Offline
Dragon
 
Joined: Wed Jul 03, 2013 4:58 am
Posts: 350
 Post subject: Re: Exporting JAR from Eclipse (version: Kepler)
PostPosted: Thu Jul 11, 2013 2:52 am 
Azhrei wrote:
Heh, sorry for any perceived "acid" in my comments. It's just that MapTool, while it isn't as complex as some projects I've worked on, it does tend to have tendrils extending all over. That version file I mentioned above: MT expects to find it and if it doesn't it assumes a version number of "DEVELOPMENT". That affects how campaigns are loaded and saved (when running a development version of MT certain things are relaxed in order to make debugging simpler) and can affect how the Campaign object is propagated to clients (IIRC). That's all different from the -DMAPTOOL_DEV=true that can be put on the command line when MT is executed, but which has to be added to the runtime configuration properties if executing MT from within the IDE.

Too many details... Sigh.


No worries...no "acid" was perceived. I noticed that the version built from the source indicated "Development" but I didn't know that it was related to these files being missing. Just to personalize my version, I modded this to say "Card Game Edition" and I noticed that MapTools (correctly) complained about the version mismatch when I created a campaign in the regular version and then imported it into my "Card Game Edition"...but it loaded and as soon as I saved it in that version...it no longer complained. Probably not an ideal thing to do if one would expect the version to be re-integrated but mine will never be. Its just a personal version which hides most of the unnecessary options from the token context menu when using it to play card games.

_________________
"We often compare ourselves to the U.S. and often they come out the best,
but they only have the right to bare arms, while we have the right to bare breasts"
The Right To Bare Breasts by Bowser & Blue


Top
 Profile  
 
Display posts from previous:  Sort by  
Reply to topic  [ 18 posts ]  Go to page 1, 2  Next

You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Search for:

Who is online

In total there are 2 users online :: 0 registered, 0 hidden and 2 guests (based on users active over the past 5 minutes)
Most users ever online was 243 on Sun Nov 04, 2012 6:14 am

Users browsing this forum: No registered users and 2 guests





cron

Powered by phpBB © 2000, 2002, 2005, 2007 phpBB Group

Style based on Andreas08 by Andreas Viklund

Style by Elizabeth Shulman