Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Command failed: /bin/sh -c #25

Closed
SlimeQ opened this issue Jan 8, 2016 · 16 comments
Closed

Command failed: /bin/sh -c #25

SlimeQ opened this issue Jan 8, 2016 · 16 comments

Comments

@SlimeQ
Copy link
Contributor

SlimeQ commented Jan 8, 2016

autocomplete-java: Error: Command failed: /bin/sh -c "/usr/lib/jvm/java-8-oracle/bin/javap" -classpath "/home/quincy/work/birt-service/.:/home/quincy/work/birt-service/lib/:/home/quincy/work/birt-service/build/libs/" com.mobileagility.service.birt.filter.ReportFilter

Ubuntu 14.04, latest autocomplete-java update. this seems to be happening repeatedly for various classes in my project

@keskiju
Copy link
Owner

keskiju commented Jan 9, 2016

Your classpath is probably now:

.:./lib/:./build/libs/

You should use * when you are looking for jar files, so try modifying it to:

.:./lib/*:./build/libs/*

And if it doesn't work, try moving your java package hierarchy to a separate src-directory so that java packages and jars files do not mix up in the classpath:

./src:./lib/*:./build/libs/*

And finally, if nothing seems to work, try running the same on command line and then modify it to figure out, what is wrong with it:

javap -classpath "/home/quincy/work/birt-service/.:/home/quincy/work/birt-service/lib/:/home/quincy/work/birt-service/build/libs/" com.mobileagility.service.birt.filter.ReportFilter

@keskiju
Copy link
Owner

keskiju commented Jan 9, 2016

Also check that class file for com.mobileagility.service.birt.filter.ReportFilter exists. It might be that compilation has failed and therefore ReportFilter.class does not exist at all.

@SlimeQ
Copy link
Contributor Author

SlimeQ commented Jan 9, 2016

thanks for your quick response!

my classpath is starred, though i'm not sure why the stars were omitted in the command. running the command as given just prints help

quincy@sandy:~/work/birt-service$ /bin/sh -c "/usr/lib/jvm/java-8-oracle/bin/javap" -classpath "/home/quincy/work/birt-service/.:/home/quincy/work/birt-service/lib/:/home/quincy/work/birt-service/build/libs/" com.mobileagility.service.birt.filter.ReportFilter
Usage: javap <options> <classes>
where possible options include:
  -help  --help  -?        Print this usage message
  -version                 Version information
  -v  -verbose             Print additional information
  -l                       Print line number and local variable tables
  -public                  Show only public classes and members
  -protected               Show protected/public classes and members
  -package                 Show package/protected/public classes
                           and members (default)
  -p  -private             Show all classes and members
  -c                       Disassemble the code
  -s                       Print internal type signatures
  -sysinfo                 Show system info (path, size, date, MD5 hash)
                           of class being processed
  -constants               Show final constants
  -classpath <path>        Specify where to find user class files
  -cp <path>               Specify where to find user class files
  -bootclasspath <path>    Override location of bootstrap class files

it's worth noting that this totally locked up my system a minute ago. i was unable to copy the final error message but it was the same command plus something about Java hotspot not having enough memory

@SlimeQ
Copy link
Contributor Author

SlimeQ commented Jan 9, 2016

update
i just got the message again while building, you're probably correct about the class not existing. still, a fatal memory leak upon build is probably not ideal

@keskiju
Copy link
Owner

keskiju commented Jan 9, 2016

Try running:

javap -classpath "/home/quincy/work/birt-service/.:/home/quincy/work/birt-service/lib/:/home/quincy/work/birt-service/build/libs/" com.mobileagility.service.birt.filter.ReportFilter

... and then figure out what is wrong with it.

Scanning all classes and jar files can be a heavy and long running operation if you have many of them in your classpath, but I haven't had any problems though. But I noticed that your classpath contains the same directories multiple times. Try moving your classes to a separate subdirectory like below. Maybe it will help.

./src:./lib/*:./build/libs/*

If it's still consuming too much memory, try disabling the "load class members" feature. And if you are using linter-javac, note that it currently does not work well on large projects.

@keskiju
Copy link
Owner

keskiju commented Jan 9, 2016

Or if you prefer keeping classes and java source files in separate directories like I do, then:

./classes:./lib/*:./build/libs/*

Or omit classes-directory altogether, if all your classes can be found in jars in the ./lib and ./build/libs directories:

./lib/*:./build/libs/*

@keskiju
Copy link
Owner

keskiju commented Jan 9, 2016

I just read your update again. Yes, if you save a class during a build, the error is probably caused by a nonexisting class file. And the memory error might be caused by doing a build and a class scan at the same time. Try to avoid autocomplete-java refresh and java file save during build for now. I compile all my classes automatically on save during development, perhaps that's why I haven't run into any problems so far.

@keskiju
Copy link
Owner

keskiju commented Jan 9, 2016

I will add a setting for disabling the "refresh class on save" feature. Refreshing classes on save doesn't help you since you don't compile classes on save, and it only causes error messages if you save a class during a build.

@keskiju
Copy link
Owner

keskiju commented Jan 9, 2016

I released a new version. If you disable the 'refresh class on save' setting, you will get rid of those error messages during a build. And if you still have problems with java taking up all memory, try modifying your classpath as I suggested. And perhaps it is better to avoid running a build and a refresh at the same time.

All working ok now?

@SlimeQ
Copy link
Contributor Author

SlimeQ commented Jan 11, 2016

for whatever reason i'm not seeing that setting
screenshot from 2016-01-11 12 29 34
and so i'm also getting the same error from before. i did get a short lock up earlier, but it was probably because i had ~6 large projects open and there was a full refresh happening.

@SlimeQ
Copy link
Contributor Author

SlimeQ commented Jan 11, 2016

screenshot from 2016-01-11 12 38 03
just had another lockup. this message was displayed both times. unsure of what caused this. eventually crashed (only) the atom window displaying the message

edit: possibly caused by deleting java/class files?

@keskiju
Copy link
Owner

keskiju commented Jan 11, 2016

Did you try to restart atom after updating autocomplete-java? Perhaps new settings appear only after restart. You can also add setting manually to your config.cson:

 "autocomplete-java":
    refreshClassOnSave: false

Your other problems might be caused by multiple project folders. Currently plugin supports only one root folder, see issue #9. Perhaps now it tries to do refresh for all projects at the same time.

What do you mean by lockup? a) Atom freezes for a couple of seconds? b) Atom hangs and has to be killed c) operating system freezes or hangs.

@keskiju
Copy link
Owner

keskiju commented Jan 11, 2016

Oh, you answered that in the earlier message... Atom crashes. Hopefully disabling the refreshClassOnSave helps a little bit. Unfortunately multiple project folders is not supported yet (might work ok but probably not). And running multiple projects as separate Atom windows might also cause some issues if many of them do a full refresh at the same time.

@keskiju
Copy link
Owner

keskiju commented Jan 11, 2016

And yes, possibly deleting class files during a refresh might cause problems. Disabling refreshClassOnSave might help since then you can control when the refresh is run (though the first full refresh happens automatically).

@SlimeQ
Copy link
Contributor Author

SlimeQ commented Jan 11, 2016

oops, didn't restart atom after upgrading... my bad. option is there now. if refresh class on save is disabled, does that mean i'll have to manually refresh using the command palette?

thanks for all the support. hopefully i'll have some free time soon to dig around myself.

@keskiju
Copy link
Owner

keskiju commented Jan 11, 2016

Yes, you have to refresh manually using command palette or keyboard shortcut (ctrl-alt-shift-R). If you compile classes manually, you'll have to refresh manually even if the 'refresh class on save' is enabled. A 'watch changed classes' feature is on issue list (issue #19).

@keskiju keskiju closed this as completed Jan 12, 2016
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants