dsteves8000 / NumberOfEndlessLevelsOverlay

My quick program I made that is used occasionally on my stream (twitch.tv/dsteves) which keeps track of the most recent progress made. When the "comma" button is pressed, it updates the program accordingly.
0 stars 0 forks source link

Issues compiling and running #1

Open kyle95wm opened 4 years ago

kyle95wm commented 4 years ago

I'm having issues compiling and running. Here is my terminal log:


kylewarwick-mathieu@Kyles-iMac Downloads % javac MM2.java
MM2.java:3: error: package org.jnativehook does not exist
import org.jnativehook.GlobalScreen; 
                      ^
MM2.java:4: error: package org.jnativehook.keyboard does not exist
import org.jnativehook.keyboard.NativeKeyEvent; 
                               ^
MM2.java:5: error: package org.jnativehook.keyboard does not exist
import org.jnativehook.keyboard.NativeKeyListener; 
                               ^
MM2.java:7: error: cannot find symbol
public class MM2 implements NativeKeyListener 
                            ^
  symbol: class NativeKeyListener
MM2.java:22: error: cannot find symbol
   public void nativeKeyPressed(NativeKeyEvent e)   
                                ^
  symbol:   class NativeKeyEvent
  location: class MM2
MM2.java:51: error: cannot find symbol
   public void nativeKeyReleased(NativeKeyEvent e){}   
                                 ^
  symbol:   class NativeKeyEvent
  location: class MM2
MM2.java:52: error: cannot find symbol
   public void nativeKeyTyped(NativeKeyEvent e){}    
                              ^
  symbol:   class NativeKeyEvent
  location: class MM2
MM2.java:15: error: cannot find symbol
      try { GlobalScreen.registerNativeHook(); }        
            ^
  symbol:   variable GlobalScreen
  location: class MM2
MM2.java:17: error: cannot find symbol
      GlobalScreen.getInstance().addNativeKeyListener(new MM2());     
      ^
  symbol:   variable GlobalScreen
  location: class MM2
MM2.java:28: error: cannot find symbol
      String kP = NativeKeyEvent.getKeyText(e.getKeyCode());    
                  ^
  symbol:   variable NativeKeyEvent
  location: class MM2
10 errors
kylewarwick-mathieu@Kyles-iMac Downloads % javac -classpath ./JNativeHook1.1.jar MM2.java
kylewarwick-mathieu@Kyles-iMac Downloads % java MM2 
Error: Could not find or load main class MM2
Caused by: java.lang.NoClassDefFoundError: org/jnativehook/keyboard/NativeKeyListener
kylewarwick-mathieu@Kyles-iMac Downloads % java -classpath ./JNativeHook1.1.jar MM2 
Error: Could not find or load main class MM2
Caused by: java.lang.ClassNotFoundException: MM2
kylewarwick-mathieu@Kyles-iMac Downloads % ```

Any suggestions?
dsteves8000 commented 4 years ago

You need to attach the JNativeHook jar file I enclosed to your classpaths under settings. If it doesn't work I still have the older version of it in the code commented out (runaverage function), but there wont be any background input functionality, forcing the IDE to be in the foreground preventing you from using it during streaming.

kyle95wm commented 4 years ago

Yeah, I think I'd be better off using the older version of the code (assuming I don't need to include anything in classpaths) since I don't really care about background input. I just want the program to work just as easily as your other one did. I was even able to run your program from the terminal as well without using an IDE like what you talked about on stream. All I did at the time was compile with javac and run with java similar to how you run a program in terminal (python, bash, etc)

kyle95wm commented 4 years ago

Oh and I also get this when I do try adding the jar to my classpaths, compile and run the program:


kylewarwick-mathieu@Kyles-iMac Downloads % java MM2
Error: Could not find or load main class MM2
Caused by: java.lang.ClassNotFoundException: MM2```
kyle95wm commented 4 years ago

Update:

I was able to run it in JGRASP (probably not my first choice tbh) and it works. My only issue was that I needed to allow access to my keyboard and mouse (macOS security measures)

So now I'm wondering if the same can be done in a terminal instead of an IDE

Edit: If this helps, when compiling with javac I get a MM2.classs file in the same directory as the MM2.java file