BuildingJacobFromSource.html 9.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172
  1. <HTML>
  2. <BODY>
  3. <h1> Overview </h1>
  4. JACOB is built on windows machines using ANT, most commonly from inside of Eclipse. The main steps for getting a working
  5. Jacob build are:
  6. <ol>
  7. <li>Check out the source code or unpack the source zip file from sourceforge</li>
  8. <li>Install the Development Environment</li>
  9. <li>Configure the build by creating a
  10. <i>compilation_tools.properties</i> file.</li>
  11. <li>Run Eclipse and load the project into eclipse</li>
  12. <li>Open the build.xml file in Eclipse and run the default ant target </li>
  13. </ol>
  14. <h1> Repository Organization </h1>
  15. Unpack the source archive zip file or check the files out of CVS into d:\jacob or some other familiar place. Source Java
  16. and JNI files are located in separate packages from the unit tests and the samples.
  17. <ul>
  18. <li>docs: documentation</li>
  19. <li>jni: c++ code</li>
  20. <li>lib: libraries needed to compile unit tests</li>
  21. <li>release: a directory built by the ant script where jacob is constructed</li>
  22. <li>samples: sample programs</li>
  23. <li>src: Jacob Java source files</li>
  24. <li>unittest: JUnit 4.12 unit test programs. Run from the test target in build.xml</li>
  25. <li>vstudio: some out of date VC++ project files</li>
  26. <li>bulid.xml: the ant build script. It can be run from inside Eclipse</li>
  27. </ul>
  28. The Servlet examples that required j2ee libraries to compile have temporarily been removed.
  29. <H1>Development Environment</h1>
  30. The simplest build environment includes MS Visual Studio 13.0 (Studio 2013), Eclipse 4.7 with the C/C++ module and JDK 1.8.
  31. In that situation, you would just create the
  32. <i>compilation_tools.properties</i>
  33. using the example at the top of build.xml as a template.
  34. <UL>
  35. <li> Microsoft Visual Studio 2013 and it's included library. (to C:\ProgramFiles (X86) in my case)</li>
  36. <li> Eclipse from www.eclipse.org as the Java IDE.</li>
  37. <li> Eclipse C/C++ plugin can be used for C coding in place of VC++ IDE.</li>
  38. <li> Java JDK 1.8 , latest available</li>
  39. <li> Install the V7.1A libraries available from https://www.microsoft.com/net/download/windows</li>
  40. </ul>
  41. <p></p>
  42. <table>
  43. <TR><TD>Release</TD> <TD>C Version</TD> <TD>Java Version</TD><TD>ANT Version</TD><TD>Eclipse Version Used</TD><TD>generated DLLs</TD></TR>
  44. <TR><TD>up to 1.6</TD><TD>VC 98 (6.0)</TD> <TD>? </TD><td>MAKE</td><TD>?</TD><TD>32 bit</TD></TR>
  45. <TR><TD>1.7</TD> <TD>VC 98 (6.0)</TD> <TD>1.4 (48)</TD><td>1.?</td><TD>?</TD><TD>32 bit</TD></TR>
  46. <TR><TD>1.8</TD> <TD>VC 98 (6.0)</TD> <TD>1.4 (48)</TD><td>1.?</td><TD>?</TD><TD>32 bit</TD></TR>
  47. <TR><TD>1.9</TD> <TD>VC 98 (6.0)</TD> <TD>1.4 (48)</TD><td>1.?</td><TD>?</TD><TD>32 bit</TD></TR>
  48. <TR><TD>1.10</TD> <TD>VC 98 (6.0)</TD> <TD>1.4 (48)</TD><td>1.?</td><TD>3.??</TD><TD>32 bit</TD></TR>
  49. <TR><TD>1.11</TD> <TD>VC 98 (6.0) & 2003 64bit libs</TD><TD>1.4.? (48)</TD><td>1.6.?</td><TD>3.2.1</TD><TD>32 and 64 bit</TD></TR>
  50. <TR><TD>1.12</TD> <TD>VC 98 (6.0) & 2003 64bit libs</TD><TD>1.4.2 (48)</TD><td>1.6.5</td><TD>3.2.2</TD><TD>32 and 64 bit</TD></TR>
  51. <TR><TD>1.13</TD> <TD>VC 2005 (8)</TD> <TD>1.4.2 (48)</TD><TD>1.7.0</TD><TD>3.3</TD><TD>32 and 64 bit</TD></TR>
  52. <TR><TD>1.14</TD> <TD>VC 2005 (8)</TD> <TD>1.5.0 (49)</TD><TD>1.7.0</TD><TD>3.3</TD><TD>32 and 64 bit</TD></TR>
  53. <TR><TD>1.15</TD> <TD>VC 2005 (8)</TD> <TD>1.5.0 (49)</TD><TD>1.7.0</TD><TD>3.4</TD><TD>32 and 64 bit</TD></TR>
  54. <TR><TD>1.17</TD> <TD>VC 2005 (8)</TD> <TD>1.5.0 (49)</TD><TD>1.8.4 Eclipse Embedded</TD><TD>4.3</TD><TD>32 and 64 bit</TD></TR>
  55. <TR><TD>1.18</TD> <TD>VS 2013 (12) Windows SDK 7.1A</TD><TD>1.6.0 (50)</TD><TD>1.8.4 Eclipse Embedded</TD><TD>4.3</TD><TD>32 and 64 bit</TD></TR>
  56. <TR><TD>1.19</TD> <TD>VS 2013 (12) Windows SDK 7.1A</TD><TD>1.8.0 (52)</TD><TD>1.10.1 Eclispse Embedded</TD><TD>4.7</TD><TD>32 and 64 bit</TD></TR>
  57. </table>
  58. Microsoft Visual Studio 13 supports 64 bit builds. so no additional tools are required.<BR>
  59. Microsoft changed the location of the windows sdk (formerly known as platform sdk) after VC 8.0. https://en.wikipedia.org/wiki/Microsoft_Windows_SDK
  60. <H1>Build Process</H1>
  61. The build process is based on ANT. You can run ANT from inside of eclipse or from the command line. Running from inside eclipse
  62. means you don't have any installation, pathing or configuration to do. You can just open the xml, select the target in the
  63. "Outline" pane, right mouse and then "run as ant" on the selected target.
  64. <p></p>
  65. The ant process is driven off of a configuration file named
  66. <code>compilation_tools.properties</code> that describes the locations of the JDK and Microsoft C++ tools. The
  67. <code>build.xml</code> file in the root directory contains examples of the contents of this file. There are two main ant targets.
  68. <UL>
  69. <li>"default" executes the following steps when using the default target.
  70. <UL>
  71. <li> Build the Java code</li>
  72. <li> Build the jni code</li>
  73. <li> create the dll</li>
  74. <li> create jar file</li>
  75. </UL>
  76. <li>"packageRelease" runs the above listed steps and then
  77. <UL>
  78. <LI>builds the javadoc</LI>
  79. <LI>builds a source zip</LI>
  80. <li>builds a binary zip with the javadoc</li>
  81. </UL>
  82. </li>
  83. </UL>
  84. <H1>Eclipse Java IDE</h1>
  85. You can open the jacob-project in Eclipse.
  86. <ol>
  87. <li>Open Eclipse</li>
  88. <li>File-->New-->Other...</li>
  89. <li>Java --> Java Project form Existing Ant Buildfile</li>
  90. <li>Click "next" to go to "Create a Java Project from an Ant Buildfile"</li>
  91. <li>Browse to and select build.xml in the project directory</li>
  92. <li>Select any of the javac tasks. This wall cause that one source directory to be added as a eclipse source directory.</li>
  93. </ol>
  94. <p></p>
  95. Eclipse users have to do some minor tweaks to their project if they want to use the integrated build process. This is because
  96. the unit tests are files located in the "unittest" directory while the project source files themselves are in "src" the root
  97. directory. By default, eclipse will add the entire project as source. This messes up the package naming. In addition, the
  98. build directory should be set to be the same place the ANT build puts the compiled java classes. A couple small tweaks to
  99. the build path fix these problems:
  100. <ol>
  101. <li> Open up the project properties and go to the "Java Build Path" properties panel. </li>
  102. <li> Remove the root of the project from the build path if it is there</li>
  103. <li> Add / verify the following folders are in the build path. Add them with "link source..." if they are missing
  104. <code>samples</code>,
  105. <code>src</code> and
  106. <code>unittest</code> to the build path in the Source tab.</li>
  107. <li>Add junit as a library "Add Library...Junit...Junit 4"</li>
  108. <li> Exclude *.txt from each of the newly added folders. </li>
  109. <li> Set the default build output directory to
  110. <code>jacob-project/release/java</code>
  111. </li>
  112. <li>Open "Windows-->Show View-->Project Explorer" </li>
  113. </ol>
  114. <h2> Troubleshooting Build Problems </h2>
  115. <ul>
  116. <li>
  117. Symptom: Build Failed can't find javac compiler. JAVA_HOME does not point to the JDK Problem:
  118. <br>The java library is pointed at a jre insted of the jdk. Update Project..Properties..Java Build Path to point at the JDK
  119. </li>
  120. <li>
  121. Symptom: The jar is built but no dlls were compiled.
  122. <br> Problem: compilation_tools.properties does not have the correct location for the Microsoft tools.
  123. </li>
  124. <li>
  125. Sympton: Can't find jni.h or can't find C++ compiler
  126. <BR> Problem: compilation_tools.properties configured incorrectly. Either paths are wrong or the separator is wrong. It requires
  127. two backslashes for a separator.
  128. </li>
  129. <li>
  130. Symptom: Ant fails with the message
  131. <CODE> Could not create task or type of type: junit.</CODE>.
  132. <BR> Problem: junit.jar must be copied from this project to the $ANT_HOME/lib directory.
  133. </li>
  134. </ul>
  135. <h1> Running Samples and Tests </h1>
  136. Samples and JUnit test programs can be found in the source jar or in CVS. The programs can be run from a bat file or from
  137. inside the Eclipse IDE. The java library path variable must be set to include the directory the jacob.dll is in. The simplest
  138. way to do that is to add it as a command line option. The following assume that your jacob development area is located in
  139. c:\dev\jacob:
  140. <pre>
  141. -Djava.library.path=c:/dev/jacob/release/x86
  142. -Dcom.jacob.autogc=false
  143. -Dcom.jacob.debug=false
  144. -Xcheck:jni
  145. </pre> JUnit test programs can be individually run from inside eclipse or en-masse via the
  146. <code>ant test</code> target.
  147. <h1> Git Bash environment configuration </h1>
  148. Example environment configuration for windows machine as of 2018/05
  149. <pre>
  150. JAVA_HOME="/c/Program Files (x86)/Java/jdk1.8.0_161"
  151. #JAVA_HOME="/c/Program Files/Java/jdk1.8.0_161"
  152. ANT_HOME=/c/dev/springsource-3.9.4-x64/sts-3.9.4.RELEASE/plugins/org.apache.ant_1.10.1.v20170504-0840
  153. PATH=$ANT_HOME/bin:$JAVA_HOME/bin:$PATH
  154. export PATH
  155. export ANT_HOME
  156. export JAVA_HOME
  157. </pre>
  158. <hr> Last Modified 05/2017 1.19
  159. </BODY>
  160. </HTML>