Skip to content

Commit 9ca4883

Browse files
committed
Update the usage and build with vscode test runner examples
1 parent 5b6a144 commit 9ca4883

File tree

4 files changed

+129
-47
lines changed

4 files changed

+129
-47
lines changed

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,7 @@ JacobVersion.properties
1818
setenv.sh
1919
junit*properties
2020
~$*
21+
settings.json
2122

2223
/out
2324
/.idea

README.md

Lines changed: 17 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -47,21 +47,21 @@ See [ReleaseNotes](docs/ReleaseNotes.md) for a full history.
4747

4848
#### Tracked Changes 1.21
4949

50-
| Item | Description |
51-
| ------------------------------------------------------ | ----------------------------------------------- |
52-
| **Bugs** | |
53-
| https://github.com/freemansoft/jacob-project/issues/35 | Add Iterable to EnumVariant |
54-
| https://github.com/freemansoft/jacob-project/issues/36 | Memory Leak |
55-
| https://github.com/freemansoft/jacob-project/issues/38 | Implement Comparable on Currency |
56-
| https://github.com/freemansoft/jacob-project/issues/40 | Incorrect delete in Dispatch JNI Invoke() |
57-
| https://github.com/freemansoft/jacob-project/issues/42 | ArrayIndexOutOfBounds SafeArray |
58-
| https://github.com/freemansoft/jacob-project/issues/43 | Memory Leaks in DispatchEvents.cpp |
59-
| https://github.com/freemansoft/jacob-project/issues/45 | SaveArray init0 |
60-
| https://github.com/freemansoft/jacob-project/issues/48 | Incorrect multi dimensional array element count |
61-
| | |
62-
| **Patches** | |
63-
| none | none |
64-
| | |
65-
| **Feature Requests** | |
66-
| none | none |
50+
| Item | Description |
51+
| -------------------------------------------------------- | ----------------------------------------------- |
52+
| **Bugs** | |
53+
| <https://github.com/freemansoft/jacob-project/issues/35> | Add Iterable to EnumVariant |
54+
| <https://github.com/freemansoft/jacob-project/issues/36> | Memory Leak |
55+
| <https://github.com/freemansoft/jacob-project/issues/38> | Implement Comparable on Currency |
56+
| <https://github.com/freemansoft/jacob-project/issues/40> | Incorrect delete in Dispatch JNI Invoke() |
57+
| <https://github.com/freemansoft/jacob-project/issues/42> | ArrayIndexOutOfBounds SafeArray |
58+
| <https://github.com/freemansoft/jacob-project/issues/43> | Memory Leaks in DispatchEvents.cpp |
59+
| <https://github.com/freemansoft/jacob-project/issues/45> | SaveArray init0 |
60+
| <https://github.com/freemansoft/jacob-project/issues/48> | Incorrect multi dimensional array element count |
61+
| | |
62+
| **Patches** | |
63+
| none | none |
64+
| | |
65+
| **Feature Requests** | |
66+
| none | none |
6767

docs/BuildingJacobFromSource.md

Lines changed: 69 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -47,25 +47,24 @@ The simplest build environment includes MS Visual Studio 16.0 (Studio 2019), Ecl
4747
* Let it detect the JDK
4848
* ANT plugin
4949

