Skip to content

Commit 273e6b4

Browse files
docs: Update user-guide.md, more complete starting code snippet
1 parent 625c3b0 commit 273e6b4

File tree

1 file changed

+16
-10
lines changed

1 file changed

+16
-10
lines changed

programming/java/user-guide.md

Lines changed: 16 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -98,20 +98,26 @@ import com.dynamsoft.license.LicenseManager;
9898
Add the following code inside the `main` method to initialize the license for using the SDK in the application:
9999

100100
```java
101-
try {
102-
LicenseError licenseError = LicenseManager.initLicense("DLS2eyJvcmdhbml6YXRpb25JRCI6IjIwMDAwMSJ9");
103-
if (licenseError.getErrorCode() != EnumErrorCode.EC_OK) {
104-
System.out.println("License initialization failed: ErrorCode: " + licenseError.getErrorCode() + ", ErrorString: " + licenseError.getErrorString());
105-
return;
101+
public class ReadAnImage {
102+
public static void main(String[] args) {
103+
try {
104+
LicenseError licenseError = LicenseManager.initLicense("DLS2eyJvcmdhbml6YXRpb25JRCI6IjIwMDAwMSJ9");
105+
if (licenseError.getErrorCode() != EnumErrorCode.EC_OK) {
106+
System.out.println("License initialization failed: ErrorCode: " + licenseError.getErrorCode()
107+
+ ", ErrorString: " + licenseError.getErrorString());
108+
return;
109+
}
110+
} catch (LicenseException e) {
111+
System.out.println("License initialization failed: ErrorCode: " + e.getErrorCode() + ", ErrorString: "
112+
+ e.getErrorString());
113+
return;
114+
}
115+
// codes from following steps
106116
}
107-
} catch (LicenseException e) {
108-
System.out.println("License initialization failed: ErrorCode: " + e.getErrorCode() + ", ErrorString: " + e.getErrorString());
109-
return;
110117
}
111-
// codes from following steps
112118
```
113119

114-
> The string "DLS2eyJvcmdhbml6YXRpb25JRCI6IjIwMDAwMSJ9" here is a free public trial license. Note that network connection is required for this license to work. When it expires, you can request a 30-day free trial license from the <a href="https://www.dynamsoft.com/customer/license/trialLicense?utm_source=guide&product=dbr&package=java" target="_blank">Customer Portal</a>.
120+
> The string "DLS2eyJvcmdhbml6YXRpb25JRCI6IjIwMDAwMSJ9" here is a free public trial license. Note that network connection is required for this license to work. Alternatively, you can request a 30-day free offline trial license from the <a href="https://www.dynamsoft.com/customer/license/trialLicense?utm_source=guide&product=dbr&package=java" target="_blank">Customer Portal</a>.
115121
116122
### Create a CaptureVisionRouter Instance
117123

0 commit comments

Comments
 (0)