[java] What should my default class path directory be?

Started by
3 comments, last by the_better_nick 22 years, 6 months ago
What should my default class path directory be? I have just installed Visual J++, but when trying to run the following program: public class Welcome { public static void main( String args[] ) { System.out.println( "Hello World!" ); } } I continue to get the message: error J0051: Undefined package ''lang'' I just can not figue out what I am doing wrong. Thanks, ·†§ Nick §† ·
·†§ Nick §† ·
Advertisement
Not 100% sure about the syntac (havn''t used Java in a long time) But I belive you are forgetting to ''import'' the proper packages so your classes know what they are doing... like forgetting C++''s , to begin a java program you need

import java.lang.*
import java.lang.math.*


something along those lines. Good luck!
CodeSmith the Pixel PusherCodeSmith Webpage
Not 100% sure about the syntac (havn''t used Java in a long time) But I belive you are forgetting to ''import'' the proper packages so your classes know what they are doing... like forgetting C++''s , to begin a java program you need

import java.lang.*
import java.lang.math.*


something along those lines. Good luck!
CodeSmith the Pixel PusherCodeSmith Webpage
java.lang.* is supposedly already imported by the compiler, but I tried the import (import java.lang.* as well, and still am getting the same error.


·†§ Nick §† ·
·†§ Nick §† ·
Hmmm, well for one don''t use Visual J++ to compile, it''s a decent editor but it compiles into a Microsoft version of Java. Go to java.sun.com and get the 1.3.1 compiler. When you install it, it should handle setting your default classpath.

And no, you should never need to import java.lang.*;

"If consquences dictate our course of action, it doesn''t matter what''s right, it''s only wrong if you get caught."
- Tool

"There is no reason good should not triumph at least as often as evil. The triumph of anything is a matter of organization. If there are such things as angels, I hope that they're organized along the lines of the mafia." -Kurt Vonnegut

This topic is closed to new replies.

Advertisement