RITAccess / JBrick

An accessible Lego Mindstorms NXT programming environment for students and hobbyists.
3 stars 0 forks source link

Using the compile button in JBrick gives an exception? #11

Closed f4ngy closed 10 years ago

f4ngy commented 10 years ago

The 2013 winter jar seems to have compiling working, but when I run the existing code and press the compile button I get a null pointer exception. I tried checking out JBrick's code at various old commits and they all seem to give the null pointer exception. So I'm not sure how the 2013 winter jar has compiling working?

Exception in thread "AWT-EventQueue-0" java.lang.NullPointerException at com.jbricx.swing.communications.CompilerRunner.getCompilerPath(CompilerRunner.java:138) at com.jbricx.swing.communications.CompilerRunner.compile(CompilerRunner.java:60) at com.jbricx.swing.communications.NXTManager.compile(NXTManager.java:120) at com.jbricx.swing.actions.CompileAction.doRun(CompileAction.java:64) at com.jbricx.swing.actions.AbstractCompilerAction.run(AbstractCompilerAction.java:64) at com.jbricx.swing.actions.CompileAction.actionPerformed(CompileAction.java:59) at javax.swing.AbstractButton.fireActionPerformed(Unknown Source) at javax.swing.AbstractButton$Handler.actionPerformed(Unknown Source) at javax.swing.DefaultButtonModel.fireActionPerformed(Unknown Source) at javax.swing.DefaultButtonModel.setPressed(Unknown Source) at javax.swing.plaf.basic.BasicButtonListener.mouseReleased(Unknown Source) at java.awt.AWTEventMulticaster.mouseReleased(Unknown Source) at java.awt.Component.processMouseEvent(Unknown Source) at javax.swing.JComponent.processMouseEvent(Unknown Source) at java.awt.Component.processEvent(Unknown Source) at java.awt.Container.processEvent(Unknown Source) at java.awt.Component.dispatchEventImpl(Unknown Source) at java.awt.Container.dispatchEventImpl(Unknown Source) at java.awt.Component.dispatchEvent(Unknown Source) at java.awt.LightweightDispatcher.retargetMouseEvent(Unknown Source) at java.awt.LightweightDispatcher.processMouseEvent(Unknown Source) at java.awt.LightweightDispatcher.dispatchEvent(Unknown Source) at java.awt.Container.dispatchEventImpl(Unknown Source) at java.awt.Window.dispatchEventImpl(Unknown Source) at java.awt.Component.dispatchEvent(Unknown Source) at java.awt.EventQueue.dispatchEventImpl(Unknown Source) at java.awt.EventQueue.access$200(Unknown Source) at java.awt.EventQueue$3.run(Unknown Source) at java.awt.EventQueue$3.run(Unknown Source) at java.security.AccessController.doPrivileged(Native Method) at java.security.ProtectionDomain$1.doIntersectionPrivilege(Unknown Source) at java.security.ProtectionDomain$1.doIntersectionPrivilege(Unknown Source) at java.awt.EventQueue$4.run(Unknown Source) at java.awt.EventQueue$4.run(Unknown Source) at java.security.AccessController.doPrivileged(Native Method) at java.security.ProtectionDomain$1.doIntersectionPrivilege(Unknown Source) at java.awt.EventQueue.dispatchEvent(Unknown Source) at java.awt.EventDispatchThread.pumpOneEventForFilters(Unknown Source) at java.awt.EventDispatchThread.pumpEventsForFilter(Unknown Source) at java.awt.EventDispatchThread.pumpEventsForHierarchy(Unknown Source) at java.awt.EventDispatchThread.pumpEvents(Unknown Source) at java.awt.EventDispatchThread.pumpEvents(Unknown Source) at java.awt.EventDispatchThread.run(Unknown Source)

Thoughts:

Perhaps the compile button doesn't work in Eclipse? Maybe it can only work after the project is a jar?

f4ngy commented 10 years ago

Spoke with Dan Larsen and he was able to replicate the error as well.

"I haven't use java or this in a while so I'm not sure how to fix it offhand (certainly willing to try just because its an interesting problem though) my guess is it can't get the resource for the nbc.exe which is the compiler exe. the problem I think comes down to how java(and eclipse by proxy) reference resources. if you recall from projects you may have done in the past, referencing things in jars is much different than in eclipse because of relative paths"

So it sounds like this problem might not exist when JBrick is run as a jar. We can't seem to get the jar working when it's made with Eclipse, so I think we need to take a look at the ant stuff and create the jar using that :/!

f4ngy commented 10 years ago

Okay so Dan came up with a solution!

"i remember there being a problem with the path finding of the nxc. the cheap fix is: go to preferences and set the location of the nxc.exe (its in /lib)"

I tried this out and it works. So this problem only occurs when you're running JBrick from Eclipse..when you're running it from a jar, it should be able to find the exe on its own. So I'm going to say that this isn't technically a bug and mark it closed.

I'm going to include this problem in the FAQ since I think it's likely other people will encounter it.

dfehrenbach commented 10 years ago

Nice work! This may also be a lead for solving why the driver can't be found on mac. (Or maybe, it's just simply not compatible).

~Danny

On Fri, Feb 14, 2014 at 10:08 AM, Lindsey notifications@github.com wrote:

Okay so Dan came up with a solution!

"i remember there being a problem with the path finding of the nxc. the cheap fix is: go to preferences and set the location of the nxc.exe (its in /lib)"

I tried this out and it works. So this problem only occurs when you're running JBrick from Eclipse..when you're running it from a jar, it should be able to find the exe on its own. So I'm going to say that this isn't technically a bug and mark it closed.

Reply to this email directly or view it on GitHubhttps://github.com/RITAccess/JBrick/issues/11#issuecomment-35091381 .