javadoc: error cannot read Input length = 1 (IntelliJ - no maven) [duplicate] - intellij-idea

I know there are plenty of questions about this problem, but no one of the solved it for me! I'm using the Community Edition of IntelliJ and I tried to run JavaDoc through the IDE. Everytime and it doesn't matter fo which file, I run JavaDoc I got the following output:
javadoc: error - cannot read Input length = 1
I already figured out, that it might be an encoding problem... I'm working on a Windows 10 maschine. I already tried the following:
JavaDoc argfile encoding error
Start the terminal from IntelliJ with cmd.exe /K chcp 65001 instead of the default one cmd.exe to set the charset to UTF-8
I also set the project's default charset through the IntelliJ settings to UTF-8 (See: This Guide)
The problem seems to be the javadoc_args file respectively the path to that file... The path is C:\Users\Somebody Müller\AppData\Local\Temp\javadoc_args. Also if I view the file from IntelliJ, all ü characters are replaced by an unknown symbol.
I know that I could generate the documentation through a maven plugin, but I would prefer to do it via the IntelliJ IDE...
Could somebody identify the problem in detail and/or provide a solution or maybe parts of it?
EDIT
skomisa described the situation/behaviour in easy words:
For me the javadoc_args file does not exist! I see it is named in the Javadoc window as an argument to javadoc.exe, and if I click the link its content is shown in a pop up window within Intellij IDEA, but if I check in File Explorer there is no such file. Is this the case for you as well? I have no idea how it gets generated. Also, I created a project in a folder named Müller and the ü was rendered as � within the popup window that showed the content of javadoc_args.
UPDATE 04/12/2018
As skomisa already commented, JetBrains plans to fix this bug in a future version, likely in version 2019.1 (Build 191.2458).
UPDATE 22/02/2019
I know this question is quite old but it seems to be still relevant. I didn't check up to now if JetBrains fixed the bug but a similar one occurred for me when I try to open an JavaFX fxml externally inside of the SceneBuilder. In another post about renaming a Windows 10 user directory I found a possible workaround at least for Windows users! Just create an additional user directory without ü in the path and link to the existing one:
C:
CD\Users
MKLINK /J Müller Mueller
If you now uses the link as directory for project paths it should work fine.

I am unable to generate the Javadoc for a project in Intellij IDEA if the name of the path contains the character ü (u with umlaut). The workaround is to rename the project so that the project directory file path does not contain an umlaut.
To reproduce:
Use the project wizard to create a trivial Java Hello World project where the root directory name contains ü. I used Müller for testing purposes.
Ensure that the class for main() contains valid Javadoc documentation.
Build and run the project to verify that there are no unexpected issues.
Select Tools > Generate Javadoc, specify an empty Output Directory and click OK.
Javadoc creation fails with the error - cannot read Input length = 1 (shown below), and clicking the link to C:\Users\johndoe\AppData\Local\Temp\javadoc_args shows that the ü in the file path is (mis)represented as �, which presumably is the cause of the Javadoc error.
However, once the root directory is renamed from Müller to Muller (to remove the umlaut) the Javadoc creation works:
As a sanity check, rename the project from Muller back to Müller to reintroduce the error:
Notes:
As noted in the comments, the javadoc_args file does not exist, and I see no way to prevent its use during the Javadoc creation process.
Having the project name as Müller is not an issue; it's having ü within the project's file path that causes the problem.
Environment: Windows 10 + Intellij IDEA 2018 3.1 EAP (Ultimate Edition) + Open JDK 10.
I raised a bug report with JetBrains for this: https://youtrack.jetbrains.com/issue/IDEA-202849
Update 11/25/18
There is a workaround for this issue without needing to rename the project's path:
Run Generate Javadoc and let it fail.
Click the link to the file .../javadoc_args shown in the Javadoc window.
Copy and paste the content of the file javadoc_args into a text editor.
Correct any characters that are misrepresented (e.g. change M�ller to Müller).
Save the file using UTF-8 encoding, and the same absolute filename.
Open a Command Prompt window.
Copy the entire javadoc.exe command from the Javadoc window in Intellij IDEA and paste it to the Command Prompt window.
Submit the line that was pasted. It will now work because the project's path is correctly specified in the file javadoc_args.

Today (21-aug-2021) I tried to generate a javadoc but it failed. The error message was:
javadoc: error - cannot read Input length = 1
In my case it referred to the length of the path to the file, which is shown below.
D:\Tecnologia(ytrabajo)ysistemas26sep2020\misiontic2022\U El Bosque\UEB académico\Ciclo 2\Programación Básica\NetBProjects\R5DTO_DAOMVC_GUI
So I shortened the path to the following:
D:\Tecnologia(ytrabajo)ysistemas26sep2020\misiontic2022\NBProjects(m)\R5DTO_DAOMVC_GUI
As one can see, this route is shorter than the first so NetBeans could access it and generate the javadoc.
Note: It is not possible that NetBeans could not read the location because of the following characters: é and á in the words académico and Básica that I used in the first file location. Because, in that location, I tried to generate a JavaDoc in another project located there and NetBeans generated the Doc. So the error is more about the length of the path and the names of the files in the project.

Related

IntelliJ changes file type

