[OS]
Mac
[์ฌ์ฉ ํด]
Mac Terminal
[๋ช ๋ น์ด & ์๋ฌ๋ฉ์์ง]
1) javac [.java ํ์ผ๋ช ].java => .java ํ์ผ๊ณผ ๊ฐ์ ๊ฒฝ๋ก์ .class ํ์ผ ์์ฑ
2) java [.class ํ์ผ๋ช ] => ์๋ฌ ๋ฐ์
% java [.class ํ์ผ๋ช
]
์ค๋ฅ: ๊ธฐ๋ณธ ํด๋์ค [ํด๋์ค๋ช
]์(๋ฅผ) ์ฐพ๊ฑฐ๋ ๋ก๋ํ ์ ์์ต๋๋ค.
์์ธ: java.lang.NoClassDefFoundError: [๊ฒฝ๋ก] (wrong name: [ํด๋์ค๋ช
])
๋ ๊ฐ์ ๊ฒฝ์ฐ์๋ ๊ทธ๋ฅ java ๋ช ๋ น์ด ํธ์ถ ์์ ๊ฒฝ๋ก๊ฐ ์๋ชป๋์ด์ ์๊ฒผ๋ ๋ฌธ์ ..
[bin]
ใด [FolderName]
ใด A.class
[src]
ใด [FolderName]
ใด A.java
ใด A.class
ํด๋๊ฐ ์ด๋ฐ ์์ผ๋ก ๊ตฌ์ฑ๋์ด ์๋ค๊ณ ํ ๋,
๋๋ /src/FolderName ์์ผ๋ก ์ง์ ์ด๋ํ๋ค ํด๋น ํด๋ ์์์ java ๋ช ๋ น์ด๋ฅผ ์ผ๋๋ ์๊ฒผ๋ ๋ฌธ์ ์๋ค.
% cd ···/src/FolderName
% java A ==> ์๋ฌ ๋ฐ์
[ํด๊ฒฐ ๋ฐฉ๋ฒ]
์ต์๋จ์ package๋ช ๊น์ง ๋ถ์ฌ ๋ช ๋ น์ด ์คํ
% cd ..
% java FolderName/A
[์ถ์ฒ & ์ฐธ๊ณ ํ์ด์ง]
... You need to run it from the package root on. Go one folder up so that you're in the folder which in turn contains the clientrest folder representing the package and then execute java clientrest.ClientREST. You should not go inside the clientrest package folder and execute java ClientREST. |
NoClassDefFoundError: wrong name
I wrote a java program to test RESTful web services by using Netbeans7.0.1 and it works fine there. Now I wrote the build.xml file to compile the code and when I try to run the generated .class fil...
stackoverflow.com