English 中文(简体)
“无法发现主要类别”错误,即采用分处理法实施java方案。 开放,而同一呼吁只是使用斜体。 制度
原标题:"cannot find the main class" error calling a java program using subprocess.Popen, whereas the same call just works using os.system

我写了一封信,叫另一个java方案执行一些任务。 每项任务如果完成,而且只有在完成之前,才会开始。 每项任务可能持续几天,产生大量产出。 它致力于建立一个庞大的数据库

我注意到,如果我使用斜体字系统操作文字,则头几个分钟,然后出于某种原因开始第二个任务,尽管第一项任务尚未完成。 第一项任务通常不像突然停止工作一样结束。 如果在较小的数据库上尝试,只需要几分钟时间处理,那么所有东西都会被罚款。

I don t understand why it behaves this way!

出于这一原因,我试图利用开放(Popen)(),以便我能够利用(电话)来等待所呼吁的进程结束。

出于某种原因,称为外部java方案的同一指挥部与s.system(O)公司合作,而它却说,它找不到主人(Popen()。 我正在使用相对的道路,我也尝试过绝对的道路。

是否还有其他选择? 然而,我不理解为什么不能找到主要阶层。 os制度与开放())在称为外部方案时有何区别? 我如何解决或解决我的问题?

这部法律是:

import os
from subprocess import Popen

def doWork():

    owd = os.getcwd()
    cmd = "java -Dfile.encoding=Cp1252 -classpath "bin;lib\mysql-connector-java-5.0.8-bin.jar;lib\sqlitejdbc-v056.jar" core.ODBManager"
    os.chdir("ODBManager")

    #this way does not work
    p = Popen(cmd + "1", shell=True) #import
    p.communicate() #now wait

    p = Popen(cmd + "2", shell=True) #convert
    p.communicate() #now wait

    p = Popen(cmd + "3", shell=True) #export
    p.communicate() #now wait

    #this way works but does not wait the command to finish
    #before starting another one
#   os.system(cmd+" 1") #import
#   os.system(cmd+" 2") #convert
#   os.system(cmd+" 3") #export

    os.chdir(owd)

thank you. If something is not clear, feel free to ask. P.S. the java program (build with eclipse) is in a subfolder and it reads some input from a file which is in another subfolder so I had to go with chdir, otherwise couldn t find that file.

最佳回答

如果不确定这是打字,但按照你描述的“不工作”的方式,你在被 cm到“1”、“2”和“3”之间没有空间。 有了星号,你确实有空间。 如果没有空间,你就会有效地改变你想要执行的主要方法类别的名称,因此,你会发现错误。

问题回答

暂无回答




相关问题
Spring Properties File

Hi have this j2ee web application developed using spring framework. I have a problem with rendering mnessages in nihongo characters from the properties file. I tried converting the file to ascii using ...

Logging a global ID in multiple components

I have a system which contains multiple applications connected together using JMS and Spring Integration. Messages get sent along a chain of applications. [App A] -> [App B] -> [App C] We set a ...

Java Library Size

If I m given two Java Libraries in Jar format, 1 having no bells and whistles, and the other having lots of them that will mostly go unused.... my question is: How will the larger, mostly unused ...

How to get the Array Class for a given Class in Java?

I have a Class variable that holds a certain type and I need to get a variable that holds the corresponding array class. The best I could come up with is this: Class arrayOfFooClass = java.lang....

SQLite , Derby vs file system

I m working on a Java desktop application that reads and writes from/to different files. I think a better solution would be to replace the file system by a SQLite database. How hard is it to migrate ...

热门标签