Help with HTM.Java examples

#1

I should hypothetically already have everything for the Linux installation…I’ve never used Docker and from what I’ve heard/seen, it’s pretty difficult to use for the first time.
What do the HTM.java examples do? Where can I find them?

Problems using a Nupic example (Hotgym)
#2

There are 4 or 5 demos in the HTM.java-examples repository. You can find them and the instructions for using them at: https://github.com/numenta/htm.java-examples

Also, I would try and get in contact with @rhyolight to ask about running the Docker file for NuPIC and also get your installation going if you are a Python or C++ guy. Otherwise, HTM.java is the same code same everything (except no swarming for now and no OPF framework - there is however a Network API for its use and a wiki on how to use it.)

HTM.java is the equivalent of NuPIC except that its playing “catch up” with NuPIC for certain functionality and is community ported from NuPIC with all the same tests etc. to guarantee its compatibility.

#3

I tried running the Hotgym demo and got an error. My friend tried running it to and got basically the same error.

java.io.FileNotFoundException: C:\Users\Ayumi\Desktop\Nupic,%20mysql,%20etc\htm.java-examples-master\src\main\java\org\numenta\nupic\examples\napi\hotgym\NAPI-Hotgym-Demo-v0.6.8-alpha.jar (The system cannot find the path specified)
        at java.util.zip.ZipFile.open(Native Method)
        at java.util.zip.ZipFile.<init>(Unknown Source)
        at java.util.zip.ZipFile.<init>(Unknown Source)
        at java.util.jar.JarFile.<init>(Unknown Source)
        at java.util.jar.JarFile.<init>(Unknown Source)
        at org.numenta.nupic.network.sensor.FileSensor.getJarEntryStream(FileSensor.java:148)
        at org.numenta.nupic.network.sensor.FileSensor.<init>(FileSensor.java:78)
        at org.numenta.nupic.network.sensor.FileSensor.create(FileSensor.java:110)
        at org.numenta.nupic.network.sensor.Sensor.create(Sensor.java:75)
        at org.numenta.nupic.examples.napi.hotgym.NetworkAPIDemo.createBasicNetwork(NetworkAPIDemo.java:111)
        at org.numenta.nupic.examples.napi.hotgym.NetworkAPIDemo.<init>(NetworkAPIDemo.java:79)
        at org.numenta.nupic.examples.napi.hotgym.NetworkAPIDemo.main(NetworkAPIDemo.java:245)
Exception in thread "main" java.lang.NullPointerException
        at org.numenta.nupic.network.sensor.BatchedCsvStream.<init>(BatchedCsvStream.java:355)
        at org.numenta.nupic.network.sensor.BatchedCsvStream.batch(BatchedCsvStream.java:601)
        at org.numenta.nupic.network.sensor.FileSensor.<init>(FileSensor.java:79)
        at org.numenta.nupic.network.sensor.FileSensor.create(FileSensor.java:110)
        at org.numenta.nupic.network.sensor.Sensor.create(Sensor.java:75)
        at org.numenta.nupic.examples.napi.hotgym.NetworkAPIDemo.createBasicNetwork(NetworkAPIDemo.java:111)
        at org.numenta.nupic.examples.napi.hotgym.NetworkAPIDemo.<init>(NetworkAPIDemo.java:79)
        at org.numenta.nupic.examples.napi.hotgym.NetworkAPIDemo.main(NetworkAPIDemo.java:245)
1 Like
#4

This is not a good medium to help you debug this…

Can you join me in the Gitter chat room? https://gitter.im/numenta/htm.java

If not now then let me know when?

#5

Did you go to the directory where the jar file is after downloading, and type:

java -jar NAPI-Hotgym-Demo-v0.6.8-alpha.jar

??

That works fine for me? Do you have Java 8 installed?

Also… the “%” signs in the reported path error lets me know there is maybe something going on with the way you’re running it?

#6

@Addonis

C:\Users\Ayumi\Desktop\Nupic,%20mysql,%20etc\htm.java-examples-master\src\main\java\org\numenta\nupic\examples\napi\hotgym\NAPI-Hotgym-Demo-v0.6.8-alpha.jar

Are you still there? This is not a valid path in any operating system? How do you expect the file to be located when the path has commas and percent signs in it? :slight_smile:

I just downloaded this on a “blank” account and it runs perfectly. Please try and run it with the proper command using Java 8?

java -jar NAPI-Hotgym-Demo-v0.6.8-alpha.jar

#7

Sorry, I didn’t even notice that Matt forked the thread. I don’t really need to use the Java version if I can get the Python version to work since I think I understand Python code a little better.

Anyway, the percent signs are not in the actual name of the directory, they only show up on a web page when you copy and paste the actual directory name, commas are fine to put into a directory name though. Besides, I actually switched to the directory of the file instead of running it from another directory, so the names of the directories didn’t really matter…

I also tried running that Java code on a Ubuntu machine, and my friend also ran it on his computer. It’s basically the same exact error each time.

