CreateProcess error=206,运行main()方法时文件名或扩展名太长

时间:2021-11-28 17:17:46

I have this error in eclipse helios:

我在eclipse helios中有这个错误:

Exception occurred executing command line. Cannot run program "C:\Program Files (x86)\Java\jre6\bin\javaw.exe" (in directory "C:\Users\motiver\helios_workspace\TimeTracker"): CreateProcess error=206, The filename or extension is too long

执行命令行时发生异常。不能运行程序“C:\程序文件(x86)\Java\jre6\bin\ bin\javaw”。exe(目录“C:\用户\helios_workspace\时间跟踪器”):CreateProcess error=206,文件名或扩展名太长

I researched a bit but most of the issues were related to DataNucleus when working on Google App Engine. But I am not using anything remotely related to Google App Engine. I am doing a small project with Servlet 3.0 on JBOSS 6. I am using Hibernate 4.1.2 for ORM and RESTEasy to expose a web service. I created a util file that has a main() method that basically drops and re-creates the schema. I run the main() methos when I need a clean database for testing purposes. It worked fine on Tomcat 7 but it stopped working when I moved to JBoss 6.

我做了一些研究,但大多数问题都与使用谷歌应用程序引擎时的数据核有关。但是我没有使用任何与谷歌应用程序引擎相关的东西。我正在做一个关于JBOSS 6的Servlet 3.0的小项目。我正在对ORM和RESTEasy使用Hibernate 4.1.2来公开一个web服务。我创建了一个util文件,该文件有一个main()方法,基本上删除并重新创建模式。当我需要一个干净的数据库进行测试时,我运行main()方法。它在Tomcat 7上运行良好,但是当我转移到JBoss 6时,它就停止了工作。

Any hint or solution would be greatly appreciated.

如有任何提示或解决办法,我们将不胜感激。

13 个解决方案

#1


34  

There is no simple (as in a couple of clicks or a simple command) solution to this issue.

对于这个问题,没有简单的解决方案(如几次单击或一个简单的命令)。

Quoting from some answers in this bug report in Eclipse.org, these are the work-arounds. Pick the one that's the least painful to you:

在Eclipse.org的bug报告中,引用一些答案,这些就是解决方法。挑一个对你来说最不痛苦的:

  • Reduce the classpath
  • 减少类路径
  • Use directories instead of jar files
  • 使用目录而不是jar文件
  • Use a packed jar files which contains all other jars, use the classpath variable inside the manifest file to point to the other jars
  • 使用包含所有其他jar的打包jar文件,使用清单文件中的classpath变量指向其他jar
  • Use a special class loader which reads the classpath from a config file
  • 使用一个特殊的类装入器,它从配置文件中读取类路径
  • Try to use one of the attached patches in the bug report document
  • 尝试使用bug报告文档中附带的一个补丁
  • Use an own wrapper e.g. ant
  • 使用自己的包装,例如ant
  • Move to IntelliJ (Update: as @nitind points out, this is not an option)
  • 移动到IntelliJ (Update:正如@nitind指出的,这不是一个选项)

