cancel
Showing results for 
Search instead for 
Did you mean: 
cancel
Showing results for 
Search instead for 
Did you mean: 

Community Tip - Did you get an answer that solved your problem? Please mark it as an Accepted Solution so others with the same problem can find the answer easily. X

extension

Test_user
10-Marble

extension

Below line of  code has been written in thingworx java extension in eclipse

InputStream in=TestThingShape.class.getResourceAsStream("test.xlsx");  

 

Where does the file test.xlsx is present in Thingworx server?

 

Please help me over here.

 

2 REPLIES 2

check out in following path, if it is windows..

 

C:\Program Files (x86)\ThingWorxFoundation\tomcat\apache-tomcat-9.0.62\test.xslx

Also refer following post..

https://community.ptc.com/t5/ThingWorx-Developers/Thingworx-java-extension/m-p/857179#M61298

https://community.ptc.com/t5/ThingWorx-Developers/Thingworx-extension-java/m-p/858158#M61345

 

The response is a bit more complex than that. Class#getResourceAsStream allows you to access files on the Java classpath, i.e. embedded inside the JARs. Your test.xlsx should be packaged in the same JAR as your TestThingShape, side-by-side with TestThingShape.class file. The JAR is then zipped together with metadata.xml to produce the extension bundle.

 

Details: https://docs.oracle.com/en/java/javase/11/docs/api/java.base/java/lang/Class.html#getResourceAsStream(java.lang.String)

Announcements


Top Tags