cannot seem to run jar file

自作多情 提交于 2019-12-24 11:39:08

问题


How do i set the classpath in a unix environment using tsch script. I try to set the path as follows but it gives me errors

setenv CLASSPATH $CLASSPATH : path but it doens't work saying -Bad : modifier in $(/). i dont understand why i cannot set this class path. Due to this i cannot run my .jar executable as i want to and i am running out of time. When i try to run the .jar file it give s me the following error

new error...it shows this when i try to run the jar file along with the path to where my jar file is actually located and this is the error i receive

Error occurred during initialization of VM
java.lang.Error: Properties init: Could not determine current working directory.
    at java.lang.System.initProperties(Native Method)
    at java.lang.System.initializeSystemClass(System.java:1070)

回答1:


It sounds like there are at least two issues here:

1) setenv CLASSPATH $CLASSPATH : path but it doens't work saying -Bad : modifier in $(/).

This sounds like a "tsch" error calling "setenv" with a bad value for "$CLASSPATH". Take a look at your $CLASSPATH (or post it here): the problem should be apparent.

2) Error occurred during initialization of VM

This is because you don't have a classpath yet. But fixing your "setenv()" syntax might not necessarily fix the "java init" problem - we'll just have to take it one step at a time.

Please post the value of echo $CLASSPATH, the value before you try "setenv". That should help us fix problem 1)




回答2:


The classpath should be set in the manifest file inside the jar. If not, you might try unpacking the jar and running it with the java -cp *myClassPath* *myMainClass* command.

You can set the classpath with environment variables - but why bother? If you run from a script anyways, I figure specifying the -cp option is much less error-prone.



来源:https://stackoverflow.com/questions/11005322/cannot-seem-to-run-jar-file

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!