Java 文件可执行,但命令行显示它不是有效的 win32 应用程序
Java file executable, but command line says it's not a valid win32 application
我正在为 Google Code Jam 练习,他们的一些问题需要交互式解决方案。我在 java 和 运行
中写了一个解决方案
javac filename.java
在命令提示符中。当我 运行 java filename
时,文件 运行 完美。但是,当我结合 python 脚本调用此文件时,我收到错误消息 OSError: [WinError 193] %1 is not a valid Win32 application
。
下面注释掉的文本显示了 Google 提供的 python 脚本要求我在命令行中 运行 的内容。所以我输入了 python interactive_runner.py python testing_tool.py 0 -- ./filename
,这时我得到了 win32 错误。有什么我忘记做的事吗?
# For example:
# python interactive_runner.py python testing_tool.py 0 -- ./my_binary
#
# This will run the first test set of a python judge called "testing_tool.py"
# that receives the test set number (starting from 0) via command line parameter
# with a solution compiled into a binary called "my_binary".
您不能直接 运行 Java 程序 - 它不是 Win32 应用程序。你必须
a) 将 Java 程序编译成 jar 文件,并 运行 使用 java -jar filename.jar
或
b) 运行 它使用 `java filename.java'
您需要找到一种方法将这两个命令之一提供给 Python 脚本。我认为这应该有效:
python interactive_runner.py python testing_tool.py 0 -- java filename.java
我正在为 Google Code Jam 练习,他们的一些问题需要交互式解决方案。我在 java 和 运行
中写了一个解决方案javac filename.java
在命令提示符中。当我 运行 java filename
时,文件 运行 完美。但是,当我结合 python 脚本调用此文件时,我收到错误消息 OSError: [WinError 193] %1 is not a valid Win32 application
。
下面注释掉的文本显示了 Google 提供的 python 脚本要求我在命令行中 运行 的内容。所以我输入了 python interactive_runner.py python testing_tool.py 0 -- ./filename
,这时我得到了 win32 错误。有什么我忘记做的事吗?
# For example:
# python interactive_runner.py python testing_tool.py 0 -- ./my_binary
#
# This will run the first test set of a python judge called "testing_tool.py"
# that receives the test set number (starting from 0) via command line parameter
# with a solution compiled into a binary called "my_binary".
您不能直接 运行 Java 程序 - 它不是 Win32 应用程序。你必须
a) 将 Java 程序编译成 jar 文件,并 运行 使用 java -jar filename.jar
或
b) 运行 它使用 `java filename.java'
您需要找到一种方法将这两个命令之一提供给 Python 脚本。我认为这应该有效:
python interactive_runner.py python testing_tool.py 0 -- java filename.java