eclipse hangs when run application (application runs fine, eclipse is what hangs) - java

I have a single application which will cause eclipse itself to hang when run via eclipse. If I export this application as a jar and run it it works fine. But if I run (or debug) it the application will appear to start (according to ps) and run; but eclipse itself will hang, and is reported as a 'stopped' program with no CPU or memory usage. I've placed a breakpoints on the first line of this application and it doesn't even get there before eclipse ends up stopped. If I forcefully wake eclipse out of stopped state it will work; but it will also lose it's connection with the program I started. My program I want to debug will continue running but eclipse can't control or kill it after I resume the stopped eclipse.
I can run plenty of other applications without issue from eclipse. Oddly I had this issue before, then I could run my application for a day, and now I'm back to the original issue. I don't know what changed between those that would matter.
Can anyone suggest what may cause this or how to repair it?
UPDATE:
I did some more linux magic. It seems that eclipse is stopped while waiting for the command:
sh -c stty -lcanon min 1
It also seems that before that there was a sh (defunct) command which also hung without being reaped for a few minutes which I think was keeping eclipse from running properly; the sh (defunct) finally goes away if I wait long enough; but then the sh command I just linked comes up. I don't know what the original defunct SH command was; I can't do ps fast enough to catch it before it goes defunct. Both issues occur only with eclipse; as a jar file this program runs perfectly fine.
My running assumption is that eclipse isn't getting or handling the sigchild correctly? that would explain the sh (defunct) application at least. It doesn't explain the current SH command which doesn't show as defunct; despite it being something that should execute in seconds?
UPDATE 2.0:
I found this link: http://linux.about.com/od/srl_howto/a/hwtsrl13t04_3.htm basically stty is known to hang when it uses the < /dev/tty syntax; which is why the syntax is deprecated and replaced with a newer syntax. I'm pretty sure this is the problem. Sadly I have no way of figuring out what library is using the deprecated command. I think this all started with the ConsoleReader being constructed; but who knows what code actually ran the command that freezes? also, it seems if this was that broken anyone running consoleReader from eclipse on a linux environment would have the same problem; which I think is safe to assume isn't the case or it would be documented all over the net; so maybe my understanding is still off?

It is related to the configuration of the stty process that is created to attach the console and hence will occur only on UNIX like systems. Seems fixed on current 2.11 jline version.
To bypass the problem you can disable the special unix-terminal capabilities using:
-Djline.terminal=none
as VM argument on the eclipse launch configuration.

Try increasing -Xms<abc>m/-Xmx<efg>m (depending on the system memory) on eclipse.ini in the root directory of eclipse installation.

The problem was that we were using an older version of 'jline' which used deprecated functionality. The new jline jar fixed the problem, as it no longer used the deprecated stty calls. I'm not quite certain why eclipse caused this to happen every time; it seems as if it should be an intermittent error, but jline was definitely the cause.

Related

eclipse terminates programs without an error

Eclipse has begun terminating any program I try to run before it does anything. The only output is 4.12 printed to the console. It's not just one program with errors, I've tried running old programs that I know worked before but they all exit with 4.12 being printed out.
I tried downloading a new version of eclipse (Mars.1 Release (4.5.1)) but it hasn't really done anything. In the old version it was exiting everything with the code 4.11 so I've run out of ideas to get this to work again.
EDIT
I'm on a mac, using 64-bit.
None of my programs run, I haven't just been leaving the main() empty.
I tried running from the command line and all my programs have changed type from .java to .class
The error I got in the command line was
Class names, 'HelloWorld', are only accepted if annotation processing is explicitly requested
The program running was just hello world.
Try to run your programs via command line, outside of Eclipse, just to make sure it's not an IDE configuration. If still your programs fail, try to re-install your JRE/JDK.
if still the problem occurs - provide us with the exact command line errors.

Readline support when running programs in Eclipse

I've just started using JLine for console input in my programs. In a bash shell, this works great. In the Eclipse Console view, nothing useful works - no history, no command completion.
Is there a way to get this working? (I'm on OSX in case that's relevant).
Note: I've looked at the Local Terminal plugin (https://code.google.com/p/elt/) and the TM Terminal (https://marketplace.eclipse.org/content/tm-terminal) but these both seem to be about running a general terminal, rather being used as a terminal for the programs I'm running. However, I may be missing something.

Opening JAR with building-tools?

