liang860908 / apjp

Automatically exported from code.google.com/p/apjp
0 stars 0 forks source link

APJP_LOCAL_JAVA-1.0.0 中APJP_LOCAL.sh的EOF问题,1.0.1版已解决 #88

Closed GoogleCodeExporter closed 9 years ago

GoogleCodeExporter commented 9 years ago
提示如下:

153:local_gae auess$ sh APJP_LOCAL.sh
Exception in thread "main" java.lang.NoClassDefFoundError: APJP/Main
Caused by: java.lang.ClassNotFoundException: APJP.Main
    at java.net.URLClassLoader$1.run(URLClassLoader.java:202)
    at java.security.AccessController.doPrivileged(Native Method)
    at java.net.URLClassLoader.findClass(URLClassLoader.java:190)
    at java.lang.ClassLoader.loadClass(ClassLoader.java:306)
    at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:301)
    at java.lang.ClassLoader.loadClass(ClassLoader.java:247)

Original issue reported on code.google.com by Mariposa...@gmail.com on 11 Aug 2012 at 4:24

GoogleCodeExporter commented 9 years ago
问题补充:是在APJP_LOCAL目录下执行的,只不过我把起文件夹�
��名成local_gae了。
I‘ve executed APJP_LOCAL.sh in the APJP_LOCAL directory (I changed its name 
to "local_gae"), but still got this strange problem... :(

Original comment by Mariposa...@gmail.com on 11 Aug 2012 at 7:23

GoogleCodeExporter commented 9 years ago
1. 
APJP_LOCAL文件夹的名字可以随意更改的。改成local_gae,方便自�
��使用,不会出现任何问题的。

2. 
问题的原因是,shell(/cmd)的当前工作目录(pwd)不是在APJP_LOCAL(/l
ocal_gae)中,导致无法找到APJP.Main的。当前工作目录就相当于��
�时将此目录加入PATH中的,这样在程序调用的时候会查找的。
(抱歉,有些计算机术语不会使用,只能按我个人理解解释,�
��望能看懂)

3. 
第一眼看到你的Issue,我也是毫无头绪的。因为1.0.0只是修复�
��个内存泄露的小bug的,程序并没有其他的变动的,而且已经
有一个多月的测试,没有问题,我才让作者将0.9.3版在下载页
去 掉下载链接的(Download lists is too long.)。 
接着我看看你的个人资料,我就明白问题可能出现的原因了��
�才想到我之前在Windows也遇到过此问题的。

http://clip2net.com/clip/m96404/1344672627-clip-18kb.png

出现的问题提示是一模一样的吧? :P

4. 
解决方法,在通过其他程序调用前,先cd切换到APJP_LOCAL当前��
�作目录

http://clip2net.com/clip/m96404/1344673061-clip-27kb.png

Original comment by goknmuse on 11 Aug 2012 at 8:21

GoogleCodeExporter commented 9 years ago
我用的是苹果系统,不过在执行APJP_LOCAL.sh前的确已经cd进入��
�APJP_LOCAL(/local_gae)中,我是这样写的:
cd *****/local_gae/; sh APJP_LOCAL.sh 
应该没错吧,而且之前的0.9.3版运行正常。
嗯,我再去仔细检测一下,有问题再反映,感谢您的回复。

Original comment by Mariposa...@gmail.com on 11 Aug 2012 at 9:48

GoogleCodeExporter commented 9 years ago
补一张图说明问题,另外我在想是否和上传时用的JAVA-SDK版本
低有关系?我目前用的是1.6.6不是最新的1.7,不过上传过程很
顺利没问题噢。。。

Original comment by Mariposa...@gmail.com on 11 Aug 2012 at 9:54

Attachments:

GoogleCodeExporter commented 9 years ago
将";" 换成 "&&" 试试?

Original comment by goknmuse on 11 Aug 2012 at 10:00

GoogleCodeExporter commented 9 years ago
试了一下,依然无效,应该和指令分隔符的样式无关,之前��
�0.9.3用同样的指令完全OK。
我刚在网上查了一下,发现国外有个不错的帖子也反映了相��
�的问题:http://stackoverflow.com/questions/2159006/noclassdeffounderror-wit
hout-any-class-name

我用其中提到的 java “” 
这条命令在终端里执行了一下,得到的错误提示和之前完全��
�致,我猜想是 JAVA 
执行文件路径返回了空值的原因,但我不懂 
JAVA,所以还请您转告开发者,参考一下上面那个链接。

谢谢。

Original comment by Mariposa...@gmail.com on 11 Aug 2012 at 10:36

Attachments:

GoogleCodeExporter commented 9 years ago
非常奇怪的是,我刚才又检测了一下,我将APJP_LOCAL.sh文件中�
��内容“java -classpath APJP_LOCAL_JAVA-1.0.0.jar APJP.Main” 
直接拷贝到终端内执行,居然成功了:

而为什么用sh APJP_LOCAL.sh却无法执行呢?

Original comment by Mariposa...@gmail.com on 11 Aug 2012 at 10:56

Attachments:

GoogleCodeExporter commented 9 years ago
1. 
没接触过苹果的系统,但应该不是不同OS之间的问题的。基本
确定是classpath的问题的。但为什么仍未解决,真是难题。我��
�转告作者的,但他现在只周二时间较为充裕的。所以可能需�
��等几天的,抱歉呢。

2. java "" 
只是那人在演示如果不配置classpath会出现什么样的问题的,��
�不是问题的解决方法。
因为你执行 sh APJP_LOCAL.sh 
出现的错误和其错误一样,说明是classpath的问题的。

"cd ***/local_gae/ && sh APJP_LOCAL.sh" 实质上等价于 "cd ***/local_gae/ 
&& java -classpath APJP_LOCAL_JAVA-1.0.0.jar APJP.Main" 的

Original comment by goknmuse on 11 Aug 2012 at 10:59

GoogleCodeExporter commented 9 years ago
To Comment7

我要先去吃饭了的。回头再说哈。 :P

Original comment by goknmuse on 11 Aug 2012 at 11:03

GoogleCodeExporter commented 9 years ago
是的,您说得对,那两条指令应该执行效果是一样的,但不��
�为何一个成功一个却失败,呵呵。
会不会是APJP_LOCAL_JAVA-1.0.0.jar这个名字太长的原因?之前的版�
��一直都是简短的APJP.jar

谢谢了,希望能顺利修正,时间无所谓,有空即可,目前暂��
�用第二条指令对付着。:)