50-
51-
| | | | | | |
52-
| --------- | ---------------------------------------- | ------------ | ----------------------- | --------------------------- | -------------- |
53-
| Release | C Version | Java Version | ANT Version | Java IDE | generated DLLs |
54-
| up to 1.6 | VC 98 (6.0) | ? | MAKE | Eclipse ? | 32 bit |
55-
| 1.7 | VC 98 (6.0) | 1.4 (48) | 1.? | Eclipse ? | 32 bit |
56-
| 1.8 | VC 98 (6.0) | 1.4 (48) | 1.? | Eclipse ? | 32 bit |
57-
| 1.9 | VC 98 (6.0) | 1.4 (48) | 1.? | Eclipse ? | 32 bit |
58-
| 1.10 | VC 98 (6.0) | 1.4 (48) | 1.? | Eclipse 3.?? | 32 bit |
59-
| 1.11 | VC 98 (6.0) & 2003 64bit libs | 1.4.? (48) | 1.6.? | Eclipse 3.2.1 | 32 and 64 bit |
60-
| 1.12 | VC 98 (6.0) & 2003 64bit libs | 1.4.2 (48) | 1.6.5 | Eclipse 3.2.2 | 32 and 64 bit |
61-
| 1.13 | VC 2005 (8) | 1.4.2 (48) | 1.7.0 | Eclipse 3.3 | 32 and 64 bit |
62-
| 1.14 | VC 2005 (8) | 1.5.0 (49) | 1.7.0 | Eclipse 3.3 | 32 and 64 bit |
63-
| 1.15 | VC 2005 (8) | 1.5.0 (49) | 1.7.0 | Eclipse 3.4 | 32 and 64 bit |
64-
| 1.17 | VC 2005 (8) | 1.5.0 (49) | 1.8.4 Eclipse Embedded | Eclipse 4.3 | 32 and 64 bit |
65-
| 1.18 | VS 2013 (12) Windows SDK 7.1A | 1.6.0 (50) | 1.8.4 Eclipse Embedded | Eclipse 4.3 | 32 and 64 bit |
66-
| 1.19 | VS 2013 (12) Windows SDK 7.1A | 1.8.0 (52) | 1.10.1 Eclipse Provided | Eclipse 4.7 | 32 and 64 bit |
67-
| 1.20 | VS 2019 (16) Windows SDK 10 | 1.8.0 (52) | 1.10.8 Eclipse Provided | Eclipse 2020 09 | 32 and 64 bit |
68-
| 1.21 | VS 2022 (17) Windows SDK 11 10.0.22621.0 | 17 | ?? | IntelliJ Community 2023.3.5 | 32 and 64 bit |
50+
| | | | | | |
51+
| --------- | ---------------------------------------- | ------------ | ----------------------- | --------------- | -------------- |
52+
| Release | C Version | Java Version | ANT Version | Java IDE | generated DLLs |
53+
| up to 1.6 | VC 98 (6.0) | ? | MAKE | Eclipse ? | 32 bit |
54+
| 1.7 | VC 98 (6.0) | 1.4 (48) | 1.? | Eclipse ? | 32 bit |
55+
| 1.8 | VC 98 (6.0) | 1.4 (48) | 1.? | Eclipse ? | 32 bit |
56+
| 1.9 | VC 98 (6.0) | 1.4 (48) | 1.? | Eclipse ? | 32 bit |
57+
| 1.10 | VC 98 (6.0) | 1.4 (48) | 1.? | Eclipse 3.?? | 32 bit |
58+
| 1.11 | VC 98 (6.0) & 2003 64bit libs | 1.4.? (48) | 1.6.? | Eclipse 3.2.1 | 32 and 64 bit |
59+
| 1.12 | VC 98 (6.0) & 2003 64bit libs | 1.4.2 (48) | 1.6.5 | Eclipse 3.2.2 | 32 and 64 bit |
60+
| 1.13 | VC 2005 (8) | 1.4.2 (48) | 1.7.0 | Eclipse 3.3 | 32 and 64 bit |
61+
| 1.14 | VC 2005 (8) | 1.5.0 (49) | 1.7.0 | Eclipse 3.3 | 32 and 64 bit |
62+
| 1.15 | VC 2005 (8) | 1.5.0 (49) | 1.7.0 | Eclipse 3.4 | 32 and 64 bit |
63+
| 1.17 | VC 2005 (8) | 1.5.0 (49) | 1.8.4 Eclipse Embedded | Eclipse 4.3 | 32 and 64 bit |
64+
| 1.18 | VS 2013 (12) Windows SDK 7.1A | 1.6.0 (50) | 1.8.4 Eclipse Embedded | Eclipse 4.3 | 32 and 64 bit |
65+
| 1.19 | VS 2013 (12) Windows SDK 7.1A | 1.8.0 (52) | 1.10.1 Eclipse Provided | Eclipse 4.7 | 32 and 64 bit |
66+
| 1.20 | VS 2019 (16) Windows SDK 10 | 1.8.0 (52) | 1.10.8 Eclipse Provided | Eclipse 2020 09 | 32 and 64 bit |
67+
| 1.21 | VS 2022 (17) Windows SDK 11 10.0.22621.0 | 17 | VSCode provided | VSCode | 32 and 64 bit |
6968

7069
Microsoft Visual Studio 2019 supports 64 bit builds. so no additional tools are required.
7170

@@ -85,7 +84,56 @@ The build process is based on ANT. You can run ANT from inside of eclipse or fro
8584
* **test** runs all the tests
8685
* One of the Excel unit tests is hard coded against Office 2019 32 bit.
8786

