简体   繁体   English

如何使用 Intellij 解决 Java 中的 fileNotFoundException

[英]How do I resolve fileNotFoundException in Java using Intellij

My project on Intellij does not run my project any more, it keeps throwing some compilation errors.我在 Intellij 上的项目不再运行我的项目,它不断抛出一些编译错误。

I have tried Rebuilding, Building and also Invalidate Cache/Restarted but I didn't work I also checked out this link below, but it didn't work for me:我已经尝试过重建、构建以及使缓存/重新启动无效,但我没有工作我还检查了下面的这个链接,但它对我不起作用:

https://intellij-support.jetbrains.com/hc/en-us/community/posts/206885455-java-Cannot-find-JDK-1-7-for-module https://intellij-support.jetbrains.com/hc/en-us/community/posts/206885455-java-Cannot-find-JDK-1-7-for-module

I keep getting this error我不断收到此错误

java.io.FileNotFoundException: /home/byteworks/Documents/Projects/ics-assessment-api/ics-assessment-controller/out/production/resources/customers-template/AGENCY_CUSTOMER_MASTERLIST_TAXPAYER v1.0.xlsx (Permission denied)
    at java.io.FileOutputStream.open0(Native Method)
    at java.io.FileOutputStream.open(FileOutputStream.java:270)
    at java.io.FileOutputStream.<init>(FileOutputStream.java:213)
    at java.io.FileOutputStream.<init>(FileOutputStream.java:162)
    at com.intellij.openapi.util.io.FileUtil.openOutputStream(FileUtil.java:492)
    at com.intellij.openapi.util.io.FileUtil.performCopy(FileUtil.java:452)
    at com.intellij.openapi.util.io.FileUtil.copyContent(FileUtil.java:447)
    at org.jetbrains.jps.incremental.FSOperations.copy(FSOperations.java:437)
    at org.jetbrains.jps.gradle.compiler.GradleResourceFileProcessor.copyFile(GradleResourceFileProcessor.java:68)
    at org.jetbrains.jps.gradle.compiler.GradleResourcesBuilder.build(GradleResourcesBuilder.java:101)
    at org.jetbrains.jps.gradle.compiler.GradleResourcesBuilder.build(GradleResourcesBuilder.java:28)
    at org.jetbrains.jps.incremental.IncProjectBuilder.buildTarget(IncProjectBuilder.java:1037)
    at org.jetbrains.jps.incremental.IncProjectBuilder.runBuildersForChunk(IncProjectBuilder.java:1018)
    at org.jetbrains.jps.incremental.IncProjectBuilder.buildTargetsChunk(IncProjectBuilder.java:1074)
    at org.jetbrains.jps.incremental.IncProjectBuilder.buildChunkIfAffected(IncProjectBuilder.java:968)
    at org.jetbrains.jps.incremental.IncProjectBuilder.buildChunks(IncProjectBuilder.java:797)
    at org.jetbrains.jps.incremental.IncProjectBuilder.runBuild(IncProjectBuilder.java:375)
    at org.jetbrains.jps.incremental.IncProjectBuilder.build(IncProjectBuilder.java:178)
    at org.jetbrains.jps.cmdline.BuildRunner.runBuild(BuildRunner.java:138)
    at org.jetbrains.jps.cmdline.BuildSession.runBuild(BuildSession.java:302)
    at org.jetbrains.jps.cmdline.BuildSession.run(BuildSession.java:135)
    at org.jetbrains.jps.cmdline.BuildMain$MyMessageHandler.lambda$channelRead0$0(BuildMain.java:229)
    at org.jetbrains.jps.service.impl.SharedThreadPoolImpl.lambda$executeOnPooledThread$0(SharedThreadPoolImpl.java:42)
    at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:511)
    at java.util.concurrent.FutureTask.run(FutureTask.java:266)
    at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1149)
    at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:624)
    at java.lang.Thread.run(Thread.java:748)
Please perform full project rebuild (Build | Rebuild Project)```

As someone else has said it is saying permission denied, Has the folder or file been moved or altered by some form of protection / anti virus?正如其他人所说,权限被拒绝,文件夹或文件是否被某种形式的保护/防病毒移动或更改?

The error appears to be where it is trying to copy the file from /home/byteworks/Documents/Projects/ics-assessment-api/ics-assessment-controller/out/production/resources/customers-template/AGENCY_CUSTOMER_MASTERLIST_TAXPAYER v1.0.xlsx该错误似乎是它试图从 /home/byteworks/Documents/Projects/ics-assessment-api/ics-assessment-controller/out/production/resources/customers-template/AGENCY_CUSTOMER_MASTERLIST_TAXPAYER v1.0 复制文件的位置。 xlsx

Is that still the path where that xlsx is?那仍然是 xlsx 所在的路径吗? also shouldnt it be xslx.也不应该是 xslx。

Could that be the problem you have a typo in the filename in the build.gradle copy command?这可能是您在 build.gradle 复制命令中的文件名中有拼写错误的问题吗? looks like you are on some form of linux computer as you have a /home/byteworks folder, are you the user byteworks?看起来你在某种形式的 linux 计算机上,因为你有一个 /home/byteworks 文件夹,你是用户 byteworks 吗? if not do you have permission to access the byteworks folder as Users can restrict access to their Documents folder.如果没有,您是否有权访问 byteworks 文件夹,因为用户可以限制对其 Documents 文件夹的访问。 check the file owner and permissions if you do an ls -la in the folder then you can see the flags, _rwxrwxrwx - The flags are _ = the SetUUID/SetGroup/Sticky flag rwx - owner permissions Read Write Execute (Execute is also ls view permission on folders) rwx - group permissions rwx - other permissions - if the last one is ___ that means anyone who isn't the owner doesn't have permission to access the file.如果您在文件夹中执行 ls -la,请检查文件所有者和权限,然后您可以看到标志,_rwxrwxrwx - 标志是 _ = SetUUID/SetGroup/Sticky 标志 rwx - 所有者权限读写执行(执行也是 ls 视图文件夹权限) rwx - 组权限 rwx - 其他权限 - 如果最后一个是___,则意味着任何不是所有者的人都没有访问文件的权限。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM