ProgrammingThis forum is for all programming questions.
The question does not have to be directly related to Linux and any language is fair game.
Welcome to LinuxQuestions.org, a friendly and active Linux Community.
You are currently viewing LQ as a guest. By joining our community you will have the ability to post topics, receive our newsletter, use the advanced search, subscribe to threads and access many other special features. Registration is quick, simple and absolutely free. Join our community today!
Note that registered members see fewer ads, and ContentLink is completely disabled once you log in.
I downloaded the latest Java SDK and installed it in my /usr/downloads folder without any problems.When I make my java file I compile it without any problems but when I try to run it with the java HelloWorld.java command I get a "class not found" error what could be the problem.
I know that to run a java class you don't put ".java" I've already programmed in java but in the windows environment.I'm guessing that the class cannot be found coz even in windows when try running a class file that doesn't exist you get an error that goes like this:
"Exception in thread "main" java.lang.NoClassDefFoundError:"
which is the error I'm getting yet the class file exists in my Linux environment.
How did you installed? RPM or self-extracting.
If rpm, just use the normal rpm uninstall method.
If self-extraction, just delete the directory, that's it.
I recommand you use self-extraction package.
You can choose to download rpm or self-extraction on the sun website.
It's easier and it can easily put the directory wherever you want, just as a standalone. And give the PATH to the "YourJDKDirectory/bin".
And it can easily co-exist with several version. You don't need to remove the old version. Just put the new one beside and change the PATH, that's it.
To import swing, swing is in the "javax" package. Not in the "java" package.
Last edited by moeminhtun; 08-06-2003 at 10:38 AM.
I know that in windows you set the environment variable so that you can compile and run java apps from any directory,Can the same thing be done in Linux?
If it can like share it with guys like me who are trying to shake off the addiction to windows
You have to set your PATH env. variable to include the Java binaries. To see your current path type "echo $PATH" in a terminal, to add Java, type "export PATH=$PATH:/your/path/to/java/bin" or add the line to your ~/.bashrc
You should also make sure that you have your $CLASSPATH variable set before you run, and that this contains the path to both the java classes (rt.jar) and to your own classes.
Remember compiling and running apps depend on different environment variables.
$PATH simply lets you execute the java binaries from any location, however $CLASSPATH tells the Java VM where to look for the classes to execute.