88-
## Eclipse Java IDE
87+
## Visual Studio IDE
88+
89+
You can open `jacob-project` in VS Code
90+
91+
1. Open VS Code
92+
2. Install the Java extensions
93+
3. Install the ANT extension
94+
4. Open the jacob project directory
95+
5. Run the ANT default target to build the pieces
96+
97+
### Running tests in VS Code with ANT
98+
99+
The tests now sit in src/test. You can run all the tests with the `ANT target runner` if you installed the extension
100+
101+
### Running tests in VS Code with the test runner.
102+
103+
1. Build the dll and compile the java code using the default `Ant` target.
104+
2. Create a `.vscode/settings.json` file with the following configuration in it. This makes the Jacob DLL accessible to the tests by setting `java.library.path`
105+
3. Adjust the java location to your JDK location
106+
4. You can now run any of the tests from the Test Runner panel. Debugging and breakpoints should work
107+
108+
```json
109+
{
110+
"java.configuration.runtimes": [
111+
{
112+
"name": "JavaSE-1.8",
113+
"path": "C:\\Program Files\\Amazon Corretto\\jdk1.8.0_372"
114+
}
115+
],
116+
"java.test.defaultConfig": "64bitDll",
117+
"java.test.config": [
118+
{
119+
"name": "64bitDll",
120+
"workingDirectory": "${workspaceFolder}",
121+
"classPaths": [
122+
"${workspaceFolder}/release/java",
123+
"${workspaceFolder}/lib/hamcrest-2.2.jar",
124+
"${workspaceFolder}/lib/junit-4.13.jar"
125+
],
126+
127+
"vmargs": ["-Djava.library.path=${workspaceFolder}\\release\\x64"]
128+
}
129+
]
130+
}
131+
```
132+
133+
134+
## Eclipse Java IDE (OBSOLETE)
135+
136+
**The tests have moved from `unittest` to `src/test`** since these instructions were written
89137

90138
You can open the jacob-project in Eclipse.
91139

@@ -150,4 +198,4 @@ export JAVA_HOME
150198
***
151199

152200
Last Modified 09/2020 1.19
153-
Converted from HTML to md 9/2020
201+
Converted from HTML to md 9/2020

docs/UsingJacob.md

Lines changed: 42 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ Section not yet written.
2222

2323
## The Jacob DLL
2424

25-
Jacob.jar relies on a DLL file that it loads off of the library path or classpath. This means that you must either copy the appropriate jacob dll into your path or use VM options to add directory holding jacob dll to the path. Prior to 1.14M6, the jacob DLL name was always "jacob.dll". This made it hard to verify jacob was loading the correct dll when multiple copies of jacob were installed on a single system. It also was confusing on 64 bit systems where the 32 bit and 64 bit dlls have the same tames. Starting in 1.14M6, Jacob's library loader selects a dll with the appropriate name based on the jacob release and platform. The dll naming convention is:
25+
Jacob.jar relies on a DLL file that it loads off of the library path or classpath. This means that you must either copy the appropriate jacob dll into your path or use VM options to add directory holding jacob dll to the path. Prior to 1.14M6, the jacob DLL name was always "jacob.dll". This made it hard to verify jacob was loading the correct dll when multiple copies of jacob were installed on a single system. It also was confusing on 64 bit systems where the 32 bit and 64 bit dlls have the same tames. Starting in 1.14M6, Jacob's library loader selects a dll with the appropriate name based on the jacob release and platform. The dll naming convention is:
2626
`jacob<platform>.<version.>.dll`
2727

2828
Classloader issues
@@ -39,9 +39,10 @@ Jacob 1.13 is built with VC++ 2005 that creates a dependency on msvcr80.dll. Win
3939

4040
If you see the following message then you probably don't have the right C++ libraries.
4141

42-
<pre> Exception in thread "main" java.lang.UnsatisfiedLinkError: C:\apps\...\jacob.dll: This application has
43-
failed to start because the application configuration is incorrect. Reinstalling the application may fix this problem
44-
</pre>
42+
```txt
43+
Exception in thread "main" java.lang.UnsatisfiedLinkError: C:\apps\...\jacob.dll: This application has
44+
failed to start because the application configuration is incorrect. Reinstalling the application may fix this problem
45+
```
4546

