How to call a java package Packages.java.net.InetAddress.getByName("www.google.com")
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
04-04-2017 11:20 PM
I am trying to call Packages.java.net.InetAddress.getByName("www.google.com") in "Scripts - Background"
But this gives me an error -
Script -
var i = Packages.java.net.InetAddress.getByName("www.google.com");
gs.print(i);
Result -
Attempted script access to inaccessible member denied - java.net.InetAddress:getByName:(Ljava/lang/String;)Ljava/net/InetAddress;
Evaluator: java.lang.SecurityException: Illegal access to method getByName(string) in class java.net.InetAddress Caused by error in script at line 1 ==> 1: var i = Packages.java.net.InetAddress.getByName("www.google.com"); 2: gs.print(i);
Background message, type:error, message: Illegal access to method getByName(string) in class java.net.InetAddress
Although a few other packages like URL executes fine -
Script -
var i = new Packages.java.net.URL("http://www.google.com");
gs.print(i.getHost());
Result -
*** Script: www.google.com
Why would InetAdress not work and other java.net classes work?
- Labels:
-
Scripting and Coding
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
04-05-2017 06:34 AM
Pranay,
Glad to see that you are using the Community to learn more.
The Customer Experience team is striving to ensure that customer queries posted from the HI Service Portal are answered in timely and accurate fashion.
If you feel your question has been resolved, please mark the appropriate reply in the thread as being the Correct Answer.
This enables other customers to learn from your thread.
Thank you in advance.
If you are viewing this from the community inbox you will not see the correct answer button. If so, please review How to Mark Answers Correct From Inbox View.
Regards,
Teena Singh
Customer Experience: UX Strategy and Customer Insights
teena.singh@servicenow.com
ServiceNow