Closed RomuloPBenedetti closed 8 years ago
Actually it already supports most of the default JDK packages, as you can see in the animation below (java.util.ArrayList at the end of animation). For method call autocompletion to work, you will have to enable the 'load class members' setting and just be patient because class loading is still unoptimized (see issue #13). JDK library is quite large and loading it may take a while, and project classes and libraries are loaded before JDK libraries.
It may also be that the package failed to load JDK libraries on your system for some reason. In that case check the console log for errors: View -> Developer -> Developer Tools.
You're wright. There exist some errors:
autocomplete-java: Error: ENOENT: no such file or directory, scandir '
/home/romulo/PhenoGlad/Github(git)/PhenoGlad/PhenoGlad(java)/./lib/'
I believed the "./" definition of project path was understood by .classpath as pointed: ./lib/*
I reorganized my .classpath anyway independent of the .classpath it generates an erroneous classpath by what I can see:
autocomplete-java: Error: Command failed: /bin/sh -c "javap" -classpath
"/home/romulo/PhenoGlad/Github(git)/PhenoGlad/./PhenoGlad(java)/src/main/java/phenoglad/core/:
/home/romulo/PhenoGlad/Github(git)/PhenoGlad/./PhenoGlad(java)/src/main/java/phenoglad/graphic/:
/home/romulo/PhenoGlad/Github(git)/PhenoGlad/./PhenoGlad(java)/src/main/java/phenoglad/support/:
/home/romulo/PhenoGlad/Github(git)/PhenoGlad/./PhenoGlad(java)/build/classes/java/phenoglad/core/:
/home/romulo/PhenoGlad/Github(git)/PhenoGlad/./PhenoGlad(java)/build/classes/java/phenoglad/graphic/:
/home/romulo/PhenoGlad/Github(git)/PhenoGlad/./PhenoGlad(java)/build/classes/java/phenoglad/support/:
/home/romulo/PhenoGlad/Github(git)/PhenoGlad/./PhenoGlad(java)/lib/*" phenoglad.core.GuiController
Error: class not found: phenoglad.core.GuiController
My .classpath:
/PhenoGlad(java)/src/main/java/phenoglad/core/*:
/PhenoGlad(java)/src/main/java/phenoglad/graphic/*:
/PhenoGlad(java)/src/main/java/phenoglad/support/*:
/PhenoGlad(java)/build/classes/java/phenoglad/core/*:
/PhenoGlad(java)/build/classes/java/phenoglad/graphic/*:
/PhenoGlad(java)/build/classes/java/phenoglad/support/*:
/PhenoGlad(java)/lib/*
If it help you I'm on Linux
I've tested the package only on OS X and Windows so far :) I published a small patch that allows line breaks in a .classpath file and does some additional formatting. Please update and try if it fixes your problem. But the main problem might be with your classpath, because as far as I know the * should be used only for directories that contain jar files. So try one of the alternatives below.
If .classpath file is located in /home/romulo/PhenoGlad/Github(git)/PhenoGlad and the absolute path used in classpath is /home/romulo/PhenoGlad/Github(git)/PhenoGlad/PhenoGlad(java)/.... then:
./PhenoGlad(java)/src/main/java/phenoglad/core: ./PhenoGlad(java)/src/main/java/phenoglad/graphic: ./PhenoGlad(java)/src/main/java/phenoglad/support: ./PhenoGlad(java)/build/classes/java/phenoglad/core: ./PhenoGlad(java)/build/classes/java/phenoglad/graphic: ./PhenoGlad(java)/build/classes/java/phenoglad/support: ./PhenoGlad(java)/lib/*
or if the correct absolute path really is /PhenoGlad(java)/.... then:
/PhenoGlad(java)/src/main/java/phenoglad/core: /PhenoGlad(java)/src/main/java/phenoglad/graphic: /PhenoGlad(java)/src/main/java/phenoglad/support: /PhenoGlad(java)/build/classes/java/phenoglad/core: /PhenoGlad(java)/build/classes/java/phenoglad/graphic: /PhenoGlad(java)/build/classes/java/phenoglad/support: /PhenoGlad(java)/lib/*
You can also leave out all src-directories from classpath if they do not contain any .class files.
I just noticed that "phenoglad" and "core" are package names. Classpath should only contain root directories, not package directories.
So try these instead:
./PhenoGlad(java)/src/main/java: ./PhenoGlad(java)/build/classes/java: ./PhenoGlad(java)/lib/*
or
/PhenoGlad(java)/src/main/java: /PhenoGlad(java)/build/classes/java: /PhenoGlad(java)/lib/*
I've tried both and still getting errors:
autocomplete-java: Error: Command failed: /bin/sh -c "javap" -classpath "/PhenoGlad(java)/src/main/java:
/PhenoGlad(java)/build/classes/java:" phenoglad.core.GuiController
Error: class not found: phenoglad.core.GuiController
I'm not sure why, here is the tree view:
Aparently this work, even phenoglad being a package:
./PhenoGlad(java)/src/main/java/phenoglad: ./PhenoGlad(java)/build/classes/java/phenoglad:
I removed PhenoGlad(java)/lib/*
at the moment as it is empty at now, will try it later when working with Junit.
I would like a lot to map packages from JavaFX, I'm thinking in putting the library in lib
at the moment. and well... I'm not finding it so slow to load autocomplete data.
I tested it further, your sugestionas actually work, what happen is that, anytime I save a class with some error it become unable to find it without reopening Atom.
Yes, you can either drop jfxrt.jar to your lib directory or reference the jfxrt.jar file directly in your .classpath file. I added a new issue for extlib support: #18
You are probably using linter-javac to compile your classes on save. It seems that linter-javac compiles classes only if none of the classes contain any errors. And once you fix the error, linter-javac will compile all classes but autocomplete-java will refresh only the class that you just saved. So it can be a bit tricky with linter-javac :/ You can get around this by running the "project refresh" command that I just implemented to the latest version. Default keybinding for it is "shift-ctrl-alt+R".
You're wright I'm using linter-javac and your suggestion resolves it. I'm not sure how to do a direct reference, I've tried an absolute path but it did not work:
./PhenoGlad(java)/src/main/java/phenoglad:
./PhenoGlad(java)/build/classes/java/phenoglad:
/usr/lib/jvm/java-8-oracle/jre/lib/ext/jfxrt.jar
Result:
autocomplete-java: Error: Command failed: /bin/sh -c "jar" tf "/usr/lib/jvm/java-8-
oracle/jre/lib/ext/jfxrt/home/romulo/PhenoGlad/Github(git)/PhenoGlad/.jar"
java.io.FileNotFoundException: /usr/lib/jvm/java-8-
oracle/jre/lib/ext/jfxrt/home/romulo/PhenoGlad/Github(git)/PhenoGlad/.jar (Arquivo ou diretório não
encontrado) at java.util.zip.ZipFile.open(Native Method) at java.util.zip.ZipFile.(ZipFile.java:219) at
java.util.zip.ZipFile.(ZipFile.java:149) at java.util.zip.ZipFile.(ZipFile.java:120) at
sun.tools.jar.Main.list(Main.java:1115) at sun.tools.jar.Main.run(Main.java:293) at
sun.tools.jar.Main.main(Main.java:1288)
You found a bug :) I fixed it. Absolute paths should work now if you take an update.
:) You're doing a great and quick job... Atom was in need of this package, java is a lot verbose and autocomplete is somewhat fundamental.
Hi someone can help me, I have the next problem with Autocomplete-java: autocomplete-java: Error: ENOENT: no such file or directory, open 'C:\Users\Eider\Desktop\cursojava*' here in this folder i have my files (.class and .java). I was working in windows 8.1. Thanks.
Is there any possibility the plugin can be aware of default JDK packages, Class, methods, etc?