Original comment by Mariposa...@gmail.com on 11 Aug 2012 at 11:05

GoogleCodeExporter commented 9 years ago
抱歉又打搅了,我刚找到原因了,发布版的APJP_LOCAL_JAVA-1.0.0��
�件夹中的APJP_LOCAL.sh中多回车空了一行在“java -classpath 
APJP_LOCAL_JAVA-1.0.0.jar 
APJP.Main”下面,把光标backspace移到“APJP.Main”的后面,重新��
�存再执行即可正常连接,这么个小失误,呵呵居然找了这么�
��。-_-|||

Original comment by Mariposa...@gmail.com on 11 Aug 2012 at 11:21

Attachments:

GoogleCodeExporter commented 9 years ago
I have reproduced the bug and the bug fix :)
Thanks for your help Mariposauess and goknmuse!

Original comment by jeroen.v...@gmail.com on 11 Aug 2012 at 11:41

GoogleCodeExporter commented 9 years ago
在Windows 7中,通过Notepad++看这三个文件

http://clip2net.com/clip/m96404/1344685171-clip-71kb.jpg

???

但从作者放于Github上的src来看的话,

https://github.com/jvansteirteghem/apjp/blob/master/APJP_LOCAL_JAVA/src/main/ass
embly/APJP_LOCAL_JAVA/APJP_LOCAL.sh

???

但APJP_LOCAL.bat,0.9.3,1.0.0,及src都没有多余空行的。

http://clip2net.com/clip/m96404/1344685584-clip-28kb.png

Original comment by goknmuse on 11 Aug 2012 at 12:05

GoogleCodeExporter commented 9 years ago
[deleted comment]
GoogleCodeExporter commented 9 years ago
多余空行确实有问题

