Skip to content

Commit 29daf61

Browse files
committed
Updates to Java quickstart
1 parent 6a5bf7c commit 29daf61

File tree

1 file changed

+51
-5
lines changed

1 file changed

+51
-5
lines changed

articles/ai-services/computer-vision/includes/quickstarts-sdk/image-analysis-java-sdk-40.md

Lines changed: 51 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@ Use the Image Analysis client SDK for Java to analyze an image to read text and
2424
## Prerequisites
2525

2626
* A Windows 10 (or higher) x64, or Linux x64 machine.
27-
* [Java 8](https://www.java.com/download/) or newer installed. Run `java -version` from a command line to see your version and confirm a successful install. Make sure that the Java installation is native to the system architecture and not running through emulation.
27+
* [Java 8](https://www.java.com/download/) or newer installed. Run `java -version` from a command line to see your version and confirm a successful installation. Make sure that the Java installation is native to the system architecture and not running through emulation.
2828
* [Apache Maven](https://maven.apache.org/download.cgi) installed. On Linux, install from the distribution repositories if available. Run `mvn -v` to confirm successful installation.
2929
* An Azure subscription - [Create one for free](https://azure.microsoft.com/free/cognitive-services/)
3030
* Once you have your Azure subscription, <a href="https://portal.azure.com/#create/Microsoft.CognitiveServicesComputerVision" title="create a Vision resource" target="_blank">create a Vision resource</a> in the Azure portal. In order to use the captioning feature in this quickstart, you must create your resource in one of the following Azure regions: East US, France Central, Korea Central, North Europe, Southeast Asia, West Europe, West US. After it deploys, select **Go to resource**.
@@ -38,14 +38,52 @@ Open a console window and create a new folder for your quickstart application.
3838

3939
1. Open a text editor and copy the following content to a new file. Save the file as `pom.xml` in your project directory
4040

41-
[!INCLUDE][](https://raw.githubusercontent.com/Azure-Samples/azure-ai-vision-sdk/main/docs/learn.microsoft.com/java/image-analysis/quick-start/pom.xml)]
42-
41+
<!-- [!INCLUDE][](https://raw.githubusercontent.com/Azure-Samples/azure-ai-vision-sdk/main/docs/learn.microsoft.com/java/image-analysis/quick-start/pom.xml)] -->
42+
43+
```xml
44+
<project xmlns="http://maven.apache.org/POM/4.0.0"
45+
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
46+
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
47+
<modelVersion>4.0.0</modelVersion>
48+
<groupId>azure.ai.vision.imageanalysis.samples</groupId>
49+
<artifactId>image-analysis-quickstart</artifactId>
50+
<version>0.0</version>
51+
<dependencies>
52+
<!-- https://mvnrepository.com/artifact/com.azure/azure-ai-vision-imageanalysis -->
53+
<dependency>
54+
<groupId>com.azure</groupId>
55+
<artifactId>azure-ai-vision-imageanalysis</artifactId>
56+
<version>0.15.1-beta.1</version>
57+
</dependency>
58+
<!-- https://mvnrepository.com/artifact/com.azure/azure-core-http-netty -->
59+
<dependency>
60+
<groupId>com.azure</groupId>
61+
<artifactId>azure-core-http-netty</artifactId>
62+
<version>1.13.6</version>
63+
</dependency>
64+
<!-- https://mvnrepository.com/artifact/org.slf4j/slf4j-api -->
65+
<dependency>
66+
<groupId>org.slf4j</groupId>
67+
<artifactId>slf4j-api</artifactId>
68+
<version>2.0.7</version>
69+
</dependency>
70+
<!-- https://mvnrepository.com/artifact/org.slf4j/slf4j-simple -->
71+
<dependency>
72+
<groupId>org.slf4j</groupId>
73+
<artifactId>slf4j-simple</artifactId>
74+
<version>2.0.7</version>
75+
</dependency>
76+
</dependencies>
77+
</project>
78+
```
4379
2. Install the SDK and dependencies by running the following in the project directory:
4480

4581
```console
4682
mvn clean dependency:copy-dependencies
4783
```
4884

85+
3. Once the operation succeeds, verify that the folders `target\dependency` were creating and they contain `.jar` file.
86+
4987
For more information, see the [SDK installation guide](../../sdk/install-sdk.md?pivots=programming-language-java).
5088

5189
[!INCLUDE [create environment variables](../environment-variables.md)]
@@ -57,11 +95,19 @@ Open a text editor and copy the following content to a new file. Save the file a
5795
[!code-java[](~/azure-ai-vision-sdk/docs/learn.microsoft.com/java/image-analysis/quick-start/ImageAnalysis.java?name=snippet_single)]
5896

5997
> [!TIP]
60-
> You can also analyze a local image or an image from memory buffer. See the [sample code](https://github.com/Azure-Samples/azure-ai-vision-sdk/blob/main/samples/java/image-analysis/src/azure/ai/vision/imageanalysis/samples/Samples.java) repository for these and other scenarios.
98+
> The code shows analyzing an image URL. You can also analyze a local image file, or an image from a memory buffer. For more information, see the [Analyze Image how-to guide](../../how-to/call-analyze-image-40.md).
99+
100+
To compile the Java file, run the following:
61101

62-
Build and run the application by running the following in the project directory:
63102
```console
64103
javac ImageAnalysis.java -cp ".;target\dependency\*"
104+
```
105+
106+
You should see the file `ImageAnalysis.class` created in the current folder.
107+
108+
To run the application:
109+
110+
```console
65111
java -cp ".;target\dependency\*" ImageAnalysis
66112
```
67113

0 commit comments

Comments
 (0)