The error is not that it can’t find the actual jar file or anything. It knows where it is, but when it actually tries to run the jar file, it fails somewhere. So maybe the problem is with my dependencies or missing file in the .jar

Regarding the version: I just installed the latest JDK from Oracle’s website on my Windows machine. And on Linux I am using Openjdkd version “1.8.0_91”, Runtime Environment build 1.8.0.91-8u91-b14-0ubuntu~15.10.1-b14.

1 Like
#8

@Addonis I believe something changed in terms of programmatic file access of files within the Jar that you’re running a program from. The HotGym csv file has to be loaded, and I had a similar problem when I rewrote the code for the other demos (i.e. BreakingNews & FoxEats).

I can’t reproduce this one though! It works fine for me - can you try running the other demos (you’ll need to get a Free Cortical.io key before you do)? I will work on getting a dev environment up on my Windows partition - maybe I can reproduce it there?

Can anyone else reproduce this?

#9

My friend ran it on his computer. He also does Java programming so he has all the Java stuff installed but it didn’t work for him either.


getting another error about missing class now, I’ll try to fix it later

#10

I run all of these just fine… There has to be something going on with your setup…?

@rhyolight can you try running these?

java -jar NAPI-Hotgym-Demo-v0.6.8-alpha.jar
java -jar breaking-news-demo-v0.6.8-alpha.jar -K<your api key>
java -jar fox-eats-demo-v0.6.8-alpha.jar -K<your api key>

Call To Arms: Help With Running Demos
#11

Running on Windows 10 because they don’t work on my Ubuntu machine (tells me a class is missing).:

        at java.util.zip.ZipFile.open(Native Method)
        at java.util.zip.ZipFile.<init>(Unknown Source)
        at java.util.zip.ZipFile.<init>(Unknown Source)
        at java.util.jar.JarFile.<init>(Unknown Source)
        at java.util.jar.JarFile.<init>(Unknown Source)
        at org.numenta.nupic.network.sensor.FileSensor.getJarEntryStream(FileSensor.java:148)
        at org.numenta.nupic.network.sensor.FileSensor.<init>(FileSensor.java:78)
        at org.numenta.nupic.network.sensor.FileSensor.create(FileSensor.java:110)
        at org.numenta.nupic.network.sensor.Sensor.create(Sensor.java:75)
        at org.numenta.nupic.examples.napi.hotgym.NetworkAPIDemo.createBasicNetwork(NetworkAPIDemo.java:111)
        at org.numenta.nupic.examples.napi.hotgym.NetworkAPIDemo.<init>(NetworkAPIDemo.java:79)
        at org.numenta.nupic.examples.napi.hotgym.NetworkAPIDemo.main(NetworkAPIDemo.java:245)
Exception in thread "main" java.lang.NullPointerException
        at org.numenta.nupic.network.sensor.BatchedCsvStream.<init>(BatchedCsvStream.java:355)
        at org.numenta.nupic.network.sensor.BatchedCsvStream.batch(BatchedCsvStream.java:601)
        at org.numenta.nupic.network.sensor.FileSensor.<init>(FileSensor.java:79)
        at org.numenta.nupic.network.sensor.FileSensor.create(FileSensor.java:110)
        at org.numenta.nupic.network.sensor.Sensor.create(Sensor.java:75)
        at org.numenta.nupic.examples.napi.hotgym.NetworkAPIDemo.createBasicNetwork(NetworkAPIDemo.java:111)
        at org.numenta.nupic.examples.napi.hotgym.NetworkAPIDemo.<init>(NetworkAPIDemo.java:79)
        at org.numenta.nupic.examples.napi.hotgym.NetworkAPIDemo.main(NetworkAPIDemo.java:245)

Maybe I have to set some environment variables for Java and/or Nupic?


Breaking News demo works on Windows 10.

Although I don’t know if it’s doing anything, because it keeps saying “failed json” and failed “tweet” in my console. And the anomaly graph is always flat.

failed json: {'text': "RT @BBCBreaking: Scotland's economy grew 0.6% in third quarter of 2012, taking it out of recession - Scottish government", 'created_at': 'Fri Feb 01 12:04:03  2013'}
failed tweet: BBCBreaking There s No Hope For This World With People Like That u00a31000 For An Innocent Life The Contractor Should Be Held Accountable Too
failed json: {'text': "@BBCBreaking There's No Hope For This World With People Like That. \\u00a31000 For An Innocent Life, The Contractor Should Be Held Accountable Too", 'created_at': 'Fri Feb 01 12:37:24  2013'}
failed tweet: BBCBreaking Russian rocket carrying US communications satellite plunges into Pacific Ocean shortly after launch via BBCDanielS
failed json: {'text': 'RT @BBCBreaking: Russian rocket - carrying US communications satellite - plunges into Pacific Ocean shortly after launch - via @BBCDanielS', 'created_at': 'Fri Feb 01 12:52:15  2013'}
failed tweet: BBCBreaking One dead after apparent suicide bombing outside US embassy in Turkey s capital Ankara state media   t co XUKRGVx1
failed json: {'text': "RT @BBCBreaking: One dead after apparent suicide bombing outside US embassy in #Turkey's capital #Ankara - state media http:\\/\\/t.co\\/XUKRGVx1", 'created_at': 'Fri Feb 01 13:03:17  2013'}