http://clip2net.com/clip/m96404/1344686936-clip-11kb.png

Cygwin中,1是未删除多余空行的,2是删去空行的。

APJP_LOCAL.sh 是maven控制自动生成的呢!

Original comment by goknmuse on 11 Aug 2012 at 12:23

GoogleCodeExporter commented 9 years ago
Notepad++ 
不会自动添加多余的空行的。但我在Ubuntu-12.04下载APJP_LOCAL_JAV
A-1.0.0,通过gedit打开:

http://clip2net.com/clip/m96404/1344688297-clip-19kb.jpg

Original comment by goknmuse on 11 Aug 2012 at 12:33

GoogleCodeExporter commented 9 years ago
a. 
https://github.com/jvansteirteghem/apjp/blob/master/APJP_LOCAL_JAVA/src/main/ass
embly/APJP_LOCAL_JAVA/APJP_LOCAL.sh

b. http://clip2net.com/clip/m96404/1344688297-clip-19kb.jpg

a. 和 b. 说明APJP的src中是没有多余的空行的。

c. http://clip2net.com/clip/m96404/1344685171-clip-71kb.jpg

c. 说明可能是由OS差异或者运行程序的差异,帮倒忙添加的。

看来解决方法只能是自己遇到后,手动删掉多余的空行。

Original comment by goknmuse on 11 Aug 2012 at 12:47

GoogleCodeExporter commented 9 years ago
I just found "Comment 12" was posted by jeroen.vansteirteghem.

How cloud I miss it! :S

No more problem. I have to do some other things. 8

Original comment by goknmuse on 11 Aug 2012 at 12:57

GoogleCodeExporter commented 9 years ago
Thanks for your great development of APJP,  Jeroen. :)
还有 goknmuse 同学这么认真细致的回复和解答。

Best wishes.
祝一切顺利。:D

Original comment by Mariposa...@gmail.com on 11 Aug 2012 at 3:12

GoogleCodeExporter commented 9 years ago
[deleted comment]
GoogleCodeExporter commented 9 years ago
Comment 17 by myself has some problems about the picture c.( 
http://clip2net.com/clip/m96404/1344685171-clip-71kb.jpg ).

c'. http://clip2net.com/clip/m96404/1346770051-clip-90kb.jpg

To summary, it is a bug in APJP_LOCAL.sh and *.sh. However, it had been fixed. 
:P

Original comment by goknmuse on 4 Sep 2012 at 2:50

GoogleCodeExporter commented 9 years ago
Also found a bug or something needs fixing about Gedit.
It seems Gedit can not figure out the newline of Windows's type.
I should not have used Gedit to easily edit code. Emacs for coding is much 
better than gedit.

Original comment by goknmuse on 4 Sep 2012 at 3:01

GoogleCodeExporter commented 9 years ago
TO Jeroen, you can remove APJP_LOCAL_JAVA-1.0.0 from the download lists.
The APJP_LOCAL_JAVA-1.0.1 already tested and it is fine. :P

Original comment by goknmuse on 4 Sep 2012 at 3:14

GoogleCodeExporter commented 9 years ago
I know what's wrong with gedit which can not figure out the NEWLINE.
*.sh files in APJP is written in DOS filetype, so gedit reads them with DOS 
filetype, which causes gedit ignore the NEWLINE.
So Vim does. That why I can not find out the problem with Vim too.

http://clip2net.com/clip/m96404/1346827682-clip-19kb.jpg

So another solution is open *.sh files with Vim.

vim APJP_LOCAL.sh
:set fileformat=unix

http://clip2net.com/clip/m96404/1346827868-clip-20kb.jpg

BTW, Vim seems not very difficult. :P

Original comment by goknmuse on 5 Sep 2012 at 6:53

GoogleCodeExporter commented 9 years ago
What's more, do not forget save the buffer to file.

:wq

Original comment by goknmuse on 5 Sep 2012 at 6:55

GoogleCodeExporter commented 9 years ago
关于EOF 参见 http://en.wikipedia.org/wiki/End-of-file

Original comment by goknmuse on 30 Oct 2012 at 12:54