My project has LuaJava as the script interpreter, for usage in both desktop and android via AndroLua. I want to be able to debug it, but I'm unable to arrange it.
I have tried with an Eclipse plugin, Koneki, which is poorly documented and only seems able to debug Lua-only projects. I tried doing as the tutorial but it doesn't accept my project as valid for not having lua capabilities. I tried then using a secondary project linking my Lua files, launching the debugger and then my project, but the process does not attach. I tried using the methods provided by the tutorial but they throw an "non-existing Lua method" error.
I have also tried Decoda, but despite being able of launching the executable no symbol pdb files exist so the breakpoints are not triggered.
After contacting ZeroBraneStudio's creator, it is now posible to debug AndroLua and LuaJava on his IDE.
Instructions here. This functionality is available from v0.38 onwards.
I use koneki and it works a treat for lua embedded in c/c++/objective c - it should work for luajava but haven't tried it. Whats the message you get in Koneki, there are a few things you need to setup. In particular lua socket in your path, and the debugger.lua in your LUA_PATH.
These lines in your first lua file loaded
require "socket"
local initconnection = require("debugger")
initconnection("127.0.0.1", 10000, "luaidekey")
if you still have probs leave a comment
Related
We use YAJSW (11.08) to wrap our java application as a service, but when switching to java 8, I noticed that if the application did not terminate gracefully, the .lck files generated by the logger, is not cleared.
We are in the process of switching to a new logger, but in the mean time I need a start up script to clear these .lck files.
I read here that YAJSW supports shell and groovy scritps, but the answer to this SO question answer claims it only supports groovy scripts.
As far as I can tell I need to indicate the STATE at which the script will be executed, so for me I assume that it's the START
state.
I have added this to my wrapper.conf:
wrapper.script.START=scripts/clean-up.bat
What am I missing or doing wrong? Is running scripts not available in the version I'm using? Or are shell scripts really not supported?
EDIT: Updated YAJSW to version 11.11 (latest) - still does not work
run the process from the console and see what error messages you get. I am running 11.11 with java 8 and I noticed that even though documentation specifies you want to say this:
wrapper.script.START=scripts/clean-up.bat
YAJSW already looks in the scripts directory by default, and you just have to make sure your script is in that directory. You can see the file not found error when running in the console.
My problem now is that I am getting a 'returned 1' error. I am beginning to doubt that YAJSW will run .bat files as I have made mine very simple just to test and it still fails.
I wrote a sample java agent that creates a "hello world" file in a specific place. I want it to run whenever any java applet is run (definitely including ones I didn't write myself.) How do I do that?
My agent works when I run it manually from the command line (as in, running another java file with the agent attached to it.) On the automatic front, I tried going into the java configuration panel -> Java -> View -> JRE Configuration Settings -> setting the optional arguments to attach my agent, but that doesn't seem to do the trick. I browse with FF to someplace that makes me run a java applet but no file is created.
I'm guessing I'm missing something basic here, because when I try to google this people all around various forums seem to answer it as if it's the most trivial thing: "just use -javaagent, read more about it in this (link)."
If it helps at all, this is the optional parameter I add in the configuration panel (which works when I use it manually):
-javaagent:C:\Users\admin\workspace\poc\bin\poc\myagent.jar
Update: I found out I can set an environment variable (JAVA_TOOL_OPTIONS) to -javaagent:(agentpath). Once again it works flawlessly with local java applications, but now when I browse over to a webpage with an applet, firefox auto-closes itself. IE declares the webpage broken. Chrome doesn't even display the applet. The agent itself at this point does nothing - it just has an empty premain method. Anyone?
Setting the environment variable JAVA_TOOLS_OPTIONS=-javagent:(path) is right.
My error was that I misconstructed the .jar file. Once I fixed that (simply used the jar.exe tool to make my .jar) it worked properly - locally and on all applets via firefox. Until then, that was what caused firefox to either hang or crash when encountering an applet.
I have a project that uses leap motion sdk. I wrote this project in Eclipse. When I run my program I don't have any problem because I set my native libraries as it is suggested from configuration.
However, when I export my application I can not run my program because Eclipse does not include my native libraries and I am having this error.
Native code library failed to load.
java.lang.UnsatisfiedLinkError: no LeapJava in java.library.path
My purpose is create a .jar file which user can run with one click on Windows(just). I tried this methodologies as it is suggested in stackoverflow. However, I could not get this result.
1.) method with static{ System.load("write each .dll") }
This did not work becuse I am having a error when I try to load Leapd.dll.
2.) System.setProperty("java.library.path", "C:/Users/can/Desktop/Vinar_libraries/LeapSDK/lib/x64/" );
This one also did not work.
3.) Adding -Djava.library.path="\LeapSDK\lib\x64" parameter from running configurations on Eclipse.
I know this subject is mentioned many times in stackoverflow. However, proposed solutions did not work for Leap Motion sensor.
I haven't worked with Java in about 10 years, so it's very probable I'm doing something elementary wrong here...
I am writing a "server-side extension" for SmartFoxServer (SFS). In my login script, I need to make a connection to MS SQL Server, which I am attempting to do using JDBC. I have tested the JDBC code in my debug environment, and it works fine.
BUT
When I put the server-side extension in the SFS "extensions" folder (as per spec), I'm getting a NoClassDefFoundError thrown - clearly SFS can't find the required JAR (sqljdbc4.jar). I have tried putting this JAR in my classpath; I tried including it in my Eclipse project - but for some reason, SFS adamantly refuses to accept the existence of this JAR.
What am I doing wrong?
I have no experience with the product you mention but many years of Java experience.
Have you tried putting the sqljdbc4.jar in the same location as your server-side extension (the extensions 'directory') ? You will likely have to restart SFS after this.
I am working on a team project in Java. One requirement is that we dynamically populate a drop-down menu of all classes that implement a certain interface. New classes can be added after compile time. To accomplish this we are using reflection.
Problem: All of the drop-down menus are blank on my system. I cannot for the life of me figure out why they are not populating. All other 5 team members have it working on their system.
Things I tired that didn't work:
1) Installing most recent eclipse (galileo) because rest team was using it
2) Re-install most recent java release (jdk1.6.0-17 and jre6)
3) Check PATH and JAVA_HOME variables
Any thoughts as to what else I can try or if something I did should have solved it and didn't? It is driving me crazy.
Edit:
I should have been clearer that we are developing in a team. We are using SVN for version control and we are all running the exact same source code. I even tried checking out a fresh copy of the entire tree from SVN, but I had the same issue with reflection on my system while it worked for teammates.
The team created an executable jar and that ran on everyone's system fine except for mine. Everything worked for me except the reflection bit.
You need to debug your application. This means you have to systematically explore possible causes of the problem. Here are some things that come to mind:
Could your GUI be failing rather than reflection? What if you output with System.out.println() rather than your menu?
Is your reflection code throwing an exception, and are you ignoring it?
Is your reflection code actually being called? Toss a println() in there to be sure!
Is the test for the interface suffering from a typo or similar error that's causing it to fail? Try finding classes that implement Serializable instead!
Is your reflection test running in the main thread and trying to update your GUI? You need to use SwingUtilities.invokeAndWait to get an update to the Swing worker thread.
You're working with Eclipse; Eclipse has a fantastic debugger. Set a breakpoint near where your main action is and then single step through the code.
PATH and JAVA_HOME won't help. PATH only affects dynamically-linked libraries ("native code"). JAVA_HOME is a scripting variable that happens to be used by some Java-based utilities like Ant and Tomcat; it means nothing to the Java runtime itself.
You need to be investigating the classpath, which should be specified by the -classpath option to the java command, in the Build Path in your Eclipse project properties, or in the Class-Path attribute of the main section of a JAR file if you're launching java with the -jar option.
From within your code, you should be able to list the contents of your classpath by examining the system property, "java.class.path"
System.out.println(System.getProperty("java.class.path"));
Problem solution:
Classpath leading to source code must have no spaces in it.
I am running windows XP and, for whatever reason, if the classpath that leads to the jar file or source code that is using reflection has any spaces in it, then the reflection fails.
I took the jar file that works for the rest of my team and ran it from C:\ on my system and the reflection worked perfectly fine.
I do not know why this is so please comment if you know what is happening.
Might be a long shot, but look for differences in security settings for you and your team mates. Article describing more details http://www.ibm.com/developerworks/library/j-dyn0603/ heading "Security and reflection"