Update: After July 2014, there is a better way (thanks to @Brad-Mace's answer below:

更新:2014年7月以后,有更好的方法(感谢@Brad-Mace的回复:

If you have created your own build file instead of using Project -> Generate Javadocs, then you can add useexternalfile="yes" to the Javadoc task, which is designed specifically to solve this problem.

如果您已经创建了自己的构建文件,而不是使用Project ->生成Javadocs,那么您可以将useexternalfile="yes"添加到Javadoc任务中,该任务是专门为解决这个问题而设计的。

#2


14  

If you create your own build file rather than using Project -> Generate Javadocs you can add useexternalfile="yes" to the javadoc task, which is designed specifically to solve this problem.

如果您创建自己的构建文件而不是使用Project ->生成Javadocs,那么您可以将useexternalfile="yes"添加到javadoc任务中,该任务是专门为解决这个问题而设计的。

#3


6  

Try updating your Eclipse version, the issue was closed recently (2013-03-12). Check the bug report https://bugs.eclipse.org/bugs/show_bug.cgi?id=327193

请尝试更新您的Eclipse版本,这个问题最近已经解决(2013-03-12)。检查错误报告https://bugs.eclipse.org/bugs/show_bug.cgi?id=327193

#4


5  

Answering my own question here so that the solution doesn't get buried in comments. I exported the project as a runnable jar from within eclipse and did a command line "java -jar MyJar.jar" and it works perfectly fine

在这里回答我自己的问题,这样解决方案就不会被评论淹没。我将这个项目作为一个可运行的jar从eclipse中导出,并做了一个命令行“java -jar MyJar”。它能完美地工作

#5


3  

In bug report Bug 327193 it is considered fixed, but it happen to me recently with Eclipse Kepler 4.3.2.

在bug报告327193中,它被认为是固定的,但是最近我在Eclipse Kepler 4.3.2中遇到了这个问题。

Please download patch for Eclipse Juno or newer:

请下载Eclipse Juno或更新的补丁:

https://bugs.eclipse.org/bugs/attachment.cgi?id=216593

https://bugs.eclipse.org/bugs/attachment.cgi?id=216593

  1. After download back up existing eclipse/plugins/org.eclipse.jdt.launching_3.*.jar
  2. 下载后,备份现有的eclipse/插件/org.eclipse.jdt.launching_3.*.jar
  3. Copy and paste classes in the patch to org.eclipse.jdt.launching JAR (replace existing files).
  4. 在补丁中复制并粘贴类到org. eclipsee .jdt。启动JAR(替换现有文件)。
  5. Restart Eclipse.
  6. 重新启动Eclipse。

#6


3  

I have got same error, while invoking Maven.

在调用Maven时,我有相同的错误。

The root cause for my problem was the classpath was very huge. Updating the classpath fixed the problem.

问题的根本原因是类路径非常大。更新类路径修复了问题。

#7


1  

Try this:

试试这个:

java -jar -Dserver.port=8080 build/libs/APP_NAME_HERE.jar

java jar -Dserver。= 8080构建/ libs / APP_NAME_HERE.jar港

#8


0  

it happens due to DataNucleus sometimes overwrite the Arguments with many paths.

这是因为数据核有时用许多路径覆盖参数。

You have to overwrite them with this:

你必须这样写:

-enhancerName ASM -api JDO -pu MediaToGo

-增强型ASM -api JDO -pu MediaToGo

Hope help you!

希望帮助你!

#9


0  

Valid answer from this thread was the right answer for my special case. Specify the ORM folder path for datanucleus certainly reduce the java path compile.

这个线程的有效答案是我的特殊情况的正确答案。为datanucleus指定ORM文件夹路径肯定会减少java路径编译。

https://*.com/a/1219427/1469481

https://*.com/a/1219427/1469481

#10


0  

I got the error below when I run 'ant deploy'

当我运行“ant deploy”时,我得到了下面的错误

Cannot run program "C:\java\jdk1.8.0_45\bin\java.exe": CreateProcess error=206, The filename or extension is too long

Fixed it by run 'ant clean' before it.

通过运行“ant clean”来修复它。

#11


0  

I got the same error in android studio. I was able to resolve it by running Build->Clean Project in the IDE.

我在android studio中也犯了同样的错误。我可以通过在IDE中运行Build->Clean项目来解决它。

#12


0  

This is because of your long project directory name, which gives you a very long CLASSPATH altogether. Either you need to reduce jars added at CLASSPATH (make sure removing unnecessary jars only) Or the best way is to reduce the project directory and import the project again. This will reduce the CLASSPATH. It worked for me.

这是因为您的项目目录名很长,这给您提供了非常长的类路径。您需要减少在类路径中添加的jar(确保只删除不必要的jar),或者最好的方法是减少项目目录并再次导入项目。这将减少类路径。它为我工作。

#13


0  

I faced this problem today and I was able to solve it using this Gradle plugin

我今天遇到了这个问题,我可以用这个Gradle插件解决它

It's github url is this

它的github url是这个

IF you, like me, have no idea what Gradle is but need to run a backend to do your front end work, what you need to do is find the build.gradle file that is being called to start your BE server and add this to the top:

如果你像我一样,不知道什么是Gradle,但是需要运行后端来完成前端工作,那么你需要做的就是找到构建。将要启动BE服务器并将其添加到顶部的渐变文件:

plugins {
  id "ua.eshepelyuk.ManifestClasspath" version "1.0.0"
}

#1


34  

There is no simple (as in a couple of clicks or a simple command) solution to this issue.

对于这个问题,没有简单的解决方案(如几次单击或一个简单的命令)。

Quoting from some answers in this bug report in Eclipse.org, these are the work-arounds. Pick the one that's the least painful to you:

在Eclipse.org的bug报告中,引用一些答案,这些就是解决方法。挑一个对你来说最不痛苦的:

  • Reduce the classpath
  • 减少类路径
  • Use directories instead of jar files
  • 使用目录而不是jar文件
  • Use a packed jar files which contains all other jars, use the classpath variable inside the manifest file to point to the other jars
  • 使用包含所有其他jar的打包jar文件,使用清单文件中的classpath变量指向其他jar
  • Use a special class loader which reads the classpath from a config file
  • 使用一个特殊的类装入器,它从配置文件中读取类路径
  • Try to use one of the attached patches in the bug report document
  • 尝试使用bug报告文档中附带的一个补丁
  • Use an own wrapper e.g. ant
  • 使用自己的包装,例如ant
  • Move to IntelliJ (Update: as @nitind points out, this is not an option)
  • 移动到IntelliJ (Update:正如@nitind指出的,这不是一个选项)

Update: After July 2014, there is a better way (thanks to @Brad-Mace's answer below:

更新:2014年7月以后,有更好的方法(感谢@Brad-Mace的回复:

If you have created your own build file instead of using Project -> Generate Javadocs, then you can add useexternalfile="yes" to the Javadoc task, which is designed specifically to solve this problem.

如果您已经创建了自己的构建文件,而不是使用Project ->生成Javadocs,那么您可以将useexternalfile="yes"添加到Javadoc任务中,该任务是专门为解决这个问题而设计的。

#2


14  

If you create your own build file rather than using Project -> Generate Javadocs you can add useexternalfile="yes" to the javadoc task, which is designed specifically to solve this problem.

如果您创建自己的构建文件而不是使用Project ->生成Javadocs,那么您可以将useexternalfile="yes"添加到javadoc任务中,该任务是专门为解决这个问题而设计的。

#3


6  

Try updating your Eclipse version, the issue was closed recently (2013-03-12). Check the bug report https://bugs.eclipse.org/bugs/show_bug.cgi?id=327193

请尝试更新您的Eclipse版本,这个问题最近已经解决(2013-03-12)。检查错误报告https://bugs.eclipse.org/bugs/show_bug.cgi?id=327193

#4


5  

Answering my own question here so that the solution doesn't get buried in comments. I exported the project as a runnable jar from within eclipse and did a command line "java -jar MyJar.jar" and it works perfectly fine

在这里回答我自己的问题,这样解决方案就不会被评论淹没。我将这个项目作为一个可运行的jar从eclipse中导出,并做了一个命令行“java -jar MyJar”。它能完美地工作

#5


3  

In bug report Bug 327193 it is considered fixed, but it happen to me recently with Eclipse Kepler 4.3.2.

在bug报告327193中,它被认为是固定的,但是最近我在Eclipse Kepler 4.3.2中遇到了这个问题。

Please download patch for Eclipse Juno or newer:

请下载Eclipse Juno或更新的补丁:

https://bugs.eclipse.org/bugs/attachment.cgi?id=216593

https://bugs.eclipse.org/bugs/attachment.cgi?id=216593

  1. After download back up existing eclipse/plugins/org.eclipse.jdt.launching_3.*.jar
  2. 下载后,备份现有的eclipse/插件/org.eclipse.jdt.launching_3.*.jar
  3. Copy and paste classes in the patch to org.eclipse.jdt.launching JAR (replace existing files).
  4. 在补丁中复制并粘贴类到org. eclipsee .jdt。启动JAR(替换现有文件)。
  5. Restart Eclipse.
  6. 重新启动Eclipse。

#6


3  

I have got same error, while invoking Maven.

在调用Maven时,我有相同的错误。

The root cause for my problem was the classpath was very huge. Updating the classpath fixed the problem.

问题的根本原因是类路径非常大。更新类路径修复了问题。

#7


1  

Try this:

试试这个:

java -jar -Dserver.port=8080 build/libs/APP_NAME_HERE.jar

java jar -Dserver。= 8080构建/ libs / APP_NAME_HERE.jar港

#8


0  

it happens due to DataNucleus sometimes overwrite the Arguments with many paths.

这是因为数据核有时用许多路径覆盖参数。

You have to overwrite them with this:

你必须这样写:

-enhancerName ASM -api JDO -pu MediaToGo

-增强型ASM -api JDO -pu MediaToGo

Hope help you!

希望帮助你!

#9


0  

Valid answer from this thread was the right answer for my special case. Specify the ORM folder path for datanucleus certainly reduce the java path compile.

这个线程的有效答案是我的特殊情况的正确答案。为datanucleus指定ORM文件夹路径肯定会减少java路径编译。

https://*.com/a/1219427/1469481

https://*.com/a/1219427/1469481

#10


0  

I got the error below when I run 'ant deploy'

当我运行“ant deploy”时,我得到了下面的错误

Cannot run program "C:\java\jdk1.8.0_45\bin\java.exe": CreateProcess error=206, The filename or extension is too long

Fixed it by run 'ant clean' before it.

通过运行“ant clean”来修复它。

#11


0  

I got the same error in android studio. I was able to resolve it by running Build->Clean Project in the IDE.

我在android studio中也犯了同样的错误。我可以通过在IDE中运行Build->Clean项目来解决它。

#12


0  

This is because of your long project directory name, which gives you a very long CLASSPATH altogether. Either you need to reduce jars added at CLASSPATH (make sure removing unnecessary jars only) Or the best way is to reduce the project directory and import the project again. This will reduce the CLASSPATH. It worked for me.

这是因为您的项目目录名很长,这给您提供了非常长的类路径。您需要减少在类路径中添加的jar(确保只删除不必要的jar),或者最好的方法是减少项目目录并再次导入项目。这将减少类路径。它为我工作。

#13


0  

I faced this problem today and I was able to solve it using this Gradle plugin

我今天遇到了这个问题,我可以用这个Gradle插件解决它

It's github url is this

它的github url是这个

IF you, like me, have no idea what Gradle is but need to run a backend to do your front end work, what you need to do is find the build.gradle file that is being called to start your BE server and add this to the top:

如果你像我一样,不知道什么是Gradle,但是需要运行后端来完成前端工作,那么你需要做的就是找到构建。将要启动BE服务器并将其添加到顶部的渐变文件:

plugins {
  id "ua.eshepelyuk.ManifestClasspath" version "1.0.0"
}