I am entering the space invaders code on netbeans from this website on my macbook pro and I cannot figure out this error. please help. I think it might have to do with my image location but im not sure.
http://zetcode.com/tutorials/javagamestutorial/spaceinvaders
the error says this when I try to run the program:
run:
Exception in thread "main" java.lang.NullPointerException
at javax.swing.ImageIcon.<init>(ImageIcon.java:217)
at Board.gameInit(Board.java:58)
at Board.<init>(Board.java:45)
at SpaceInvaders.<init>(SpaceInvaders.java:8)
at SpaceInvaders.main(SpaceInvaders.java:18)
Java Result: 1
BUILD SUCCESSFUL (total time: 2 seconds)
thanks
You are missing the image files which should be in the folder "spacepix" according to the code on the website.
Since they cannot be found in your project path at the given location the nullpointer-exception is thrown.
Related
I am learning to solve some optimisation programs using google or-tools.
I started with their example code and I an trying to run it in intellij.
But when I write the code and compile I get the following error.
Exception in thread "main" java.lang.UnsatisfiedLinkError: com.google.ortools.linearsolver.operations_research_linear_solverJNI.MPSolver_CLP_LINEAR_PROGRAMMING_get()I
at com.google.ortools.linearsolver.operations_research_linear_solverJNI.MPSolver_CLP_LINEAR_PROGRAMMING_get(Native Method)
at com.google.ortools.linearsolver.MPSolver$OptimizationProblemType.<clinit>(MPSolver.java:221)
I searched for some answers and I found that it requires jniortools.dll .
But I am working with ubuntu. Hence i assume i need to load the libjniortools.so file , am I right?.
So I included the line
static {
System.loadLibrary("libjniortools");
}
and I have a lib folder wherein I have put both com.google.ortools.jar and protobuf.jar along with all the other lib files that were present when I extracted the zip file(basically copy pasted the lib folder from extracted zip file).
I have added the jar paths in intellij as shown in figure
enter image description here
*the last 2 line of dependency in image
Then I have also tried giving the lib path in VM-options:
-Djava.library.path=/home/surajvashistha/IdeaProjects/LPModel/lib
After all this, I get the following error
Exception in thread "main" java.lang.UnsatisfiedLinkError: no libjniortools in java.library.path
at java.lang.ClassLoader.loadLibrary(ClassLoader.java:1860)
at java.lang.Runtime.loadLibrary0(Runtime.java:871)
at java.lang.System.loadLibrary(System.java:1124)
at LP.<clinit>
I am stuck here and not able to move forward. Can anyone help?
I ran into a problem, I need Jitsi Meet and DartSIPUa in the project, but when I put them together it gives a duplicate error, I attached the log below. Can you also explain to me why my Flutter project that has JitsiMeet uses react-native-webrtc?
I tried for a long time to find what the reason might be, as long as JitsiMeet works separately from DartSIPUa, everything is fine, but I need them in one app, how can I do this?
Thank you all in advance for your help.
Log: https://pastebin.com/2RT30qEs
FAILURE: Build failed with an exception.
* What went wrong:
Execution failed for task ':app:checkDebugDuplicateClasses'.
> 1 exception was raised by workers:
java.lang.RuntimeException: java.lang.RuntimeException: Duplicate class org.webrtc.AndroidVideoDecoder found in modules classes.jar (org.webrtc:google-webrtc:1.0.28262) and libwebrtc.jar (com.facebook.react:react-native-webrtc:1.75.3-jitsi-4429568)
Duplicate class org.webrtc.AndroidVideoDecoder$1 found in modules classes.jar (org.webrtc:google-webrtc:1.0.28262) and libwebrtc.jar (com.facebook.react:react-native-webrtc:1.75.3-jitsi-4429568)
found a github issue
TLDR
I solved the two above problems as following:
First problem (:app:checkDebugDuplicateClasses)
solution was: Through android studio
File > Invalidate Caches/Restart...
Second problem (:app:mergeDebugJavaResource)
The solution was:
Due to the generated build file path exceeds the windows max path length of 255 characters.
Only trying to use short names to make sure the project path is not too long, solved the problem.
This is the path in my machine:
C:\Users\Hakim.gradle\caches\modules-2\files-2.1\io.flutter\x86_64_debug\1.0.0-a67792536ca236a971d0efbcfd7af4efb8f6c119\1ae520cbbf7e14af867232784194366b3d1c3f34\x86_64_debug-1.0.0-a67792536ca236a971d0efbcfd7af4efb8f6c119.jar
You can find the path in your machine and change the long file name to short one.
else try downgrading your flutter version
When i run the operation ionic serve it fails to compile and gives an error code that says:
ERROR in ./src/global.scss (./node_modules/#angular-devkit/build-
angular/src/angular-cli-files/plugins/raw-css-
loader.js!./node_modules/postcss-loader/src??embedded!./node_modules/
sass-loader/lib/loader.js??ref--14-3!./src/global.scss)
Module build failed (from ./node_modules/postcss-loader/src/index.js):
Error: Failed to find '#ionic/angular/css/display.css'
in [
C:project/src
]
at resolveModule.catch.catch (project\node_modules\postcss-
import\lib\resolve-id.js:35:13)
This is a piece of code i tried to integrate into my own project which opens the camera to take a picture and you can either upload the picture or delete it. I tried searching for "#ionic/angular/css/display.css" on the internet but couldn't find a solution. I started ionic just recently so i don't understand much about it.
If anyone wants to see the code It is here The original i took it from had the code at home.page.ts but i needed it at tab1.page.ts so the error may be born from this. Also global.scss
The method i used to solve the problem is importing "#ionic/angular/css/display.css". I did it manually taking it from a project where it exists and copying it to the Project which gives the error.
I am having trouble compiling the Distriqt Facebook ANE for Android.
It works fine on iOS but not on Android.
The error message is:
dx tool failed:
UNEXPECTED TOP-LEVEL ERROR: java.lang.OutOfMemoryError: Java heap
space at
com.android.dx.cf.code.ExecutionStack.copy(ExecutionStack.java:66) at
com.android.dx.cf.code.Frame.copy(Frame.java:98) at
com.android.dx.cf.code.Ropper.processBlock(Ropper.java:786) at
com.android.dx.cf.code.Ropper.doit(Ropper.java:742) at
com.android.dx.cf.code.Ropper.convert(Ropper.java:349) at
com.android.dx.dex.cf.CfTranslator.processMethods(CfTranslator.java:280)
at
com.android.dx.dex.cf.CfTranslator.translate0(CfTranslator.java:137)
at com.android.dx.dex.cf.CfTranslator.translate(CfTranslator.java:93)
at com.android.dx.command.dexer.Main.processClass(Main.java:729) at
com.android.dx.command.dexer.Main.processFileBytes(Main.java:673) at
com.android.dx.command.dexer.Main.access$300(Main.java:83) at
com.android.dx.command.dexer.Main$1.processFileBytes(Main.java:602)
at
com.android.dx.cf.direct.ClassPathOpener.processArchive(ClassPathOpener.java:284)
at
com.android.dx.cf.direct.ClassPathOpener.processOne(ClassPathOpener.java:166)
at
com.android.dx.cf.direct.ClassPathOpener.process(ClassPathOpener.java:144)
at com.android.dx.command.dexer.Main.processOne(Main.java:632) at
com.android.dx.command.dexer.Main.processAllFiles(Main.java:510) at
com.android.dx.command.dexer.Main.runMonoDex(Main.java:280) at
com.android.dx.command.dexer.Main.run(Main.java:246) at
com.android.dx.command.dexer.Main.main(Main.java:215) at
com.android.dx.command.Main.main(Main.java:106)
ADT command line:
...
Tried with AIR18 and AIR 16 (updated dx.jar from distriqt tutorial).
My manifest includes all 3 needed extensions:
<extensionID>com.distriqt.Core</extensionID>
<extensionID>com.distriqt.GooglePlayServices</extensionID>
<extensionID>com.distriqt.FacebookAPI</extensionID>
Removing GooglePlayServices makes compilation possible but app crashes when initializing the FacebokAPI.
Using AIR16 without the updated dx.jar also crashes the app directly at startup. The catlog states the following exception:
08-23 14:53:14.793 E/AndroidRuntime(3178): java.lang.RuntimeException:
Unable to get provider com.facebook.FacebookContentProvider:
java.lang.ClassNotFoundException: com.facebook.FacebookContentProvider
in loader
dalvik.system.PathClassLoader[/data/app/air.my.com.zas.lefiner-1.apk]
08-23 14:53:14.793 E/AndroidRuntime(3178): Caused by:
java.lang.ClassNotFoundException: com.facebook.FacebookContentProvider
in loader
dalvik.system.PathClassLoader[/data/app/air.my.com.zas.lefiner-1.apk]
Oddly enough the Distriqt GooglePlusANE which uses Core and GooglePlayServices works fine on both platforms. So i strongly assume there is something wrong with the FacebookAPI extension.
Any help is very much appreciated!
If You are using Intellij IDEA increase Compiler heap size in Actionscript & Flex compiler. This fixed the issue for me.
Got the source ["bengottlieb / Twitter-OAuth-iPhone"][1]
I added the existing folder "Twitter+OAuth" to my project.
Fixed Target to include libxml2.dylib and libOAuth.a
Fixed Header & Library Search Paths, just like DEMO project did.
Building itself is fine. Only showing warnings about MGTwitterEngine's parsing issues.
However, when I try to run on my actual device, it's showing following error messagess at below.
Can anyone guide how to use bengottlieb source? This is the best source for my project, and I can't find the right way to add this to my project in Xcode. Thank you.
run
Running…
Ignoring packet error, continuing...
gdb stack trace at 'putpkt: write failed':
0 gdb-arm-apple-darwin 0x0018dc33 remote_backtrace_self + 54
I've got the answer from the source creator, and he guided me to simply restart device, and it worked.
Thank you, Mr. Gottlieb
(GitHub Profile: http://github.com/bengottlieb)
제가 아는 동혁이 형인가요? 저도 시뮬레이터에서 동작하는데 디바이스에서는 다른 에러 메시지를 보이네요. 트위터 서버인 척을 한다고. MGtweeterEngine 사용했습니다. 앗! 저도 리붓하고 나니 동작하네요. 감사합니다.