The cortical.io thing opens but when I press start it does nothing, and in my console I get some error messages:

>java -jar fox-eats-demo-v0.6.8-alpha.jar -K25216680-202q-11e6-a057-97f4c970893chj
f**** problem: file:/C:/Users/Ayumi/Desktop/Nupic,%20mysql,%20etc/htm.java-examples-master/src/main/java/org/numenta/nupic/examples/cortical_io/foxeats/fox-eats-demo-v0.6.8-alpha.jar!/org/numenta/nupic/datagen/foxeat.csv
adjust: file:/C:/Users/Ayumi/Desktop/Nupic,%20mysql,%20etc/htm.java-examples-master/src/main/java/org/numenta/nupic/examples/cortical_io/foxeats/fox-eats-demo-v0.6.8-alpha.jar!org/numenta/nupic/datagen/foxeat.csv
adjust url: file:/C:/Users/Ayumi/Desktop/Nupic,%20mysql,%20etc/htm.java-examples-master/src/main/java/org/numenta/nupic/examples/cortical_io/foxeats/fox-eats-demo-v0.6.8-alpha.jar!org/numenta/nupic/datagen/foxeat.csv
adjust retVal: C:\Users\Ayumi\Desktop\Nupic,%20mysql,%20etc\htm.java-examples-master\src\main\java\org\numenta\nupic\examples\cortical_io\foxeats\fox-eats-demo-v0.6.8-alpha.jar!org\numenta\nupic\datagen\foxeat.csv
java.io.FileNotFoundException: C:\Users\Ayumi\Desktop\Nupic,%20mysql,%20etc\htm.java-examples-master\src\main\java\org\numenta\nupic\examples\cortical_io\foxeats\fox-eats-demo-v0.6.8-alpha.jar (The system cannot find the path specified)
        at java.util.zip.ZipFile.open(Native Method)
        at java.util.zip.ZipFile.<init>(Unknown Source)
        at java.util.zip.ZipFile.<init>(Unknown Source)
        at java.util.jar.JarFile.<init>(Unknown Source)
        at java.util.jar.JarFile.<init>(Unknown Source)
        at org.numenta.nupic.network.sensor.FileSensor.getJarEntryStream(FileSensor.java:155)
        at org.numenta.nupic.examples.cortical_io.foxeats.FoxEatsDemo.getInputDataStream(FoxEatsDemo.java:541)
        at org.numenta.nupic.examples.cortical_io.foxeats.FoxEatsDemo.readInputData(FoxEatsDemo.java:510)
        at org.numenta.nupic.examples.cortical_io.foxeats.FoxEatsDemoView.startNetwork(FoxEatsDemoView.java:158)
        at org.numenta.nupic.examples.cortical_io.foxeats.FoxEatsDemoView.lambda$9(FoxEatsDemoView.java:147)
        at com.sun.javafx.application.PlatformImpl.lambda$null$173(PlatformImpl.java:295)
        at java.security.AccessController.doPrivileged(Native Method)
        at com.sun.javafx.application.PlatformImpl.lambda$runLater$174(PlatformImpl.java:294)
        at com.sun.glass.ui.InvokeLaterDispatcher$Future.run(InvokeLaterDispatcher.java:95)
        at com.sun.glass.ui.win.WinApplication._runLoop(Native Method)
        at com.sun.glass.ui.win.WinApplication.lambda$null$148(WinApplication.java:191)
        at java.lang.Thread.run(Unknown Source)
Exception in thread "JavaFX Application Thread" java.lang.NullPointerException
        at org.numenta.nupic.examples.cortical_io.foxeats.FoxEatsDemo.readInputData(FoxEatsDemo.java:515)
        at org.numenta.nupic.examples.cortical_io.foxeats.FoxEatsDemoView.startNetwork(FoxEatsDemoView.java:158)
        at org.numenta.nupic.examples.cortical_io.foxeats.FoxEatsDemoView.lambda$9(FoxEatsDemoView.java:147)
        at com.sun.javafx.application.PlatformImpl.lambda$null$173(PlatformImpl.java:295)
        at java.security.AccessController.doPrivileged(Native Method)
        at com.sun.javafx.application.PlatformImpl.lambda$runLater$174(PlatformImpl.java:294)
        at com.sun.glass.ui.InvokeLaterDispatcher$Future.run(InvokeLaterDispatcher.java:95)
        at com.sun.glass.ui.win.WinApplication._runLoop(Native Method)
        at com.sun.glass.ui.win.WinApplication.lambda$null$148(WinApplication.java:191)
        at java.lang.Thread.run(Unknown Source)

EDIT: I just tried running hotgym demo again on my Ubuntu, and it worked!

#12

They all work for me.