avatar
问个eclipse的问题# Java - 爪哇娇娃
s*t
1
好吧。。我承认我很土,把这么经典的大家耳朵都听烂了的歌拿出来。。。
8过,经典就是经典,经典到我在国内开心网上点歌时都反响强烈。。。
我觉得吧。。这个地球上至少1亿人听过这首歌。。。
PS:这个MV也是拍的很灵的
avatar
x*x
2
【 以下文字转载自 paladin 讨论区 】
发信人: xbox (树杈熊之Panda Express), 信区: paladin
标 题: 推荐 <>
发信站: BBS 未名空间站 (Wed Apr 1 21:05:21 2009)
see attachment for the complete file
It's a very funny book.
一只鬼眼明鉴三界,半腔正气玩转阴阳
诡异的赶尸家族,神秘的阴阳之道,鬼龙复生,天下大乱!
看一个实习阴阳师如何搅乱三界,拯救众生!
avatar
t*t
3
我写了一个testclass叫做TestClass.java
package com.test1;
class TestClass{}
javac ....
然后建立如下文件夹:
com\test1\TestClass.class
然后
jar cvf d:\test1.jar d:\com\test1\*.*
得到一个包。
进入eclipse,随便找个class,再随便找个method
写:
TestClass tc = new TestClass();
提示说找不到,于是 project-》properties-》build path,添加test1.jar,
然后
import com.test1;
eclipse说找不到 com。test1.
我随后查看了。classpath文件,
其中有:

但是后来我把
com\test1\TestClass.class
直接拷贝到 src 文件夹,eclipse就找到了。
哪位大侠能解释一下吗?难道是我的jar file生成的
avatar
e*6
4
嗯,是挺有趣的,哈哈。
avatar
g*g
5
Shouldn't you do
import com.test1.*;

【在 t*******t 的大作中提到】
: 我写了一个testclass叫做TestClass.java
: package com.test1;
: class TestClass{}
: javac ....
: 然后建立如下文件夹:
: com\test1\TestClass.class
: 然后
: jar cvf d:\test1.jar d:\com\test1\*.*
: 得到一个包。
: 进入eclipse,随便找个class,再随便找个method

avatar
S*e
6
不错
现在鬼故事要有特点的才能吸引人
这个相当有特点

【在 x**x 的大作中提到】
: 【 以下文字转载自 paladin 讨论区 】
: 发信人: xbox (树杈熊之Panda Express), 信区: paladin
: 标 题: 推荐 <>
: 发信站: BBS 未名空间站 (Wed Apr 1 21:05:21 2009)
: see attachment for the complete file
: It's a very funny book.
: 一只鬼眼明鉴三界,半腔正气玩转阴阳
: 诡异的赶尸家族,神秘的阴阳之道,鬼龙复生,天下大乱!
: 看一个实习阴阳师如何搅乱三界,拯救众生!

avatar
t*t
7
谢谢好虫。
我改成了 com.test1.*;
但是eclipse始终说com.test1找不到。
事实上如果我把class文件考入src文件以后,一旦我type com,eclipse会自己提示com
.test1.

【在 g*****g 的大作中提到】
: Shouldn't you do
: import com.test1.*;

avatar
j*6
8
很好看
avatar
Z*e
9
the problem is indeed with they way you created the jar
change your jar to a zip file and unzip it, a normal jar as created should
look like:
com\
test1\
Class1.class
Class2.class
...
META-INF\
MANIFEST.MF
I guess yours does not look like that, because you created the jar by
specifiy the absolute path instead of relative path. you should have created
the jar in the top of your source folder and use relative path, .e.g
jar cvf test.jar com\test1\*.*
Or, since you are using e

【在 t*******t 的大作中提到】
: 我写了一个testclass叫做TestClass.java
: package com.test1;
: class TestClass{}
: javac ....
: 然后建立如下文件夹:
: com\test1\TestClass.class
: 然后
: jar cvf d:\test1.jar d:\com\test1\*.*
: 得到一个包。
: 进入eclipse,随便找个class,再随便找个method

avatar
S*n
10
就这些么?
avatar
h*j
11
cd d:\
jar cvf d:\test1.jar com
这样在jar内的package path才对

【在 t*******t 的大作中提到】
: 我写了一个testclass叫做TestClass.java
: package com.test1;
: class TestClass{}
: javac ....
: 然后建立如下文件夹:
: com\test1\TestClass.class
: 然后
: jar cvf d:\test1.jar d:\com\test1\*.*
: 得到一个包。
: 进入eclipse,随便找个class,再随便找个method

avatar
t*t
12
刚才试了一下。。果然如此。

【在 h**j 的大作中提到】
: cd d:\
: jar cvf d:\test1.jar com
: 这样在jar内的package path才对

avatar
t*t
13
事实上我之前得到的jar里面的文件结构也是如此,但是之后用相对路径得到的文件结构
也是如此。。
难道jar还有别的什么隐藏文件?

【在 Z****e 的大作中提到】
: the problem is indeed with they way you created the jar
: change your jar to a zip file and unzip it, a normal jar as created should
: look like:
: com\
: test1\
: Class1.class
: Class2.class
: ...
: META-INF\
: MANIFEST.MF

avatar
Z*e
14
when I use command like "jar cvf test.jar D:\com\test", the resulting jar
structure would be:
D_\
com\
test\
Class1.class
...
META-INF\
MANIFEST.MF

结构

【在 t*******t 的大作中提到】
: 事实上我之前得到的jar里面的文件结构也是如此,但是之后用相对路径得到的文件结构
: 也是如此。。
: 难道jar还有别的什么隐藏文件?

avatar
t*t
15
谢谢指点,的确如此。
我在cygwin下面用unzip得到了和你一样的结果。
之前我一直用winrar,这个软件貌似自动优化了。。。

【在 Z****e 的大作中提到】
: when I use command like "jar cvf test.jar D:\com\test", the resulting jar
: structure would be:
: D_\
: com\
: test\
: Class1.class
: ...
: META-INF\
: MANIFEST.MF
:

avatar
s*n
16
change to public class TestClass()
相关阅读
logo
联系我们隐私协议©2024 redian.news
Redian新闻
Redian.news刊载任何文章,不代表同意其说法或描述,仅为提供更多信息,也不构成任何建议。文章信息的合法性及真实性由其作者负责,与Redian.news及其运营公司无关。欢迎投稿,如发现稿件侵权,或作者不愿在本网发表文章,请版权拥有者通知本网处理。