I am trying to run the JAR "buildtools.jar" but a message keeps popping up:
The Java JAR file "BuildTools.jar" could not be launched.
in smaller writing underneath:
Check the Console for possible error messages.
The console says
12/31/14 10:19:44.021 AM WindowServer[113]: _CGXGetWindowMovementGroup: Operation on a window 0x14 requiring rights 0x5 by caller Dashboard or 12/31/14 10:19:44.021 AM DashboardClient[2747]: _NXMoveWindow: error moving window (1000)
every time I try to open the jar thing up. I know that my Java is updated because I updated before trying anything with this.
I am trying to create a minecraft server with spigot and if you have a step by step process or any hinters about please tell me but my main focus is opening up the jar.
Unfortunately this isn't the very right place to ask this question. You can ask this question at the Spigot Forums.
Are you using the very latest version of BuildTools? You seem like running on MacOS. You may need to run it with this flag, -Dmac.supported=true(refer to this post). Also, The Java JAR file "BuildTools.jar" could not be launched. most likely, you have a broken Jar file. Try to re-download it from {1}(I need 10 population to post more than 2 links). You will also need JDK(Java Development Kits) but I think it is came by default in MacOS and Git {2}.
After you've installed all required things, you can run the BuildTools from Terminal by java -Dmac.supported=true -jar BuildTools.jar You need to wait few minutes for it to be finished.

Hadoop setup - Java trying to access window server

When I launch start-dfs.sh in Hadoop 2.2.0 on Mac OS X, buried in the error messages, I have this:
2014-02-24 14:48:23,448 FATAL org.apache.hadoop.hdfs.server.datanode.DataNode: Exception in secureMain
java.lang.InternalError: Can't connect to window server - not enough permissions.
at java.lang.ClassLoader$NativeLibrary.load(Native Method)
at java.lang.ClassLoader.loadLibrary0(ClassLoader.java:1833)
at java.lang.ClassLoader.loadLibrary(ClassLoader.java:1730)
...
I've dealt with this error before - it happens when Java is trying to access the window server (even though it's a command line program). For security reasons, this isn't allowed without a graphical login. This of course means that if you're running a headless server, you have to physically log in before your daemons run.
Now, without going into a rant about how STUPID Java and/or the developers are for doing this (it seems to be a trend; the only other Java server component I use does the same thing), I found the option:
-Djava.awt.headless=true
which looks like a possible solution. But not only do I have no idea where to pass the option to Hadoop, but I tried it on the other software, and it still gives the error.
I'd appreciate any help.
So I tried it, and it turns out there's two things going on. The option DOES in fact work... for Hadoop. But here's where it gets weird:
Hadoop won't append to a log file... if one exists, it leaves it and silently fails to write any logs. So I was looking at old log files.
The other software still doesn't work, but they said they're aware of the bug and they're fixing it.
I fixed it using:
export HADOOP_OPTS="-Djava.security.krb5.realm=OX.AC.UK -Djava.security.krb5.kdc=kdc0.ox.ac.uk:kdc1.ox.ac.uk -Djava.awt.headless=true"
in my bashrc

Debugging a jnlp application with Eclipse

I can't seem to be able to debug a JNLP application with Eclipse. The problem I'm getting is very similar to that described in this SO question, i.e., javaws appears to be starting the VM twice. The first time it starts fine with the remote debugging options and provided I use the suspend=y option I can even attach the Eclipse debugger to the VM, but as soon as it attaches the VM dies and javaws starts it again without the debugging options.
Here's how I'm launching the app:
javaws -J-Xdebug -J-Xnoagent -J-Djava.compiler=NONE -J-Xrunjdwp:transport=dt_socket,address=8989,server=y,suspend=y http://myserver/launch.jnlp
Since I have suspend=y, whilst it's waiting for a debugger to attach I can use ps -ef | grep java to see the java process with all the correct options running. Indeed, I can connect the Eclipse debugger to it, but as soon as I do that the process terminates and javaws starts a new java process. If I subsequently do another ps I can see a new (different PID) java process now without the debugging options. Attempting to connect to this process from Eclipse just gives "connection refused".
I'm using Java 6 on Mac OS X Lion 10.7.3 if that makes any difference.
The author of the SO question I mentioned above says he solved the problem apparently by accident so the cause of the problem is not apparent (or I'm too stupid to get it).
Any ideas?
Check if you have more then Java 7 update 67.
If you do I know that oracle has open bug for this.
some how from update 67 and above there is problem with this.
I had the same problem. I roll back to Java 7 update 60 and now its working fine.
I suggesting to remove all Java installation and then install

Categories