4647
[Visual C redistributable installer SP1](http://www.microsoft.com/downloads/details.aspx?familyid=200B2FD9-AE1A-4A14-984D-389C36F85647&displaylang=en)
4748

@@ -108,7 +109,7 @@ Setting this flag to false causes Jacob to check the and <class_name>.PutInROT p
108109
<td valign="top">
109110
<class_name>.PutInROT
110111
</td>
111-
<td>Lets a program specify that instances of certain classes are to not be inserted into the ROT. This experimental (1.13) feature provides a mechanism for freeing VariantViaEvent objects that are created in Event threads. There is normally no way to free those objects because the thread terminates outside of any normally MTA/STA Startup/Teardown code. Each event occurs in a new thread and creates a new ROT entry so they grow without bounds.This option may cause VM crashes in certain situations where windows memory is freed outside of the thread it was created in but empirical evidence shows there are situations where this great reduces the long running memory footprint of applications that process a lot of events. _This function is still experimental_. The functionality was added 1.13\. Some of this overlaps the experimental `com.jacob.autogc` introduced in 1.9\. See the ROT.java test program for an example of the effects of this option.This value is checked every time and can be changed on-the-fly via `System.setProperty();`Example: `System.setProperty("com.jacob.com.VariantViaVariant.PutInROT","false");`
112+
<td>Lets a program specify that instances of certain classes are to not be inserted into the ROT. This experimental (1.13) feature provides a mechanism for freeing VariantViaEvent objects that are created in Event threads. There is normally no way to free those objects because the thread terminates outside of any normally MTA/STA Startup/Teardown code. Each event occurs in a new thread and creates a new ROT entry so they grow without bounds.This option may cause VM crashes in certain situations where windows memory is freed outside of the thread it was created in but empirical evidence shows there are situations where this great reduces the long running memory footprint of applications that process a lot of events. _This function is still experimental_. The functionality was added 1.13\. Some of this overlaps the experimental `com.jacob.autogc` introduced in 1.9\. See the ROT.java test program for an example of the effects of this option.This value is checked every time and can be changed on-the-fly via `System.setProperty();`Example: `System.setProperty("com.jacob.com.VariantViaVariant.PutInROT","false");`
112113
Example: `-Dcom.jacob.com.VariantViaVariant.PutInROT=false`</td>
113114
</tr>
114115
<tr>
@@ -132,15 +133,47 @@ Example: `-Dcom.jacob.com.VariantViaVariant.PutInROT=false`</td>
132133
</tr>
133134
</tbody>
134135
</table>
135-
***
136136

137137
## Finding the DLL version using windows command line
138138

139139
The jacob.dll file includes the jacob release number in the version field. Run the following from the command prompt `dumpbin /version jacob.dll` . The dll version number is stored in the "image version" field of the "OPTIONAL HEADER VALUES" section. This information from [The Microsoft msdn web site](http://msdn2.microsoft.com/en-gb/library/h88b7dc8(VS.71).aspx)
140140

141-
***
142141

143142
## Unit Tests
144143

145-
Jacob must know the location of the DLL when running the unit tests in Eclipse. The simplest way to do this is to add the dll path to the unit as a VM argument. The argument should be specified based on where you installed the jacob source package. If you have jacob unpacked in c:/dev/jacob and built using build.xml, then the vm arguments would be:
146-
`-Djava.library.path=c:/dev/jacob/release/x86` .Last Modified 4/2008 1.15
144+
Jacob must know the location of the DLL when running the unit tests from the command line or inside an IDE.
145+
The simplest way to do this is to add the dll path to the unit as a VM argument.
146+
The argument should be specified based on where you installed the jacob source package.
147+
If you have jacob unpacked in c:/dev/jacob and built using build.xml, then the vm arguments would be:
148+
`-Djava.library.path=c:/dev/jacob/release/x86` .
149+
150+
If you are running it from inside a test runner in an IDE like VSCode. Then you need to set up the runner to pass the DLL library location to all the tests
151+
using `-Djava.library.path`
152+
153+
This is a sample workspace settings.json fragment that configures the dll and jars for the tests.
154+
155+
```json
156+
{
157+
"java.configuration.runtimes": [
158+
{
159+
"name": "JavaSE-1.8",
160+
"path": "C:\\Program Files\\Amazon Corretto\\jdk1.8.0_372"
161+
}
162+
],
163+
"java.test.defaultConfig": "64bitDll",
164+
"java.test.config": [
165+
{
166+
"name": "64bitDll",
167+
"workingDirectory": "${workspaceFolder}",
168+
"classPaths": [
169+
"${workspaceFolder}/release/java",
170+
"${workspaceFolder}/lib/hamcrest-2.2.jar",
171+
"${workspaceFolder}/lib/junit-4.13.jar"
172+
],
173+
174+
"vmargs": ["-Djava.library.path=${workspaceFolder}\\release\\x64"]
175+
}
176+
]
177+
}
178+
179+
```

0 commit comments

Comments
 (0)