I am having a quirky intellij problem.
I have a folder with a bunch of json files. When I add a specific json with name
LocalValueCode.json . InteliJ changes the file type to .file .
This only happens with this file specific filename. In file associations settings I have *.json as a pattern for my json files.
Has anyone encountered this issue before?
You need to go to Settings | Editor | File Types and make sure that this name is not associated with any incorrect file type.
I had a similar problem with a YAML file. I created the file but accidentially made it a text-type file. Then when creating YAML content in that file there was no syntax highlighting. Additionally, a bar was shown on the upper edge of the editor window stating that there are plugins for the file extension *.yml -- of which I had already one installed that worked perfectly with other YAML files.
A grep on the $HOME/.IdeaIC2018.3 directory with that filename found the .IdeaIC2018.3/config/options/filetypes.xml file that contained the following line:
<mapping pattern="cassandra-docker.yml" type="PLAIN_TEXT" />
After removing that line and restarting IntelliJ the YAML file was correctly recognized as YAML.
I just had this problem and I have an better answer, I'm leaving here for whomever might have the same issue.
If you go to Preferences > File types > Recognized file types (Text) > Registered patterns, you will find the file there registered as an association. Just remove the association and you should be fine.

Intellij produces unit test log output files in /tmp/idea_test_*.out, prefixed by NORMAL_OUTPUT

Whenever a run a unit test in Intellij (org.junit.Test), a file of the form /tmp/idea_test_*.out is produced containing some log output that looks similar to log entries that are produced by the tests but seeming with each line prefixed by "NORMAL_OUTPUT". I've grepped the codebase and it seems that neither the string "NORMAL_OUTPUT", nor the string "idea_test" is present in the repository, though I suspect some plugin or setting that I can't yet find. Does anyone have an idea what could be causing this?
I checked the log output location specified in Run/Debug Configurations > Logs > Save console output to file. This setting is not set.
These files are created by this code and are normally deleted automatically here. This is entirely part of IntelliJ IDEA's normal functioning; it is not controlled by any setting or plugin.
The location of the tmp files is governed by the JVM system property java.io.tmpdir. I found that adding this to the bin/idea.properties file had no effect on my installation, so I just edited the startup script to add the property, e.g.
-Djava.io.tmpdir=/alternative_tmp_dir

Xcode 'clang failed with exit code 1' error when building for test

I'm trying to build my project for test but I'm getting this error:
http://i.stack.imgur.com/K5eT5.png
I have read through all threads that I've found but nothing has helped. I have tried specifying the direct path to both the .pch and .plist files under 'build settings'.
This most likely comes up because I've duplicated my project and renamed it.
This line tells you the problem:
Check your build settings for the ".pch" file. The setting must match the actual file and path.
Try opening the file in the finder, open a new finder window, shiftcommandG and enter the file address from the build settings, you should be able to open it. Or use Terminal (you will have to quote the path in Terminal).
Beware of the spaces in the file names. I avoid spaces in file and directory names in development because they many times need to be handled in a special manner such as quoting.

how to use API when there's no binary

Normally when I use an API I download the binary containing the JAR which I then add to the classpath. I want to try Curve API but there's no binary (and hence no JARs in the download). I'm using Eclipse and I have read that you can just add the zip file, but I tried this and it didn't work.
Have you read the README.txt in the zip file with Curve API? Let me quote it:
In the src directory, there is a makejar.bat file. This file will
compile the nested Java files and create a Jar file called Capi.jar.
Compilation requires Java 1.2 or higher. After the Jar file is
created, add it to the classpath. Note: CAPI comes with MESP (Math
Expression String Parser).
If you use Windows Vista or 7 or 8, navigate to the folder with makejar.bat, hold Shift and right-click at an empty spot, and select "Open Command Window Here". It will launch console window with cmd.exe; you should be able to see a line like X:\Full\Path\To\The\Folder> in it.
If you use Windows XP or lower, then press Start button, select Run, and type cmd.exeEnter. Then enter cd "X:\Full\Path\To\The\Folder" (the path should be in quotes), and press Enter. If that folder is on the other drive than your current one (shown at the beginning of the prompt), then also type in the letter of the drive where that folder is located, the symbol :, and press Enter.
So much for opening the command window! Now type in makejar.batEnter. I predict that you will see an awful lot of 'javac' is not recognized as an internal or external command, operable program or batch file. lines. If that's so, then please locate javac.exe on your computer somehow—I suggest using Windows Search. After you locate it, go to the folder where it is; click on the address bar of that folder and copy the path to the buffer. Then switch back to the command window, type set PATH=", right-click and chose "Paste", type in ";%PATH%"Enter. After that, try makejar.batEnter—now it should work. If it does, you may also run makeapi.bat which will generate HTML documentation.

Intellij Idea problem with text file impossible to read

I have a problem using Intellij Idea.
I am absolutely unable to load text file as InputStream - it doesnt matter where do I put the file (main/java, main/resources...) it just can't find the file - in Eclipse everything works just fine.
I tried setings->compiler->resource patterns and added ?*.txt but that doesn't seem to work either.
Any help is appreciated.
If you load it as a File, make sure that Working Directory is properly set in IDEA Run/Debug Configuration, since it's the default directory where Java will look for a file when you try to access it like new File("file.txt"). Working directory should be set to the directory of your project containing .txt files.
If you load files as a classpath resource, then they should reside somewhere under Source root and will be copied to the classpath according to Settings | Compiler | Resource Patterns.
If you can't get it working, upload your project somewhere including IDEA project files so that we can point to your mistake.
Look at the image, notice that the txt files are in the project root, and not the source folders (in blue).
If you open the Project Structure dialog, and click on Modules and select your module - are the correct folders marked as Source Folders on the sources tab?
Link for how to get to Project Structure dialog
Also, if you print out the absolute path of that file you are trying to read, is that anywhere near where you expect it to be?
An easy way to figure out the same would be to try creating a file in the same fashion and see where it gets created in your project. You can put your input file at the same location and it should work just fine (if it doesn't, you should check your resource pattern which might be causing the file to be not copied over in the build output).
This method actually gives you the working directory of your intellij settings which is pointed out in the accepted answer. Just sharing as I had similar trouble and I figured out this way. :)