LinuxQuestions.org
Register a domain and help support LQ
Go Back   LinuxQuestions.org > Forums > Non-*NIX Forums > Programming
User Name
Password
Programming This forum is for all programming questions.
The question does not have to be directly related to Linux and any language is fair game.

Notices

Tags used in this thread
Popular LQ Tags , , , ,

Reply
 
Thread Tools
Old 09-21-2009, 01:08 AM   #1
cgchayan
LQ Newbie
 
Registered: Sep 2009
Posts: 8
Thanked: 0
Unhappy i set CLASSPATH but still can't comile my java code


[Log in to get rid of this advertisement]
Hi
I am learning j2se n i have fedora 9 installed. While learning using packages I had to set set CLASSPATH. I wrote:
CLASSPATH=/home/leaf/Documents/javafiles/bytecode
because I wanted to import a class whose corresponding bytecode was saved in the mentioned /home/.../bytecode folder.
I tried echo $CLASSPATH and it showed the expected output.
but when i tried to compile my new class using
javac -d /home/.../bytecode Class2.java
it shows the errors:
package ABC does not exist
....
cannot find symbol
....
....
etc.

[ABC is the package that holds the previously compiled class that i want to import]

Please help..
thanking you,
Chayan
windows_xp_2003 cgchayan is offline  
Tag This Post , , , ,
Reply With Quote
Old 09-21-2009, 02:36 AM   #2
paulsm4
Senior Member
 
Registered: Mar 2004
Distribution: SusE 8.2
Posts: 3,318
Thanked: 144
Hi -

This link might help:
http://java.sun.com/docs/books/tutor...gingfiles.html

Basically, do this:
Quote:
1. If you've got a package "graphics", with a class "Rectangle"...
Code:
//in the Rectangle.java file 
package graphics;
public class Rectangle {
   . . . 
}
2. ... then put your source file "Rectangle.java" in a subdirectory called "graphics":
Quote:
.....\graphics\Rectangle.java
3. ... and compile and run your program directory ABOVE "graphics":
Quote:
javac graphics/Rectangle.java
java graphics/Rectangle
'Hope that helps .. PSM

PS:
You might find this link helpful, too:
http://www.jarticles.com/package/package_eng.html

Last edited by paulsm4; 09-21-2009 at 02:38 AM..
paulsm4 is offline     Reply With Quote

Reply

Bookmarks


Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
how to set java classpath on Redhat 9? antony_csf Programming 9 11-26-2004 06:48 AM
How to set CLASSPATH of java in Linux? vanhelsing Programming 1 08-23-2004 07:16 AM
I've set the CLASSPATH, but I still get a noClassDefFoundError. (Java) Travis86 Programming 6 02-05-2004 10:09 AM
set classpath in linux(slackware9) for java Manjula.S Linux - Software 1 10-16-2003 03:10 AM
How to set classpath for java jolly Linux - Software 3 04-22-2003 11:02 PM


All times are GMT -5. The time now is 04:01 PM.

Main Menu
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
RSS2  LQ Podcast
RSS2  LQ Radio
Twitter: @linuxquestions
identi.ca: @linuxquestions
Facebook: @linuxquestions
Open Source Consulting | Domain Registration